WIN-2308041133\Administrator vor 5 Monaten
Ursprung
Commit
da4b0dcd10

+ 4 - 1
application/api/controller/Lave.php

@@ -169,12 +169,15 @@ class Lave extends Api
 //                ['help_id', 0],
                 ['plan_id', 0],
                 ['from', 'weixin'],
+                ['return_web','1']
             ], $request
         );
         @file_put_contents("quanju.txt", $where['from'] . "-来源\r\n", 8);
         if (!$this->auth->isLogin()) {
             $this->error(__('Please login first'), null, 401);
         }
+        $return_web = $where['return_web'];
+        unset($where['return_web']);
         $where['user_id']=$this->auth->getUserinfo()['id'];
         $where1 = $where;
         unset($where1['from']);
@@ -241,7 +244,7 @@ class Lave extends Api
                 } else if ($where['from'] == 'weixinh5') {
                     $jsConfig = LaveRepository::h5PaySign($this->cid, $orderId, $plan_record);
                 } else {
-                    $jsConfig = LaveRepository::wxPaySign($this->cid, $orderId, $plan_record);
+                    $jsConfig = LaveRepository::wxPaySign($this->cid, $orderId, $plan_record,$return_web);
                 }
             } catch (\Exception $e) {
                 return $this->error($e->getMessage());

+ 3 - 2
extend/liuniu/WechatService.php

@@ -597,7 +597,7 @@ class WechatService
      * @param string $trade_type
      * @param array $options
      */
-    public static function signedOrder($contract_code, $plan_id, $cid = 0,$contract_display_account='',$nickname='')
+    public static function signedOrder($contract_code, $plan_id, $cid = 0,$contract_display_account='',$nickname='',$return_web = '1')
     {
 //        $total_fee = bcmul($total_fee, 100, 0);
 //        $timestamp=time();
@@ -622,10 +622,11 @@ class WechatService
             'plan_id' => $plan_id,
             'contract_code' => $contract_code,
             'request_serial' => $current_timestamp, // 使用时间戳作为序列号
-            'contract_display_account' => $nickname,
+            'contract_display_account' => urlencode($contract_display_account),
             'notify_url' => 'http://red.igxys.com/api/wechat/notify/'.$cid,
             'timestamp' => $current_timestamp, // 动态时间戳
             'version' => '1.0',
+            'return_web' =>$return_web
         ];
 
 // 关键步骤1:先对需要编码的参数进行原始值存储

+ 3 - 3
extend/liuniu/repositories/LaveRepository.php

@@ -88,13 +88,13 @@ class LaveRepository
      * @return array|string
      * @throws Exception
      */
-    public static function wxpaySign($cid, $orderId,$plan_record, $field = "order_id")
+    public static function wxpaySign($cid, $orderId,$plan_record, $field = "order_id",$return_web ='1')
     {
 
         $openid = UserRelation::userIdToOpenId($plan_record['uid']);
         if ($plan_record['uid']==6779||$plan_record['uid']==12125){
-            $nickname = User::where('id',$plan_record['uid'])->value('nickname');
-            $rs = WechatService::signedOrder($plan_record['contract_code'],$plan_record['plan_id'],$cid,$plan_record['contract_display_account'],$nickname);
+            $username = User::where('id',$plan_record['uid'])->value('username');
+            $rs = WechatService::signedOrder($plan_record['contract_code'],$plan_record['plan_id'],$cid,$plan_record['contract_display_account'],$username,$return_web);
             @file_put_contents("quanju3.txt", json_encode($rs) . "-签约返回结果测试2\r\n", 8);
             return $rs;
         }else{