getFile(), $e->getLine(), $e->getMessage() ])); self::setError($e->getMessage()); return $e->getMessage(); } } /** * @notes 充值回调 * @param $orderSn * @param array $extra */ public static function recharge($orderSn, array $extra = []) { $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty(); // 增加用户累计充值金额及用户余额 $user = User::findOrEmpty($order->user_id); $user->total_recharge_amount += $order->order_amount; $user->user_money += $order->order_amount; $user->save(); // 记录账户流水 AccountLogLogic::add( $order->user_id, AccountLogEnum::UM_INC_RECHARGE, AccountLogEnum::INC, $order->order_amount, $order->sn, '用户充值' ); // 更新充值订单状态 $order->transaction_id = $extra['transaction_id'] ?? ''; $order->pay_status = PayEnum::ISPAID; $order->paid_amount = $order->order_amount; $order->pay_time = time(); $order->save(); } /** * @notes 服务回调 * @param $orderSn * @param array $extra */ public static function goods($orderSn, array $extra = []) { $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty(); Log::write($order->toArray(),JSON_UNESCAPED_UNICODE); if(!$order->isEmpty()){ // 更新充值订单状态 $order->transaction_id = $extra['transaction_id'] ?? ''; $order->pay_status = PayEnum::ISPAID; $order->pay_time = time(); $order->paid_amount = $order->order_amount; $order->save(); $work = ServiceWork::findOrEmpty($order->work_id); if(!$work->isEmpty()){ $work->work_pay_status = WorkEnum::IS_PAY_STATUS; $orders = \app\common\model\orders\RechargeOrder::where(['work_id'=>$order->work_id])->select()->toArray(); $order_total = 0; $order_amount = 0; foreach ($orders as $k=>$v){ $order_total += $v['order_total']; $order_amount += $v['order_amount']; } $work->work_total = $order_total; $work->work_amount = $order_amount; if($work->work_status != 0){ $work->work_status = 7; $work->user_confirm_status = 5; $work->service_status = 3; } $work->work_pay_status = 1; $work->save(); } } } public static function shop_goods($orderSn, array $extra = []) { $order = ShopOrders::where('sn', $orderSn)->findOrEmpty(); // 更新充值订单状态 $order->transaction_id = $extra['transaction_id'] ?? ''; $order->pay_status = PayEnum::ISPAID; $order->pay_time = time(); $order->shop_order_type = 2; $order->save(); } }