moonsflyer 7 달 전
부모
커밋
91a90697b5
2개의 변경된 파일21개의 추가작업 그리고 3개의 파일을 삭제
  1. 17 0
      app/common/logic/PaymentLogic.php
  2. 4 3
      app/common/service/pay/WeChatPayService.php

+ 17 - 0
app/common/logic/PaymentLogic.php

@@ -21,6 +21,7 @@ use app\common\model\pay\PayWay;
 use app\common\model\recharge\RechargeOrder;
 use app\common\model\user\User;
 use app\common\service\pay\AliPayService;
+use app\common\model\agricultural_machinery\UserService;
 use app\common\service\pay\WeChatPayService;
 
 
@@ -163,6 +164,22 @@ class PaymentLogic extends BaseLogic
             if ($order['pay_status'] == PayEnum::ISPAID) {
                 throw new \Exception('订单已支付');
             }
+            $desc = '';
+            $user_service = UserService::where(['order_id'=>$params['order_id']])->find();
+            if($user_service){
+                switch ($user_service['type']){
+                    case 1:
+                        $desc = '入驻农机手服务费用';
+                        break;
+                    case 2:
+                        $desc = '入驻烘干服务费用';
+                        break;
+                    case 3:
+                        $desc = '入驻飞防服务费用';
+                        break;
+                }
+            }
+            $order['desc'] = $desc;
             return $order;
         } catch (\Exception $e) {
             self::$error = $e->getMessage();

+ 4 - 3
app/common/service/pay/WeChatPayService.php

@@ -172,10 +172,11 @@ class WeChatPayService extends BasePayService
      */
     public function nativePay($from, $order, $appId)
     {
+        // $this->payDesc($from)
         $response = $this->app->getClient()->postJson('v3/pay/transactions/native', [
             'appid' => $appId,
             'mchid' => $this->config['mch_id'],
-            'description' => $this->payDesc($from),
+            'description' =>$order['desc']??'服务',
             'out_trade_no' => $order['pay_sn'],
             'notify_url' => $this->config['notify_url'],
             'amount' => [
@@ -318,10 +319,10 @@ class WeChatPayService extends BasePayService
     public function payDesc($from)
     {
         $desc = [
-            'order' => '商品',
+            'order' => '服务',
             'recharge' => '充值',
         ];
-        return $desc[$from] ?? '商品';
+        return $desc[$from] ?? '服务';
     }