where($where)->first(); if (!empty($result)){ TravelOrder::affairCommit(); return $result; }else{ return false; } }catch (\Exception $exception){ TravelOrder::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:修改订单支付状态 * @param string $order_id * @param int $order_finish * @return int * User: YCP * Date: 2022/11/28 */ public static function updatePayStatus($order_id, $order_pay_status) { TravelOrder::affairBegin(); try { $where = []; $where['order_id'] = $order_id; $data = []; $data['order_pay_status'] = $order_pay_status; if($order_pay_status == 1){ $data['order_pay_time'] = time(); }else{ $data['order_pay_time'] = ""; } $result = TravelOrder::where($where)->update($data); if ($result !== false){ TravelOrder::affairCommit(); return true; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ TravelOrder::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:修改订单状态 * @param string $order_id * @param int $order_finish * @return int * User: YCP * Date: 2022/11/28 */ public static function updateOrderStatus($order_id, $order_status, $order_reject_reason) { TravelOrder::affairBegin(); try { $where = []; $where['order_id'] = $order_id; $data = []; $data['order_status'] = $order_status; if($data['order_status'] == 10){ $data['order_reject_reason'] = $order_reject_reason; } $result = TravelOrder::where($where)->update($data); if ($result !== false){ TravelOrder::affairCommit(); return true; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ TravelOrder::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } }