|
|
@@ -125,25 +125,32 @@ class ApplyController extends BaseController
|
|
|
if (stringUtil::getWordNum($shopName) > 8) {
|
|
|
util::fail('名称不能超过8个汉字');
|
|
|
}
|
|
|
- $has = SjClass::getByCondition(['name' => $shopName]);
|
|
|
- if (!empty($has)) {
|
|
|
- //util::fail('名称已经存在');
|
|
|
- }
|
|
|
- $hasApply = ApplyClass::getByCondition(['mobile' => $mobile], true);
|
|
|
- if (!empty($hasApply)) {
|
|
|
- //手机号开了零售店不能再开批发店,开了批发店不能再开零售店!!
|
|
|
- if ($hasApply->status == 1) {
|
|
|
- util::fail('此手机号已提交过申请,审核中');
|
|
|
- }
|
|
|
- if ($hasApply->status == 3) {
|
|
|
- util::fail('此手机号已提交申请,审核没有通过');
|
|
|
+
|
|
|
+ $hasShopList = ShopClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
|
|
|
+ if (!empty($hasShopList)) {
|
|
|
+ foreach ($hasShopList as $hasShop) {
|
|
|
+ if ($hasShop->ptStyle == 2) {
|
|
|
+ util::fail('这个手机号已经开了批发店');
|
|
|
+ }
|
|
|
}
|
|
|
- util::fail('手机号已经申请过了');
|
|
|
}
|
|
|
- $hasShop = ShopClass::getByCondition(['mobile' => $mobile]);
|
|
|
- if (!empty($hasShop)) {
|
|
|
- //手机号开了零售店不能再开批发店,开了批发店不能再开零售店!!
|
|
|
- util::fail('手机号已经被使用');
|
|
|
+
|
|
|
+ $apply = ApplyClass::getByCondition(['mobile' => $mobile], true);
|
|
|
+ if (!empty($apply)) {
|
|
|
+ $shop = ShopClass::getByCondition(['mobile' => $mobile], true);
|
|
|
+ if (!empty($shop)) {
|
|
|
+ $apply->introSjId = 1;
|
|
|
+ $apply->introStyle = 0;
|
|
|
+ $apply->introSjName = 0;
|
|
|
+ $apply->introShopId = 0;
|
|
|
+ $apply->name = $shopName;
|
|
|
+ $apply->style = 2;
|
|
|
+ $apply->status = 1;
|
|
|
+ $apply->save();
|
|
|
+ $transaction->commit();
|
|
|
+ noticeUtil::push("{$shopName} 手机号 {$mobile} 申请开通批发店", '15280215347');
|
|
|
+ util::complete('已提交申请');
|
|
|
+ }
|
|
|
}
|
|
|
$ptStyle = Yii::$app->params['ptStyle'];
|
|
|
$cacheKey = 'register_mobile_code_' . $ptStyle . '_' . $mobile;
|
|
|
@@ -178,9 +185,7 @@ class ApplyController extends BaseController
|
|
|
ApplyService::replaceGhs($post);
|
|
|
$transaction->commit();
|
|
|
|
|
|
- $noticeMobile = '15280215347';
|
|
|
- //sms::freeSend($noticeMobile . ',' . $mobile, '有新的批发店申请开店,手机号:{$var}');
|
|
|
- noticeUtil::push("供货商 {$shopName} 手机号 {$mobile} 申请开店", '15280215347');
|
|
|
+ noticeUtil::push("{$shopName} 手机号 {$mobile} 申请开通批发店", '15280215347');
|
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
$transaction->rollBack();
|