|
|
|
@ -277,21 +277,14 @@ class PromoteController extends ThinkController
|
|
|
|
|
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', I('post.account'))==false) {
|
|
|
|
|
$this->error('账号只能是6-15位字母或数字');
|
|
|
|
|
}
|
|
|
|
|
$promote = M("promote", "tab_")->where(array("id" => $_POST['id']))->field('id, level')->find();
|
|
|
|
|
$data['account'] = I('post.account');
|
|
|
|
|
$map1['id'] = array('neq',$_POST['id']);
|
|
|
|
|
$map1['account'] = $data['account'];
|
|
|
|
|
|
|
|
|
|
if ($this->accountExist($data['account'], $_POST['id'])) {
|
|
|
|
|
$this->error('该账号已存在');
|
|
|
|
|
}
|
|
|
|
|
if (empty(I('company_id'))) {
|
|
|
|
|
if (empty(I('company_id')) && $promote['level'] ==1) {
|
|
|
|
|
$this->error('请选择推广公司');
|
|
|
|
|
}
|
|
|
|
|
$pdata = D('Promote')->where($map1)->find();
|
|
|
|
|
|
|
|
|
|
if ($pdata) {
|
|
|
|
|
$this->error('渠道账号已存在');
|
|
|
|
|
}
|
|
|
|
|
empty(I('post.id')) ? : $data['id'] =I('post.id');
|
|
|
|
|
empty(I('post.password')) ? : $data['password'] =I('post.password');
|
|
|
|
|
empty(I('post.second_pwd')) ? : $data['second_pwd'] =I('post.second_pwd');
|
|
|
|
@ -317,12 +310,16 @@ class PromoteController extends ThinkController
|
|
|
|
|
$ba = new \Admin\Model\BusinessAffairsModel();
|
|
|
|
|
$ba->update_child($ba_id['ba_id'], $_REQUEST['ba_id'], $id);
|
|
|
|
|
}
|
|
|
|
|
if (!empty(I('company_id'))) {
|
|
|
|
|
if (!empty(I('company_id')) && $promote['level'] ==1) {
|
|
|
|
|
$data['company_id'] = I('company_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$res=M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data);
|
|
|
|
|
$res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data);
|
|
|
|
|
if ($res !== false) {
|
|
|
|
|
if (!empty(I('company_id')) && $promote['level'] ==1) {//修改会长底下推广员的推广公司
|
|
|
|
|
M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save([
|
|
|
|
|
'company_id' => I('company_id')
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
$this->success("修改成功", U('lists'));
|
|
|
|
|
} else {
|
|
|
|
|
$this->error("修改失败");
|
|
|
|
|