作者 景琛

扫码问题解决

... ... @@ -243,19 +243,17 @@ class Bind extends Api
$this->error('参数错误', ['status' => 2]);
}
$model = new StudyScoreLog();
$find = $model->addScore($id,$unique);
if (empty($find)){
$this->error('扫码无效');
}else{
$data = db('study')->where('unique', $unique)->field('name,gender')->find();
if ($data['gender'] == 1){
$data['gender'] = '男';
}else{
$data['gender'] = '女';
}
$this->success('扫码成功', $data);
$find = $model->addScore($id, $unique);
if ($find != 11){
$this->error('扫码无效');
}
$data = db('study')->where('unique', $unique)->field('name,gender')->find();
if ($data['gender'] == 1) {
$data['gender'] = '男';
} else {
$data['gender'] = '女';
}
$this->success('扫码成功', $data);
}
/**
... ...
... ... @@ -40,11 +40,11 @@ class StudyScoreLog extends Model
$sum_score = 0;
$list = [];
//判断当前项目是否在学生所属场次内
$find = \db('ronda')->whereIn('item_ids',$id)->find();
//halt($find);
if (empty($find)){
return $find;
}
$item_ids = explode(',',$ronda['item_ids']);
$info = "扫码无效";
if (!in_array($id,$item_ids)){
return null;
}
foreach ($score as $k) {
$sum_score += $k;
}
... ... @@ -151,6 +151,7 @@ class StudyScoreLog extends Model
}
}
Db::commit();
return 11;
} catch (Exception $e) {
Db::rollback();
$e->getMessage();
... ...