推广员账号已存在判断

master
liuweiwen 5 years ago
parent 2b4c9b6f44
commit cc1e3ccbb3

@ -199,6 +199,16 @@ class PromoteController extends ThinkController
parent::lists('SiteApply', $p, $map); parent::lists('SiteApply', $p, $map);
} }
private function accountExist($account, $id = null)
{
$res = M('promote', 'tab_')->where(['account' => $account])->field('id')->find();
if ($res) {
return $id != $res['id'];
} else {
return false;
}
}
public function add($account=null, $password=null, $second_pwd=null, $real_name=null, $email=null, public function add($account=null, $password=null, $second_pwd=null, $real_name=null, $email=null,
$mobile_phone=null, $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null, $company_id = null) $mobile_phone=null, $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null, $company_id = null)
{ {
@ -206,6 +216,9 @@ class PromoteController extends ThinkController
if (C('PROMOTE_AUTO_AUDIT') == 1) { if (C('PROMOTE_AUTO_AUDIT') == 1) {
$status = 1; $status = 1;
} }
if ($this->accountExist($account)) {
$this->error('该账号已存在');
}
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name, $data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,
'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card, 'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,
'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id); 'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id);
@ -264,7 +277,9 @@ class PromoteController extends ThinkController
$data['account'] = I('post.account'); $data['account'] = I('post.account');
$map1['id'] = array('neq',$_POST['id']); $map1['id'] = array('neq',$_POST['id']);
$map1['account'] = $data['account']; $map1['account'] = $data['account'];
if ($this->accountExist($data['account'])) {
$this->error('该账号已存在');
}
$pdata = D('Promote')->where($map1)->find(); $pdata = D('Promote')->where($map1)->find();
if ($pdata) { if ($pdata) {

Loading…
Cancel
Save