|
|
@@ -17,6 +17,7 @@ namespace app\common\logic;
|
|
|
use app\common\enum\PayEnum;
|
|
|
use app\common\enum\user\AccountLogEnum;
|
|
|
use app\common\model\recharge\RechargeOrder;
|
|
|
+use app\common\model\agricultural_machinery\UserService;
|
|
|
use app\common\model\user\User;
|
|
|
use think\facade\Db;
|
|
|
use think\facade\Log;
|
|
|
@@ -84,5 +85,31 @@ class PayNotifyLogic extends BaseLogic
|
|
|
$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();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|