lizhen_gitee před 1 rokem
rodič
revize
78fe3fc2c2
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      addons/unishop/controller/Pay.php

+ 6 - 2
addons/unishop/controller/Pay.php

@@ -111,7 +111,7 @@ class Pay extends Base
 
             //MWEB
             $platfrom = $this->request->header('platform', 'MP-WEIXIN');
-
+            $platfrom = 'H5';
             switch ($platfrom) {
                 case 'MP-WEIXIN':
                     $trade_type = 'JSAPI';
@@ -128,15 +128,18 @@ class Pay extends Base
             if (Wechat::h5InWechat()) {
                 $trade_type = 'JSAPI';
             }
+            $trade_type = 'MWEB';
 
             $products = $order->products()->select();
 
             $body = Config::getByName('name')['value'];
             foreach ($products as $product) {
                 $body .= '_' . $product['title'];
+                break;
             }
 
-            $openid = Wechat::getOpenidByUserId($this->auth->id);
+//            $openid = Wechat::getOpenidByUserId($this->auth->id);
+            $openid = '';
             $appid = Config::getByName('app_id')['value'];
             // 如果 JSAPI 必须传openid、
             if ($trade_type == 'JSAPI' && empty($openid)) {
@@ -340,6 +343,7 @@ class Pay extends Base
             $body = Config::getByName('name')['value'];
             foreach ($products as $product) {
                 $body .= '_' . $product['title'];
+                break;
             }
 
             $platfrom = $this->request->header('platform', 'H5');