Parcourir la source

feat: 微信支付

xiansin il y a 2 ans
Parent
commit
a64b5f58ec

+ 1 - 1
mini/components/Recharge/index.vue

xqd
@@ -196,7 +196,7 @@ export default {
             this.$loading('支付结果查询中...')
             this.query()
           },
-          fail(err) {
+          fail: err => {
             console.log('fail:' + JSON.stringify(err))
             // _this.$u.toast("支付失败")
             clearInterval(this.interval)

+ 23 - 3
mini/pages.json

xqd xqd xqd xqd
@@ -53,14 +53,24 @@
     {
       "path": "pages/trace/index",
       "style": {
+        // #ifdef  MP-KUAISHOU
+        "navigationBarTitleText": "四海剧场",
+        // #endif
+        // #ifdef  MP-TOUTIAO
         "navigationBarTitleText": "张四爷剧场",
+        // #endif
         "enablePullDownRefresh": false
       }
     },
     {
       "path": "pages/my/index",
       "style": {
+        // #ifdef  MP-KUAISHOU
+        "navigationBarTitleText": "四海剧场",
+        // #endif
+        // #ifdef  MP-TOUTIAO
         "navigationBarTitleText": "张四爷剧场",
+        // #endif
         "enablePullDownRefresh": false
       }
     },
@@ -74,7 +84,12 @@
     {
       "path": "pages/trace/list",
       "style": {
+        // #ifdef  MP-KUAISHOU
+        "navigationBarTitleText": "四海剧场",
+        // #endif
+        // #ifdef  MP-TOUTIAO
         "navigationBarTitleText": "张四爷剧场",
+        // #endif
         "enablePullDownRefresh": false
       }
     },
@@ -137,21 +152,21 @@
     {
       "path": "pages/share/index",
       "style": {
-        "navigationBarTitleText": "分中心",
+        "navigationBarTitleText": "分中心",
         "enablePullDownRefresh": false
       }
     },
     {
       "path": "pages/share/income",
       "style": {
-        "navigationBarTitleText": "分佣金",
+        "navigationBarTitleText": "分佣金",
         "enablePullDownRefresh": false
       }
     },
     {
       "path": "pages/share/order",
       "style": {
-        "navigationBarTitleText": "分订单",
+        "navigationBarTitleText": "分订单",
         "enablePullDownRefresh": false
       }
     },
@@ -186,7 +201,12 @@
   ],
   "globalStyle": {
     "navigationBarTextStyle": "white", // black or white
+    // #ifdef  MP-KUAISHOU
+    "navigationBarTitleText": "四海剧场",
+    // #endif
+    // #ifdef  MP-TOUTIAO
     "navigationBarTitleText": "张四爷剧场",
+    // #endif
     "navigationBarBackgroundColor": "#151728",
     "backgroundColor": "#151728"
   },

+ 1 - 1
mini/pages/my/index.vue

xqd
@@ -107,7 +107,7 @@ export default {
         { icon: '/static/image/my-page/recharge.png', name: '充值记录', href: '/pages/my/recharge' },
         { icon: '/static/image/my-page/share.png', name: '分享好友', type: 'share' },
         { icon: '/static/image/my-page/contact.png', name: '联系客服', type: 'contact' },
-        { icon: '/static/image/my-page/share.png', name: '分中心', href: '/pages/share/index' },
+        { icon: '/static/image/my-page/share.png', name: '分中心', href: '/pages/share/index' },
         { icon: '/static/image/my-page/protocol.png', name: '用户协议', href: '/pages/my/protocol' }
       ],
       recharge: {

+ 1 - 1
mini/pages/share/income.vue

xqd
@@ -2,7 +2,7 @@
   <view class="share-income">
     <view class="head-box main-between cross-center">
       <view class="left-box">
-        <text>分佣金</text>
+        <text>分佣金</text>
         <view class="price main-left cross-bottom">{{ userInfo.total_income }}
           <view class="unit">元</view>
         </view>

+ 2 - 2
mini/pages/share/index.vue

xqd
@@ -59,8 +59,8 @@ export default {
   data() {
     return {
       menus: [
-        { icon: '/static/image/share/income.png', name: '分佣金', href: '/pages/share/income' },
-        { icon: '/static/image/share/order.png', name: '分订单', href: '/pages/share/order' },
+        { icon: '/static/image/share/income.png', name: '分佣金', href: '/pages/share/income' },
+        { icon: '/static/image/share/order.png', name: '分订单', href: '/pages/share/order' },
         { icon: '/static/image/share/detail.png', name: '提现明细', href: '/pages/share/withdrawDetail' },
         { icon: '/static/image/share/team.png', name: '我的团队', href: '/pages/share/team' }
       ]

+ 1 - 1
mini/pages/share/team.vue

xqd
@@ -1,7 +1,7 @@
 <template>
   <view class="share-team">
     <view class="title">
-      <text>一级分名称(1)</text>
+      <text>一级分名称(1)</text>
     </view>
 
     <view

+ 5 - 5
server/app/Helper/UniPlatform/BaseUniPlatform.php

xqd
@@ -39,14 +39,14 @@ abstract class BaseUniPlatform
      * @param array $config
      * @return $this
      */
-    public function factory($config = [])
+    public function factory(array $config = [])
     {
         $this->appId = $config['app_id'];
         $this->secret = $config['app_secret'];
-        $this->slat = isset($config['slat']) ? $config['slat'] : null;
-        $this->token = isset($config['token']) ?  $config['token'] : null;
-        $this->mchId = isset($config['mch_id']) ?  $config['mch_id'] : null;
-        $this->mchKey = isset($config['mch_key']) ?  $config['mch_key'] : null;
+        $this->slat = $config['slat'] ?? null;
+        $this->token = $config['token'] ?? null;
+        $this->mchId = $config['mch_id'] ?? null;
+        $this->mchKey = $config['mch_key'] ?? null;
 
         $this->setAccessFileDir();
         $this->setAccessFilePath();

+ 2 - 2
server/app/Http/Controllers/V1/Controller.php

xqd
@@ -107,8 +107,8 @@ class Controller extends BaseController
         return (new Wechat(app(WechatAPI::class)))->factory([
             'app_id' => $setting->mini_app_id,
             'app_secret' => $setting->mini_app_key,
-            'mac_id' => $setting->wechat_mch_id,
-            'mac_key' => $setting->wechat_mch_key,
+            'mch_id' => $setting->wechat_mch_id,
+            'mch_key' => $setting->wechat_mch_key,
             'response_type' => 'array'
         ]);
 

+ 11 - 7
server/app/Http/Controllers/V1/User/RechargeController.php

xqd xqd
@@ -61,15 +61,18 @@ class RechargeController extends Controller
 
             if($recharge){
                 $pay = Pay::find($recharge->pay_id);
-                $res = [
-                    'order_id' => $pay->prepay_id,
-                    'order_token' => $pay->token,
-                    'pay_id' => $pay->pay_id,
-                ];
+                if(\user()->info->platform == 3){
+                    $res = $app->payment()->jssdk->bridgeConfig($pay->prepay_id);
+                    $res = json_decode($res, true);
+                }else{
+                    $res = [
+                        'order_id' => $pay->prepay_id,
+                        'order_token' => $pay->token,
+                        'pay_id' => $pay->pay_id,
+                    ];
+                }
             }else{
                 $res = app(Pay::class)->create($app, $combo->price, Pay::SOURCE_RECHARGE);
-
-
                 $recharge = new UserRechargeRecord();
                 $recharge->user_id = \user()->id;
                 $recharge->combo_id = $combo->id;
@@ -82,6 +85,7 @@ class RechargeController extends Controller
                 if(\user()->info->platform == 3){
                     $pay = Pay::find($res['pay_id']);
                     $res = $app->payment()->jssdk->bridgeConfig($pay->prepay_id);
+                    $res = json_decode($res, true);
                 }
 
             }