WIN-2308041133\Administrator 2 هفته پیش
والد
کامیت
92cd202a1f
3فایلهای تغییر یافته به همراه75 افزوده شده و 12 حذف شده
  1. 21 0
      app/api/controller/v2/wechat/WechatController.php
  2. 2 0
      app/api/route/v2.php
  3. 52 12
      app/services/agent/AgentLevelServices.php

+ 21 - 0
app/api/controller/v2/wechat/WechatController.php

@@ -12,7 +12,9 @@ namespace app\api\controller\v2\wechat;
 
 use app\Request;
 use app\services\wechat\WechatServices;
+use crmeb\exceptions\ApiException;
 use crmeb\services\CacheService;
+use crmeb\services\oauth\OAuth;
 
 /**
  * Class WechatController
@@ -49,6 +51,25 @@ class WechatController
         return app('json')->success($data);
     }
 
+    public function authOpenId()
+    {
+        /** @var OAuth $oauth */
+        $oauth = app()->make(OAuth::class);
+        $wechatInfo = $oauth->oauth();
+        if (!isset($wechatInfo['nickname'])) {
+            $wechatInfo = $oauth->getUserInfo($wechatInfo['openid']);
+            if (!isset($wechatInfo['nickname']))
+                throw new ApiException(410131);
+            if (isset($wechatInfo['tagid_list']))
+                $wechatInfo['tagid_list'] = implode(',', $wechatInfo['tagid_list']);
+        } else {
+            if (isset($wechatInfo['privilege'])) unset($wechatInfo['privilege']);
+        }
+        $wechatInfo['user_type'] = 'wechat';
+        $openid = $wechatInfo['openid'];
+        return $openid;
+    }
+
     /**
      * 公众号授权绑定手机号
      * @param string $key

+ 2 - 0
app/api/route/v2.php

@@ -22,6 +22,8 @@ Route::group('v2', function () {
             Route::get('routine/auth_type', 'v2.wechat.AuthController/authType')->option(['real_name' => '小程序页面登录类型']);
             //小程序授权登录,返回token
             Route::get('routine/auth_login', 'v2.wechat.AuthController/authLogin')->option(['real_name' => '小程序授权登录']);
+            //小程序授权登录,返回openid
+            Route::get('routine/auth_openid', 'v2.wechat.AuthController/authOpenId')->option(['real_name' => '小程序授权登录']);
             //小程序授权绑定手机号
             Route::post('routine/auth_binding_phone', 'v2.wechat.AuthController/authBindingPhone')->option(['real_name' => '小程序授权绑定手机号']);
             //小程序手机号直接登录

+ 52 - 12
app/services/agent/AgentLevelServices.php

@@ -271,13 +271,33 @@ class AgentLevelServices extends BaseServices
         $field[] = Form::number('discount', '等级折扣', 0)->appendRule('suffix', [
             'type' => 'div',
             'class' => 'tips-info',
-            'domProps' => ['innerHTML' => '购买商品享受折扣(0-1000之间整数)百分比']
+            'domProps' => ['innerHTML' => '购买商品享受折扣(0-100之间整数)百分比']
         ])->max(100)->precision(0);
-        $field[] = Form::number('free_issue', '下级购买礼包赠送优惠券id', 0)->precision(0);
-        $field[] = Form::number('verific_reward', '两条线各核销200单以上的奖励金额', 0)->precision(2);
-        $field[] = Form::number('more_reward', '三条线及以上各核销200单以上的奖励金额', 0)->precision(2);
-        $field[] = Form::number('equal_award', '平级奖', 0)->precision(2);
-        $field[] = Form::number('spread_brokerage', '推荐下单奖励佣金比例', 0)->precision(2);
+        $field[] = Form::number('free_issue', '下级礼包优惠券id', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '下级购买礼包时赠送的优惠券ID']
+        ])->precision(0);
+        $field[] = Form::number('verific_reward', '两条线核销奖励', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '两条线各核销200单以上的奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('more_reward', '三线及以上核销奖励', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '三条线及以上各核销200单以上的奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('equal_award', '平级奖', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '平级奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('spread_brokerage', '推荐下单佣金比例', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '推荐下单奖励佣金比例']
+        ])->precision(2);
 //        $field[] = Form::number('two_brokerage', '二级上浮', 0)->appendRule('suffix', [
 //            'type' => 'div',
 //            'class' => 'tips-info',
@@ -311,13 +331,33 @@ class AgentLevelServices extends BaseServices
         $field[] = Form::number('discount', '等级折扣', $levelInfo['discount'])->appendRule('suffix', [
             'type' => 'div',
             'class' => 'tips-info',
-            'domProps' => ['innerHTML' => '购买商品享受折扣(0-1000之间整数)百分比']
+            'domProps' => ['innerHTML' => '购买商品享受折扣(0-100之间整数)百分比']
         ])->max(100)->precision(0);
-        $field[] = Form::number('free_issue', '下级购买礼包赠送优惠券id', $levelInfo['free_issue'])->precision(0);
-        $field[] = Form::number('verific_reward', '两条线各核销200单以上的奖励金额', $levelInfo['verific_reward'])->precision(2);
-        $field[] = Form::number('more_reward', '三条线及以上各核销200单以上的奖励金额', $levelInfo['more_reward'])->precision(2);
-        $field[] = Form::number('equal_award', '平级奖', $levelInfo['equal_award'])->precision(2);
-        $field[] = Form::number('spread_brokerage', '推荐下单奖励佣金比例', $levelInfo['spread_brokerage'])->precision(2);
+        $field[] = Form::number('free_issue', '下级礼包优惠券id', $levelInfo['free_issue'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '下级购买礼包时赠送的优惠券ID']
+        ])->precision(0);
+        $field[] = Form::number('verific_reward', '两条线核销奖励', $levelInfo['verific_reward'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '两条线各核销200单以上的奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('more_reward', '三线及以上核销奖励', $levelInfo['more_reward'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '三条线及以上各核销200单以上的奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('equal_award', '平级奖', $levelInfo['equal_award'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '平级奖励金额']
+        ])->precision(2);
+        $field[] = Form::number('spread_brokerage', '推荐下单佣金比例', $levelInfo['spread_brokerage'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '推荐下单奖励佣金比例']
+        ])->precision(2);
 //        $field[] = Form::number('two_brokerage', '二级上浮', $levelInfo['two_brokerage'])->appendRule('suffix', [
 //            'type' => 'div',
 //            'class' => 'tips-info',