Explorar o código

注册验证码

shish %!s(int64=4) %!d(string=hai) anos
pai
achega
3a51320d21

+ 3 - 3
app-ghs/controllers/ApplyController.php

@@ -30,11 +30,11 @@ class ApplyController extends BaseController
         if (stringUtil::isMobile($mobile) == false) {
             util::fail('请输入正确手机号');
         }
-        $rand = rand(1111, 9999);
-        $msg = '注册验证码:' . $rand . ',5分钟内有效';
+        $rand = rand(11111, 99999);
+        $msg = "注册验证码:{$rand},10分钟内有效";
         sms::send($mobile, $msg);
         $cacheKey = 'register_mobile_code_' . $mobile;
-        Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 300, $rand]);
+        Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 600, $rand]);
         util::complete();
     }
 

+ 6 - 6
app-ghs/controllers/BaseController.php

@@ -8,7 +8,6 @@ use biz\shop\classes\ShopClass;
 use biz\shop\classes\ShopExtClass;
 use biz\sj\classes\SjClass;
 use biz\sj\services\MerchantExtendService;
-use biz\sj\services\MerchantService;
 use bizGhs\admin\services\AdminService;
 use common\components\dict;
 use common\components\jwt;
@@ -22,7 +21,8 @@ class BaseController extends PublicController
     public $appId;
     public $isWx = false;
     public $isLogin = false;
-    public $guestAccess = [];//不需要登陆的方法名
+    //不需要登陆的方法名
+    public $guestAccess = [];
 
     //ssh 2020.3.8
     public function beforeAction($action)
@@ -60,19 +60,19 @@ class BaseController extends PublicController
             $shop = ShopClass::getById($currentShopId, true);
             $this->shop = $shop;
             if (empty($shop)) {
-                util::fail('没有找到您管理的门店');
+                util::fail('没有找到您的门店');
             }
             $shopExt = ShopExtClass::getByCondition(['shopId' => $currentShopId], true);
             if (empty($shopExt)) {
-                util::fail('没有找到门店拓展信息');
+                util::fail('门店信息有问题,请联系管理员');
             }
             $this->shopExt = $shopExt;
             $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0], true);
             if (empty($shopAdmin)) {
-                util::logout('没有找到员工信息');
+                util::logout('没有找到员工');
             }
             if (isset($shopAdmin->delStatus) && $shopAdmin->delStatus == 1) {
-                util::fail('您还不是员工');
+                util::fail('您还不是员工');
             }
             if (isset($shopAdmin->status) && $shopAdmin->status == 0) {
                 util::fail('您的帐号已被禁用');

+ 6 - 4
app-ghs/controllers/MainController.php

@@ -18,6 +18,8 @@ use GatewayClient\Gateway;
 class MainController extends BaseController
 {
 
+    public $guestAccess = ['my'];
+
     //采购商城海报 shish 20210610
     public function actionGetMallPoster()
     {
@@ -187,11 +189,11 @@ class MainController extends BaseController
         $balance = $shop->balance ?? 0.00;
         $txBalance = $shop->txBalance ?? 0.00;
         $sj = isset($this->sj) && !empty($this->sj) ? $this->sj->attributes : [];
-        $shopImg = Yii::$app->params['ghsImgHost'].'retail/default-img.png';
+        $shopImg = Yii::$app->params['ghsImgHost'] . 'retail/default-img.png';
         $deadline = $sj['deadline'] ?? '';
         $relation = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : [];
-        $adminName = $relation['name'];
-        $shopAdminId = $relation['id'];
+        $adminName = $relation['name'] ?? '';
+        $shopAdminId = $relation['id'] ?? 0;
         $mobile = $relation['mobile'] ?? '';
         $sjName = $sj['name'] ?? '';
         $shopName = $shop->shopName ?? '';
@@ -214,4 +216,4 @@ class MainController extends BaseController
         util::success($data);
     }
 
-}
+}

+ 1 - 1
common/components/ChuanglanSmsApi.php

@@ -64,7 +64,7 @@ class ChuanglanSmsApi {
 			'params' => $params,
 			'report' => 'true'
         	);
-		
+
 		$result = $this->curlPost( self::API_VARIABLE_URL, $postArr);
 		return $result;
 	}

+ 2 - 2
common/components/sms.php

@@ -84,7 +84,6 @@ class sms
             util::fail('没有找到平台');
         }
         $name = isset($open['name']) ? $open['name'] : '花卉宝';
-        $sms = new chuanglanSMS(self::ACCOUNT, self::PASSWORD);
         $sign = isset($merchant) == true ? "【{$merchant['name']}】" : "【{$name}】";
         $msg .= $sign;
 
@@ -107,7 +106,8 @@ class sms
 
         Yii::$app->redis->executeCommand('SETEX', [$statusKey, 60, 'hasSend']);
         Yii::$app->redis->executeCommand('SETEX', [$todayKey, 86400, ++$num]);
-        $sms->send($mobile, $msg);
+        $sms = new ChuanglanSmsApi();
+        $sms->sendVariableSMS($msg, $mobile);
     }
 
 }