shish преди 4 години
родител
ревизия
3ebf1b626d
променени са 4 файла, в които са добавени 26 реда и са изтрити 27 реда
  1. 15 14
      app-ghs/controllers/ApplyController.php
  2. 2 2
      biz-ghs/admin/classes/AdminClass.php
  3. 0 2
      biz-hd/admin/classes/AdminClass.php
  4. 9 9
      common/components/sms.php

+ 15 - 14
app-ghs/controllers/ApplyController.php

@@ -31,8 +31,8 @@ class ApplyController extends BaseController
             util::fail('请输入正确手机号');
         }
         $rand = rand(11111, 99999);
-        $msg = "注册验证码:{$rand},10分钟内有效";
-        sms::send($mobile, $msg);
+        $minute = 10;
+        sms::send($mobile . ',' . $rand . ',' . $minute, '注册验证码:{$var},{$var}分钟内有效');
         $cacheKey = 'register_mobile_code_' . $mobile;
         Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 600, $rand]);
         util::complete();
@@ -91,32 +91,33 @@ class ApplyController extends BaseController
         $mobile = $post['mobile'] ?? '';
 
         //避免重复提交
-        util::checkRepeatCommit($mobile, 30);
+        util::checkRepeatCommit($mobile, 10);
 
         $cacheKey = 'register_mobile_code_' . $mobile;
         $saveAuthCode = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+        if (empty($saveAuthCode)) {
+            util::fail('请填写验证码哦');
+        }
+        if (empty($authCode)) {
+            util::fail('请填写验证码');
+        }
         if ($saveAuthCode != $authCode) {
             util::fail('验证码错误');
         }
-        Yii::$app->redis->executeCommand('DEL', [$cacheKey]);
 
         $ptStyle = Yii::$app->params['ptStyle'];
         $name = $post['adminName'] ?? '';
-        $adminInfo = [
-            'name' => $name,
-            'mobile' => $mobile,
-            'style' => $ptStyle,
-        ];
+        $adminInfo = ['name' => $name, 'mobile' => $mobile, 'style' => $ptStyle,];
         $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
         $admin = AdminService::replaceAdmin($adminInfo, $fromApp);
         $adminId = $admin['id'] ?? 0;
-
         $post['adminId'] = $adminId;
-        if (isset($admin['currentShopId']) && !empty($admin['currentShopId'])) {
-            util::fail('您有店铺了');
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        if (!empty($currentShopId)) {
+            util::fail('您已提交过申请');
         }
-        if (isset($admin['openShop']) && $admin['openShop'] != 1) {
-            util::fail('店铺待审核中,无需重复申请');
+        if (isset($admin['openShop']) && $admin['openShop'] == 2) {
+            util::fail('审核中,无需重复申请');
         }
         $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
         $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';

+ 2 - 2
biz-ghs/admin/classes/AdminClass.php

@@ -79,7 +79,7 @@ class AdminClass extends BaseClass
         if (!empty($adminId)) {
             $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $shopId, 'adminId' => $adminId]);
             if (empty($shopAdmin)) {
-                $text = (string)rand(123123, 987987);
+                $text = (string)'a@' . rand(1111, 9999);
                 $admin = \biz\admin\classes\AdminClass::getById($adminId, true);
                 if (empty($admin)) {
                     util::fail('没有找到员工');
@@ -108,7 +108,7 @@ class AdminClass extends BaseClass
                 ];
                 ShopAdminClass::add($shopData);
                 $url = Yii::$app->params['ghsDomain'];
-                sms::freeSend($mobile . ',' . $url . ',' . $mobile . ',' . $text, '您的开店申请审核通过,地址:{$var} 帐号:{$var} 密码:{$var}');
+                sms::freeSend($mobile . ',' . $url . ',' . $mobile . ',' . $text, '开店审核通过,帐号:{$var} 密码:{$var},登录APP后,点右下角菜单 我的-修改密码 及时修改密码');
             }
         }
     }

+ 0 - 2
biz-hd/admin/classes/AdminClass.php

@@ -66,8 +66,6 @@ class AdminClass extends BaseClass
                     'founder' => 2,
                 ];
                 ShopAdminClass::add($shopData);
-                //$url = Yii::$app->params['hdDomain'];
-                //sms::freeSend($mobile . ',' . $url . ',' . $mobile . ',' . $text, '您的开店申请审核通过,地址:{$var} 帐号:{$var} 密码:{$var}');
             }
         }
     }

+ 9 - 9
common/components/sms.php

@@ -36,7 +36,7 @@ class sms
     const LIMIT = 15;
 
     //商家发短信 ssh 2019.12.24
-    public static function merchantSend($mobile, $msg, $merchant)
+    public static function merchantSend($params, $msg, $merchant)
     {
         $sjId = $merchant['id'];
         $asset = MerchantAssetService::getBySjId($sjId, true);
@@ -47,11 +47,11 @@ class sms
         }
         $asset->remainSmsNum = --$remainSmsNum;
         $asset->save();
-        self::freeSend($mobile, $msg, $merchant);
+        self::freeSend($params, $msg, $merchant);
     }
 
     //自由发短,无ip和数量限制 ssh 2019.12.24
-    public static function freeSend($mobile, $msg, $merchant = null)
+    public static function freeSend($params, $msg, $merchant = null)
     {
         $ptStyle = dict::getDict('ptStyle', 'hd');
         if (isset(Yii::$app->params['ptStyle'])) {
@@ -62,21 +62,21 @@ class sms
         $sign = isset($merchant) == true ? "【{$merchant['name']}】" : "【{$name}】";
         $msg .= $sign;
         $sms = new ChuanglanSmsApi();
-        $result = $sms->sendVariableSMS($msg, $mobile);
+        $result = $sms->sendVariableSMS($msg, $params);
         if (!is_null(json_decode($result))) {
             $output = json_decode($result, true);
             if (isset($output['code']) && $output['code'] == '0') {
-                Yii::info("短信发送成功,手机号:{$mobile} 返回:" . $result);
+                Yii::info("短信发送成功,参数:{$params} 返回:" . $result);
             } else {
-                Yii::info("短信发送失败,手机号:{$mobile} 返回:" . $result);
+                Yii::info("短信发送失败,参数:{$params} 返回:" . $result);
             }
         } else {
-            Yii::info("短信发送失败,手机号:{$mobile} 返回:" . $result);
+            Yii::info("短信发送失败,参数:{$params} 返回:" . $result);
         }
     }
 
     //发短信,有ip和用户数量限制 ssh 2020.2.27
-    public static function send($mobile, $msg, $merchant = null)
+    public static function send($params, $msg, $merchant = null)
     {
         $ptStyle = Yii::$app->params['ptStyle'];
         $open = \biz\wx\classes\WxOpenClass::getByCondition(['style' => $ptStyle]);
@@ -107,7 +107,7 @@ class sms
         Yii::$app->redis->executeCommand('SETEX', [$statusKey, 60, 'hasSend']);
         Yii::$app->redis->executeCommand('SETEX', [$todayKey, 86400, ++$num]);
         $sms = new ChuanglanSmsApi();
-        $sms->sendVariableSMS($msg, $mobile);
+        $sms->sendVariableSMS($msg, $params);
     }
 
 }