更新手机号绑定 新增农科绑定
This commit is contained in:
parent
86d60887ef
commit
86acbb8b15
@ -342,7 +342,17 @@ class Auth extends BaseController
|
||||
|
||||
$tokenInfo = $repository->createToken($user);
|
||||
$repository->loginAfter($user);
|
||||
|
||||
$find=Db::name('nk_user')->where('user_id',$user['uid'])->find();
|
||||
if ($find && $find['n_user_id']!=0){
|
||||
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('user_id',$find['n_user_id'])->cache(true)->find();
|
||||
if ($msg){
|
||||
$user['no_update']=0;
|
||||
}else{
|
||||
$user['no_update']=1;
|
||||
}
|
||||
}else{
|
||||
$user['no_update']=1;
|
||||
}
|
||||
return app('json')->success($repository->returnToken($user, $tokenInfo));
|
||||
}
|
||||
|
||||
|
@ -191,23 +191,23 @@ class User extends BaseController
|
||||
*/
|
||||
public function binding()
|
||||
{
|
||||
$data = $this->request->params(['phone', 'sms_code','idcard','area_id','street_id','village_id','name']);
|
||||
if(!$data['idcard'] || !$data['area_id'] || !$data['street_id'] || !$data['village_id'] || !$data['name']){
|
||||
return app('json')->fail('缺少参数');
|
||||
}
|
||||
// $sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'binding');
|
||||
// if (!$data['sms_code'] || !$sms_code)
|
||||
// return app('json')->fail('验证码不正确');
|
||||
// $user = $this->repository->accountByUser($data['phone']);
|
||||
// if ($user) {
|
||||
// if (systemConfig('is_phone_login') === '1') {
|
||||
// return app('json')->fail('手机号已被绑定');
|
||||
// }
|
||||
// $dataa = ['phone' => $data['phone']];
|
||||
// } else {
|
||||
// $dataa = ['account' => $data['phone'], 'phone' => $data['phone']];
|
||||
$data = $this->request->params(['phone', 'sms_code']);
|
||||
// if(!$data['idcard'] || !$data['area_id'] || !$data['street_id'] || !$data['village_id'] || !$data['name']){
|
||||
// return app('json')->fail('缺少参数');
|
||||
// }
|
||||
// $this->repository->update($this->request->uid(), $dataa);
|
||||
$sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'binding');
|
||||
if (!$data['sms_code'] || !$sms_code)
|
||||
return app('json')->fail('验证码不正确');
|
||||
$user = $this->repository->accountByUser($data['phone']);
|
||||
if ($user) {
|
||||
if (systemConfig('is_phone_login') === '1') {
|
||||
return app('json')->fail('手机号已被绑定');
|
||||
}
|
||||
$dataa = ['phone' => $data['phone']];
|
||||
} else {
|
||||
$dataa = ['account' => $data['phone'], 'phone' => $data['phone']];
|
||||
}
|
||||
$this->repository->update($this->request->uid(), $dataa);
|
||||
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('phone',$data['phone'])->find();
|
||||
//绑定农科用户
|
||||
if ($msg){
|
||||
@ -224,7 +224,29 @@ class User extends BaseController
|
||||
Db::name('nk_user')->insert($datas);
|
||||
}
|
||||
}else{
|
||||
$this->NongKeBinding($data);
|
||||
$nk_user=Db::name('nk_user')->where('user_id',$this->request->uid())->find();
|
||||
if (!$nk_user || $nk_user['n_user_id']==0){
|
||||
$time=time();
|
||||
$data=[
|
||||
'openid'=>'wx'.$time,
|
||||
'group_id'=>1,
|
||||
'username'=>'wx'.$time,
|
||||
'nickname'=>'微信用户'.$time,
|
||||
'avatar'=>'https://t7.baidu.com/it/u=2531125946,3055766435&fm=193&f=GIF',
|
||||
'level'=>1,
|
||||
'createtime'=>$time,
|
||||
'updatetime'=>$time,
|
||||
'status'=>'normal'
|
||||
];
|
||||
$n_user_id= Db::connect('nongke')->name('user')->insertGetId($data);
|
||||
$datas=[
|
||||
'user_id'=>$this->request->uid(),
|
||||
'n_user_id'=>$n_user_id,
|
||||
'group_id'=>1
|
||||
];
|
||||
Db::name('nk_user')->insert($datas);
|
||||
}
|
||||
// $this->NongKeBinding($data);
|
||||
}
|
||||
return app('json')->success('绑定成功');
|
||||
}
|
||||
@ -252,7 +274,7 @@ class User extends BaseController
|
||||
'updatetime'=>$time,
|
||||
'status'=>'normal'
|
||||
];
|
||||
$post['user_id']= Db::name('user')->insertGetId($data);
|
||||
$post['user_id']= Db::connect('nongke')->name('user')->insertGetId($data);
|
||||
}
|
||||
//判断身份证号是否已被使用
|
||||
$InformationUsermsg = Db::connect('nongke')->name('szxc_information_usermsg')->where('idcard',$post['idcard'])->field('idcard')->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user