getFile(), $e->getLine(), $e->getMessage() ])); self::setError($e->getMessage()); return $e->getMessage(); } } /** * @notes 充值回调 * @param $orderSn * @param array $extra * @author 段誉 * @date 2023/2/27 15:28 */ 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->pay_time = time(); $order->save(); } /** * @notes 充值回调 * @param $orderSn * @param array $extra * @author 段誉 * @date 2023/2/27 15:28 */ public static function service($orderSn, array $extra = []) { $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty(); // 更新充值订单状态 $order->transaction_id = $extra['transaction_id'] ?? ''; $order->pay_status = PayEnum::ISPAID; $order->pay_time = time(); $order->save(); //更新服务数据 $s_where['order_id'] = $order['id']; $user_service_info = UserService::where($s_where)->findOrEmpty(); if(!$user_service_info->isEmpty()){ $user_service_info->status = 1; $user_service_info->expiration_time = time() + 365*24*60*60; $user_service_info->save(); $type = $user_service_info['type']; switch ($type){ case 1: $updateData['agricultural_status']=2; break; case 2: $updateData['bake_status']=2; break; case 3: $updateData['air_status']=2; break; } $updateWhere['id'] = $user_service_info['user_id']; $ret = User::where($updateWhere)->update($updateData); } } }