作者 景琛

扫码处理

... ... @@ -240,14 +240,19 @@ class Bind extends Api
$this->error('参数错误', ['status' => 2]);
}
$model = new StudyScoreLog();
$model->addScore($id,$unique);
$data = db('study')->where('unique', $unique)->field('name,gender')->find();
if ($data['gender'] == 1){
$data['gender'] = '男';
$find = $model->addScore($id,$unique);
if (empty($find)){
$this->error('扫码无效');
}else{
$data['gender'] = '女';
$data = db('study')->where('unique', $unique)->field('name,gender')->find();
if ($data['gender'] == 1){
$data['gender'] = '男';
}else{
$data['gender'] = '女';
}
$this->success('扫码成功', $data);
}
$this->success('扫码成功', $data);
}
/**
... ...
... ... @@ -40,9 +40,10 @@ class StudyScoreLog extends Model
$sum_score = 0;
$list = [];
//判断当前项目是否在学生所属场次内
$find = \db('ronda')->where('item_ids',['in',$id])->find();
$find = \db('ronda')->whereIn('item_ids',$id)->find();
//halt($find);
if (empty($find)){
return '扫码错误';
return $find;
}
foreach ($score as $k) {
$sum_score += $k;
... ...