作者 开飞机的舒克

接口优化

... ... @@ -22,7 +22,6 @@ class Index extends Api
/**
* @ApiTitle (首页)
* @ApiMethod (POST)
* @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")
* @ApiReturn ({"code":状态码,
"msg":"提示信息"
"time": "时间戳",
... ... @@ -36,18 +35,12 @@ class Index extends Api
*/
public function index()
{
$campus = $this->request->param('campus');
if (empty($campus)) {
$this->error('参数错误', ['status' => 2]);
}
$userinfo = $this->auth->getUserinfo();
$bind = \db('user')->where('id',$userinfo['id'])->value('bind_study');
if ($bind == 0){
$this->error('空', ['status' => 2]);
}
$sid = \db('study')->where('user_id', $userinfo['id'])->find();
$count = \db('study_score_log')->where(
[
'study_id' => $sid['id'],
'campus_id' => $campus,
]
)->sum('score');
$data = \db('study_score_log')
->field('study_id, SUM(score) as sum_score')
->group('study_id')->order('sum_score', 'desc')
... ...
... ... @@ -1078,24 +1078,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</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>campus</td>
<td>string</td>
<td></td>
<td>校区id[必填]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -1117,8 +1100,7 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="POST" name="form19" id="form19">
<div class="form-group">
<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 form-group-submit">
<button type="submit" class="btn btn-success send" rel="19">提交</button>
... ... @@ -5200,7 +5182,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-17 15:59:03 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-17 16:27:22 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...