...
|
...
|
@@ -110,7 +110,7 @@ class Bind extends Api |
|
|
* @ApiTitle (活动现场[扫码])
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="xm", type="string", required=true, description="项目id")
|
|
|
* @ApiParams (name="items_id", type="string", required=true, description="项目id")
|
|
|
* @ApiParams (name="unique", type="string", required=true, description="条形码唯一标识")
|
|
|
* @ApiReturn ({
|
|
|
"code":"状态码",
|
...
|
...
|
@@ -123,22 +123,22 @@ class Bind extends Api |
|
|
})
|
|
|
*/
|
|
|
public function Ewm(){
|
|
|
$xm = $this->request->param('xm');
|
|
|
$items_id = $this->request->param('items_id');
|
|
|
$unique = $this->request->param('unique');
|
|
|
if (empty($unique) && empty($xm)){
|
|
|
if (empty($unique) && empty($items_id)){
|
|
|
$this->error('参数错误',['status'=>2]);
|
|
|
}
|
|
|
$study = db('study')->where('unique',$unique)->field('id,grade,name,sno,team_id,earn_score')->find();
|
|
|
$item = db('item')->where('id',$xm)->field('score,title,ronda_id')->find();
|
|
|
$xq_id = \db('ronda')->where('id',$item['ronda_id'])->value('xq_id');
|
|
|
$rel = \db('item_ronda_rel')->where('item_id',$items_id)->find();
|
|
|
$item = db('item')->where('id',$rel['item_id'])->field('score,title')->find();
|
|
|
$team = \db('team')->where('id',$study['team_id'])->field('title,score')->find();
|
|
|
$sum1 = $team['score'] + $item['score']; //合计战队总分
|
|
|
$sum2 = $study['earn_score'] + $item['score']; //合计个人总分
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
db('study_score_log')->insert([
|
|
|
'item_id'=>$xm,
|
|
|
'school_id'=>$xq_id,
|
|
|
'item_id'=>$items_id,
|
|
|
'campus_id'=>$rel['campus_id'],
|
|
|
'study_id'=>$study['id'],
|
|
|
'team_id'=>$study['team_id'],
|
|
|
'score'=>$item['score'],
|
...
|
...
|
@@ -169,7 +169,7 @@ class Bind extends Api |
|
|
* @ApiTitle (获取学生信息)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="xq", type="string", required=true, description="校区id")
|
|
|
* @ApiParams (name="campus_id", type="string", required=true, description="校区id")
|
|
|
* @ApiReturn ({
|
|
|
"code":"状态码",
|
|
|
"msg": "提示消息",
|
...
|
...
|
@@ -199,7 +199,7 @@ class Bind extends Api |
|
|
*/
|
|
|
public function getScore(){
|
|
|
$user = $this->auth->getUserinfo();
|
|
|
$xq = $this->request->param('xq');
|
|
|
$campus_id = $this->request->param('campus_id');
|
|
|
$sid = \db('study')->where('user_id',$user['id'])->value('id');
|
|
|
//获取学生的信息
|
|
|
$data['study_info'] = \db('study')->where('id',$sid)->field('avatar,name,earn_score')->find();
|
...
|
...
|
@@ -208,7 +208,7 @@ class Bind extends Api |
|
|
->distinct('item_id')
|
|
|
->field('item_id,SUM(score) as sum_score')
|
|
|
->group('item_id')
|
|
|
->where(['school_id'=>$xq,'study_id'=>$sid])
|
|
|
->where(['campus_id'=>$campus_id,'study_id'=>$sid])
|
|
|
->paginate(3,false)
|
|
|
->each(function ($item,$key){
|
|
|
$item['item_ronda'] = \db('item i')
|
...
|
...
|
|