作者 开飞机的舒克

接口优化

@@ -22,7 +22,6 @@ class Index extends Api @@ -22,7 +22,6 @@ class Index extends Api
22 /** 22 /**
23 * @ApiTitle (首页) 23 * @ApiTitle (首页)
24 * @ApiMethod (POST) 24 * @ApiMethod (POST)
25 - * @ApiParams (name="campus", type="string", required=true, description="校区id[必填]")  
26 * @ApiReturn ({"code":状态码, 25 * @ApiReturn ({"code":状态码,
27 "msg":"提示信息" 26 "msg":"提示信息"
28 "time": "时间戳", 27 "time": "时间戳",
@@ -36,18 +35,12 @@ class Index extends Api @@ -36,18 +35,12 @@ class Index extends Api
36 */ 35 */
37 public function index() 36 public function index()
38 { 37 {
39 - $campus = $this->request->param('campus');  
40 - if (empty($campus)) {  
41 - $this->error('参数错误', ['status' => 2]);  
42 - }  
43 $userinfo = $this->auth->getUserinfo(); 38 $userinfo = $this->auth->getUserinfo();
  39 + $bind = \db('user')->where('id',$userinfo['id'])->value('bind_study');
  40 + if ($bind == 0){
  41 + $this->error('空', ['status' => 2]);
  42 + }
44 $sid = \db('study')->where('user_id', $userinfo['id'])->find(); 43 $sid = \db('study')->where('user_id', $userinfo['id'])->find();
45 - $count = \db('study_score_log')->where(  
46 - [  
47 - 'study_id' => $sid['id'],  
48 - 'campus_id' => $campus,  
49 - ]  
50 - )->sum('score');  
51 $data = \db('study_score_log') 44 $data = \db('study_score_log')
52 ->field('study_id, SUM(score) as sum_score') 45 ->field('study_id, SUM(score) as sum_score')
53 ->group('study_id')->order('sum_score', 'desc') 46 ->group('study_id')->order('sum_score', 'desc')
@@ -1078,24 +1078,7 @@ @@ -1078,24 +1078,7 @@
1078 <div class="panel panel-default"> 1078 <div class="panel panel-default">
1079 <div class="panel-heading"><strong>参数</strong></div> 1079 <div class="panel-heading"><strong>参数</strong></div>
1080 <div class="panel-body"> 1080 <div class="panel-body">
1081 - <table class="table table-hover">  
1082 - <thead>  
1083 - <tr>  
1084 - <th>名称</th>  
1085 - <th>类型</th>  
1086 - <th>必选</th>  
1087 - <th>描述</th>  
1088 - </tr>  
1089 - </thead>  
1090 - <tbody>  
1091 - <tr>  
1092 - <td>campus</td>  
1093 - <td>string</td>  
1094 - <td></td>  
1095 - <td>校区id[必填]</td>  
1096 - </tr>  
1097 - </tbody>  
1098 - </table> 1081 +
1099 </div> 1082 </div>
1100 </div> 1083 </div>
1101 <div class="panel panel-default"> 1084 <div class="panel panel-default">
@@ -1117,8 +1100,7 @@ @@ -1117,8 +1100,7 @@
1117 <div class="panel-body"> 1100 <div class="panel-body">
1118 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="POST" name="form19" id="form19"> 1101 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="POST" name="form19" id="form19">
1119 <div class="form-group"> 1102 <div class="form-group">
1120 - <label class="control-label" for="campus">campus</label>  
1121 - <input type="string" class="form-control input-sm" id="campus" required placeholder="校区id[必填]" name="campus"> 1103 +
1122 </div> 1104 </div>
1123 <div class="form-group form-group-submit"> 1105 <div class="form-group form-group-submit">
1124 <button type="submit" class="btn btn-success send" rel="19">提交</button> 1106 <button type="submit" class="btn btn-success send" rel="19">提交</button>
@@ -5200,7 +5182,7 @@ @@ -5200,7 +5182,7 @@
5200 5182
5201 </div> 5183 </div>
5202 <div class="col-md-6" align="right"> 5184 <div class="col-md-6" align="right">
5203 - Generated on 2023-03-17 15:59:03 <a href="./" target="_blank">校园活动</a> 5185 + Generated on 2023-03-17 16:27:22 <a href="./" target="_blank">校园活动</a>
5204 </div> 5186 </div>
5205 </div> 5187 </div>
5206 5188