作者 景琛

没有unique还可绑定问题

@@ -48,6 +48,9 @@ class Bind extends Api @@ -48,6 +48,9 @@ class Bind extends Api
48 // if ($users['bind_study'] == 1) { 48 // if ($users['bind_study'] == 1) {
49 // $this->error('您当前已经绑定过学生了,请勿重复操作'); 49 // $this->error('您当前已经绑定过学生了,请勿重复操作');
50 // } 50 // }
  51 + if (empty($res)){
  52 + $this->error('当前学生不存在');
  53 + }
51 Db::startTrans(); 54 Db::startTrans();
52 try { 55 try {
53 db('study') 56 db('study')
@@ -96,10 +99,10 @@ class Bind extends Api @@ -96,10 +99,10 @@ class Bind extends Api
96 if (!empty($res['user_id'])){ 99 if (!empty($res['user_id'])){
97 $this->error('当前学生已经被绑定了'); 100 $this->error('当前学生已经被绑定了');
98 } 101 }
  102 + if (empty($res)){
  103 + $this->error('当前学生不存在');
  104 + }
99 $users = db('user')->where('id', $user['id'])->find(); 105 $users = db('user')->where('id', $user['id'])->find();
100 -// if ($users['bind_study'] == 1) {  
101 -// $this->error('您当前已经绑定过学生了,请勿重复操作');  
102 -// }  
103 Db::startTrans(); 106 Db::startTrans();
104 try { 107 try {
105 db('study') 108 db('study')