作者 景琛

扫码处理

@@ -240,7 +240,10 @@ class Bind extends Api @@ -240,7 +240,10 @@ class Bind extends Api
240 $this->error('参数错误', ['status' => 2]); 240 $this->error('参数错误', ['status' => 2]);
241 } 241 }
242 $model = new StudyScoreLog(); 242 $model = new StudyScoreLog();
243 - $model->addScore($id,$unique); 243 + $find = $model->addScore($id,$unique);
  244 + if (empty($find)){
  245 + $this->error('扫码无效');
  246 + }else{
244 $data = db('study')->where('unique', $unique)->field('name,gender')->find(); 247 $data = db('study')->where('unique', $unique)->field('name,gender')->find();
245 if ($data['gender'] == 1){ 248 if ($data['gender'] == 1){
246 $data['gender'] = '男'; 249 $data['gender'] = '男';
@@ -250,6 +253,8 @@ class Bind extends Api @@ -250,6 +253,8 @@ class Bind extends Api
250 $this->success('扫码成功', $data); 253 $this->success('扫码成功', $data);
251 } 254 }
252 255
  256 + }
  257 +
253 /** 258 /**
254 * @ApiTitle (绑定后获取头像昵称) 259 * @ApiTitle (绑定后获取头像昵称)
255 */ 260 */
@@ -40,9 +40,10 @@ class StudyScoreLog extends Model @@ -40,9 +40,10 @@ class StudyScoreLog extends Model
40 $sum_score = 0; 40 $sum_score = 0;
41 $list = []; 41 $list = [];
42 //判断当前项目是否在学生所属场次内 42 //判断当前项目是否在学生所属场次内
43 - $find = \db('ronda')->where('item_ids',['in',$id])->find(); 43 + $find = \db('ronda')->whereIn('item_ids',$id)->find();
  44 + //halt($find);
44 if (empty($find)){ 45 if (empty($find)){
45 - return '扫码错误'; 46 + return $find;
46 } 47 }
47 foreach ($score as $k) { 48 foreach ($score as $k) {
48 $sum_score += $k; 49 $sum_score += $k;