更新手机号绑定 新增农科绑定
This commit is contained in:
parent
441b56c6a4
commit
ee464cf5f5
@ -30,6 +30,7 @@ use think\App;
|
|||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
class User extends BaseController
|
class User extends BaseController
|
||||||
{
|
{
|
||||||
@ -201,6 +202,29 @@ class User extends BaseController
|
|||||||
$data = ['account' => $data['phone'], 'phone' => $data['phone']];
|
$data = ['account' => $data['phone'], 'phone' => $data['phone']];
|
||||||
}
|
}
|
||||||
$this->repository->update($this->request->uid(), $data);
|
$this->repository->update($this->request->uid(), $data);
|
||||||
|
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('phone',$data['phone'])->find();
|
||||||
|
//绑定农科用户
|
||||||
|
if ($msg){
|
||||||
|
$find=Db::name('nk_user')->where('n_user_id',$msg['user_id'])->find();
|
||||||
|
$users=Db::connect('nongke')->name('user')->where('id',$msg['user_id'])->find();
|
||||||
|
if ($find && $find['user_id']==0){
|
||||||
|
Db::name('nk_user')->where('id',$find['id'])->update(['user_id'=>$this->request->uid(),'group_id'=>$users['group_id']]);
|
||||||
|
}else{
|
||||||
|
$datas=[
|
||||||
|
'user_id'=>$this->request->uid(),
|
||||||
|
'n_user_id'=>$users['id'],
|
||||||
|
'group_id'=>$users['group_id']
|
||||||
|
];
|
||||||
|
Db::name('nk_user')->insert($datas);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$datas=[
|
||||||
|
'user_id'=>$this->request->uid(),
|
||||||
|
'n_user_id'=>0,
|
||||||
|
'group_id'=>1
|
||||||
|
];
|
||||||
|
Db::name('nk_user')->insert($datas);
|
||||||
|
}
|
||||||
return app('json')->success('绑定成功');
|
return app('json')->success('绑定成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user