作者 开飞机的舒克

绑定学生之后更改用户昵称

... ... @@ -39,11 +39,12 @@ class Bind extends Api
if (empty($unique)) {
$this->error('参数错误', ['status' => 2]);
}
$res = \db('study')->where(['unique'=>$unique,'user_id'=>$user['id']])->find();
if (!empty($res)){
$res = \db('study')->where(['unique'=>$unique])->find();
if (!empty($res['user_id'])){
$this->error('当前学生已经被绑定了');
}
$users = db('user')->where('id', $user['id'])->find();
//halt($users);
if ($users['bind_study'] == 1) {
$this->error('您当前已经绑定过学生了,请勿重复操作');
}
... ... @@ -55,7 +56,7 @@ class Bind extends Api
'user_id' => $user['id'],
'updatetime' => time()
]);
if ($users['is_tech'] == 0){
if ($users['is_teach'] == 0){
$update['nickname'] = $res['name']."家长";
}
$update = [
... ... @@ -91,8 +92,8 @@ class Bind extends Api
if (empty($unique)) {
$this->error('参数错误', ['status' => 2]);
}
$res = \db('study')->where(['unique'=>$unique,'user_id'=>$user['id']])->find();
if (!empty($res)){
$res = \db('study')->where(['unique'=>$unique])->find();
if (!empty($res['user_id'])){
$this->error('当前学生已经被绑定了');
}
$users = db('user')->where('id', $user['id'])->find();
... ... @@ -107,7 +108,7 @@ class Bind extends Api
'user_id' => $user['id'],
'updatetime' => time()
]);
if ($users['is_tech'] == 0){
if ($users['is_teach'] == 0){
$update['nickname'] = $res['name']."家长";
}
$update = [
... ...