request->get(); $mobile = $get['mobile'] ?? ''; if (stringUtil::isMobile($mobile) == false) { util::fail('请输入正确手机号'); } $rand = rand(11111, 99999); $minute = 10; sms::send($mobile . ',' . $rand . ',' . $minute, '注册验证码:{$var},{$var}分钟内有效'); $ptStyle = Yii::$app->params['ptStyle']; $cacheKey = 'register_mobile_code_' . $ptStyle . '_' . $mobile; Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 600, $rand]); util::complete(); } //邀请花店海报 ssh 20210610 public function actionInviteHdPoster() { $merchant = WxOpenClass::getWxInfo(); $page = 'pagesClient/official/index'; $ptStyle = dict::getDict('ptStyle', 'hd'); $scene = 'ghsShopAdminId=' . $this->shopAdminId; $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle); $url = imgUtil::groupImg($imgUrl); $respond = [ 'imgUrl' => $url, ]; util::success($respond); } //邀请花店海报 ssh 20210610 public function actionInviteGhsPoster() { $merchant = WxOpenClass::getGhsWxInfo(); $page = 'pagesClient/official/index'; $ptStyle = dict::getDict('ptStyle', 'ghs'); $scene = 'ghsShopAdminId=' . $this->shopAdminId; $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle); $url = imgUtil::groupImg($imgUrl); $respond = [ 'imgUrl' => $url, ]; util::success($respond); } //邀请开店列表 ssh 2021.1.28 public function actionList() { $get = Yii::$app->request->get(); $where = []; $where['introSjId'] = $this->sjId; $status = $get['status'] ?? 0; if (!empty($status)) { $where['status'] = $status; } $data = ApplyService::getApplyList($where); $data['balance'] = $this->shop->balance ?? 0; util::success($data); } //申请试用,花店添加新客户 ssh 2021.1.8 public function actionRegister() { $post = Yii::$app->request->post(); $authCode = $post['authCode'] ?? ''; $mobile = $post['mobile'] ?? ''; if (stringUtil::isMobile($mobile) == false) { util::fail('请填写正确手机号'); } //避免重复提交 util::checkRepeatCommit($mobile, 10); $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { $shopName = $post['name'] ?? ''; if (empty($shopName)) { util::fail('名称不能为空'); } if (stringUtil::getWordNum($shopName) > 8) { util::fail('名称不能超过8个汉字'); } $has = SjClass::getByCondition(['name' => $shopName]); if (!empty($has)) { util::fail('名称已经存在'); } $has = ApplyClass::getByCondition(['mobile' => $mobile]); if (!empty($has)) { //手机号开了零售店不能再开批发店,开了批发店不能再开零售店!! util::fail('手机号已经申请过了'); } $hasShop = ShopClass::getByCondition(['mobile' => $mobile]); if (!empty($hasShop)) { //手机号开了零售店不能再开批发店,开了批发店不能再开零售店!! util::fail('手机号已经被使用'); } $ptStyle = Yii::$app->params['ptStyle']; $cacheKey = 'register_mobile_code_' . $ptStyle . '_' . $mobile; $saveAuthCode = Yii::$app->redis->executeCommand('GET', [$cacheKey]); if (empty($saveAuthCode)) { util::fail('请填写验证码哦'); } if (empty($authCode)) { util::fail('请填写验证码'); } if ($saveAuthCode != $authCode) { util::fail('验证码错误'); } $adminName = $post['adminName'] ?? ''; $miniOpenId = $post['miniOpenId'] ?? ''; $adminInfo = ['name' => $adminName, 'mobile' => $mobile, 'style' => $ptStyle, 'ghsMiniOpenId' => $miniOpenId]; $fromApp = dict::getDict('userSourceGetId', 'app', 'id'); $admin = AdminClass::replaceAdmin($adminInfo, $fromApp); $adminId = $admin['id'] ?? 0; $post['adminId'] = $adminId; $currentShopId = $admin['currentGhsShopId'] ?? 0; if (!empty($currentShopId)) { util::fail('您已提交过申请,管理员ID:' . $adminId); } if (isset($admin['openGhsShop']) && $admin['openGhsShop'] == 2) { util::fail('审核中,无需重复申请'); } $post['long'] = isset($post['longitude']) ? $post['longitude'] : ''; $post['lat'] = isset($post['latitude']) ? $post['latitude'] : ''; $post['from'] = ApplyClass::FROM_GHS; //新申请 ApplyService::replaceGhs($post); $transaction->commit(); noticeUtil::push("供货商 {$shopName} 手机号 {$mobile} 申请开店", '15280215347'); } catch (\Exception $exception) { $transaction->rollBack(); Yii::info("申请报错:" . $exception->getMessage()); util::fail('提交失败'); } util::complete(); } //申请状态 public function actionApplyStatus() { //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示 $status = -1; util::success(['status' => $status]); } //地图相关信息 ssh 2020.1.14 public function actionRegionRelate() { $regionTree = RegionService::tree(); $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH'; $out = ['region' => $regionTree, 'txMapKey' => $mapKey]; util::success($out); } //获取申请的验证码 ssh 2020.2.23 public function actionGetValidateCode() { $mobile = Yii::$app->request->get('mobile'); util::success(['code' => rand(1111, 9999)]); } }