diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 2e9ea118f..58900f04d 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -7,6 +7,7 @@ use User\Api\UserApi; use Org\XiguSDK\Xigu; use Base\Service\PromoteService; use Base\Service\ApplyService; +use Base\Service\PromoteCompanyService; /** * 后台首页控制器 @@ -276,6 +277,13 @@ class PromoteController extends ThinkController if ($this->accountExist($account)) { $this->error('该账号已存在'); } + + $promoteCompanyService = new PromoteCompanyService(); + $verifyingPromotes = $promoteCompanyService->getVerifyingPromotes(); + if ($promoteCompanyService->isExistVerifyingPromoteAccount([$account], $verifyingPromotes)) { + $this->error('该账号已存在'); + } + if(!empty($mobile_phone)){ //判断手机格式 if (!preg_match("/^1[3456789]{1}\d{9}$/", $mobile_phone)) { @@ -407,6 +415,13 @@ class PromoteController extends ThinkController if ($this->accountExist($data['account'], $_POST['id'])) { $this->error('该账号已存在'); } + + $promoteCompanyService = new PromoteCompanyService(); + $verifyingPromotes = $promoteCompanyService->getVerifyingPromotes(); + if ($promoteCompanyService->isExistVerifyingPromoteAccount([$data['account']], $verifyingPromotes)) { + $this->error('该账号已存在'); + } + $company_id = I('company_id'); if ($company_id <0 && $promote['level'] ==1) { $this->error('请选择推广公司'); diff --git a/Application/Base/Service/PromoteCompanyService.class.php b/Application/Base/Service/PromoteCompanyService.class.php index 04ee39297..6ab981e6d 100644 --- a/Application/Base/Service/PromoteCompanyService.class.php +++ b/Application/Base/Service/PromoteCompanyService.class.php @@ -258,8 +258,8 @@ class PromoteCompanyService if($isChangeBelong || $isChangeRelation ) { $data = array( - 'company_belong' => $save['company_belong'], - 'company_relation' => $save['develop_type'] + 'company_belong' => $companyInfo['company_belong'], + 'company_relation' => $companyInfo['develop_type'] ); M('promote', 'tab_')->where(['company_id' => $companyId])->save($data); @@ -268,7 +268,7 @@ class PromoteCompanyService $authGroup = M('auth_group', 'sys_')->where(['title'=>'市场总监'])->find(); $subPromoteIds = M('promote', 'tab_')->where(['level' => 1, 'company_id' => $companyId])->getField('id', true); $dataPresident = explode(',', $authGroup['data_president']); - if ($save['company_belong'] == 1 || $save['company_belong'] == 2) { + if ($companyInfo['company_belong'] == 1 || $companyInfo['company_belong'] == 2) { $dataPresident = array_unique(array_merge($dataPresident, $subPromoteIds)); } else { $dataPresident = array_diff($dataPresident, $subPromoteIds); diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 542212cd5..39236b921 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -973,6 +973,16 @@ class PromoteService { 'message' => '渠道账号已存在', ]; } + + $promoteCompanyService = new PromoteCompanyService(); + $verifyingPromotes = $promoteCompanyService->getVerifyingPromotes(); + if ($promoteCompanyService->isExistVerifyingPromoteAccount([$account], $verifyingPromotes)) { + return [ + 'status' => false, + 'message' => '渠道账号已存在', + ]; + } + return [ 'status' => true, 'message' => '验证成功',