作者 开飞机的舒克

修改接口

... ... @@ -64,7 +64,6 @@ class Activity extends Api
/**
* @ApiTitle (项目日期场次)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="id", type="string", required=false, description="校区id")
* @ApiReturnParams (name="code", type="integer", required=true, description="状态码")
* @ApiReturnParams (name="msg", type="string", required=true, description="提示语")
... ... @@ -83,14 +82,23 @@ class Activity extends Api
*/
public function getItemRonda()
{
$row = $this->request->param('row');
$page = $this->request->param('page');
$row = $row ? $row : 10;
$page = $page ? $page : 1;
$id = $this->request->param('id');
$data['ronda'] = db('ronda')
->where('campus_id', $id)
->paginate(10)
->each(function ($item, $k) {
$data['item'] = db('item')->where('ronda_id', $item['id'])->find();
$data['item_details'] = db('item_details')->where('item_id', $data['item']['id'])->find();
return $data;
if (empty($id)) {
$this->error('参数错误', ['status' => 2]);
}
$data = db('item_ronda_rel')
->field('campus_id,ronda_id,item_id')
->where('campus_id',$id)
->paginate($row,false,['page'=>$page])
->each(function ($item,$key){
$item['ronda'] = db('ronda')->where('id',$item['ronda_id'])->field('title,holdtime')->find();
$item['item'] = db('item')->where('id',$item['item_id'])->value('title');
$item['item_details'] = db('item_details')->where('item_id',$item['item_id'])->field('images,details')->find();
return $item;
});
$this->success('项目场次日期', $data);
}
... ...
... ... @@ -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')
... ...
... ... @@ -1097,7 +1097,7 @@
</thead>
<tbody>
<tr>
<td>xq</td>
<td>campus</td>
<td>string</td>
<td></td>
<td>校区id[必填]</td>
... ... @@ -1148,8 +1148,8 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="POST" name="form13" id="form13">
<div class="form-group">
<label class="control-label" for="xq">xq</label>
<input type="string" class="form-control input-sm" id="xq" required placeholder="校区id[必填]" name="xq">
<label class="control-label" for="campus">campus</label>
<input type="string" class="form-control input-sm" id="campus" required placeholder="校区id[必填]" name="campus">
</div>
<div class="form-group">
<label class="control-label" for="row">row</label>
... ... @@ -1465,7 +1465,7 @@
</thead>
<tbody>
<tr>
<td>xq</td>
<td>campus</td>
<td>string</td>
<td></td>
<td>校区id[必填]</td>
... ... @@ -1516,8 +1516,8 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/teamRank" method="POST" name="form15" id="form15">
<div class="form-group">
<label class="control-label" for="xq">xq</label>
<input type="string" class="form-control input-sm" id="xq" required placeholder="校区id[必填]" name="xq">
<label class="control-label" for="campus">campus</label>
<input type="string" class="form-control input-sm" id="campus" required placeholder="校区id[必填]" name="campus">
</div>
<div class="form-group">
<label class="control-label" for="row">row</label>
... ... @@ -1661,7 +1661,7 @@
</thead>
<tbody>
<tr>
<td>xq</td>
<td>campus</td>
<td>string</td>
<td></td>
<td>校区id[必填]</td>
... ... @@ -1712,8 +1712,8 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/personRank" method="POST" name="form16" id="form16">
<div class="form-group">
<label class="control-label" for="xq">xq</label>
<input type="string" class="form-control input-sm" id="xq" required placeholder="校区id[必填]" name="xq">
<label class="control-label" for="campus">campus</label>
<input type="string" class="form-control input-sm" id="campus" required placeholder="校区id[必填]" name="campus">
</div>
<div class="form-group">
<label class="control-label" for="row">row</label>
... ... @@ -1936,24 +1936,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>token</td>
<td>string</td>
<td></td>
<td>请求的Token</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -1990,17 +1973,6 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<div class="headers">
<div class="form-group">
<label class="control-label" for="token">token</label>
<input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong>
<div class="pull-right">
<a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
... ... @@ -2124,24 +2096,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>token</td>
<td>string</td>
<td></td>
<td>请求的Token</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -2178,17 +2133,6 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<div class="headers">
<div class="form-group">
<label class="control-label" for="token">token</label>
<input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong>
<div class="pull-right">
<a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
... ... @@ -3027,7 +2971,7 @@
</thead>
<tbody>
<tr>
<td>xm</td>
<td>items_id</td>
<td>string</td>
<td></td>
<td>项目id</td>
... ... @@ -3072,8 +3016,8 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/bind/Ewm" method="POST" name="form7" id="form7">
<div class="form-group">
<label class="control-label" for="xm">xm</label>
<input type="string" class="form-control input-sm" id="xm" required placeholder="项目id" name="xm">
<label class="control-label" for="items_id">items_id</label>
<input type="string" class="form-control input-sm" id="items_id" required placeholder="项目id" name="items_id">
</div>
<div class="form-group">
<label class="control-label" for="unique">unique</label>
... ... @@ -3204,7 +3148,7 @@
</thead>
<tbody>
<tr>
<td>xq</td>
<td>campus_id</td>
<td>string</td>
<td></td>
<td>校区id</td>
... ... @@ -3243,8 +3187,8 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/bind/getScore" method="POST" name="form8" id="form8">
<div class="form-group">
<label class="control-label" for="xq">xq</label>
<input type="string" class="form-control input-sm" id="xq" required placeholder="校区id" name="xq">
<label class="control-label" for="campus_id">campus_id</label>
<input type="string" class="form-control input-sm" id="campus_id" required placeholder="校区id" name="campus_id">
</div>
<div class="form-group form-group-submit">
<button type="submit" class="btn btn-success send" rel="8">提交</button>
... ... @@ -4563,7 +4507,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-09 15:44:57 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-09 16:50:56 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...