作者 开飞机的舒克

接口优化

... ... @@ -5,19 +5,26 @@ namespace app\api\controller;
use app\common\controller\Api;
/**
* 定时任务
* @ApiWeigh (94)
*/
class Crontab extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @ApiTitle (首页)
*/
public function index(){
$res = db('study')->field('earn_score')->select();
function sort($res){
$len = count($res);
for ($i = 0; $i < $len - 1; $i++) {//循环比对的轮数
for ($j = 0; $j < $len - $i - 1; $j++) {//当前轮相邻元素循环对比
if ($res[$j] < $res[$j + 1]) {//如果前边的于后边的
if ($res[$j] < $res[$j + 1]) {//如果前边的于后边的
$tmp = $res[$j];//交换数据
$res[$j] = $res[$j + 1];
$res[$j + 1] = $tmp;
... ...
... ... @@ -244,6 +244,12 @@
</span>
</a>
</div>
<a href="#定时任务" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">定时任务 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="定时任务">
<a href="javascript:;" data-id="11" class="list-group-item">首页 <span class="tag">
</span>
</a>
</div>
<a href="#公共接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">公共接口 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="公共接口">
<a href="javascript:;" data-id="9" class="list-group-item">加载初始化 <span class="tag">
... ... @@ -254,12 +260,6 @@
</span>
</a>
</div>
<a href="#Crontab" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">Crontab <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="Crontab">
<a href="javascript:;" data-id="11" class="list-group-item">index <span class="tag">
</span>
</a>
</div>
<a href="#示例接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">示例接口 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="示例接口">
<a href="javascript:;" data-id="12" class="list-group-item">测试名称 <span class="tag">
... ... @@ -3163,31 +3163,31 @@
</div>
</div>
</div>
<h2>公共接口</h2>
<h2>定时任务</h2>
<hr>
<div class="panel panel-default">
<div class="panel-heading" id="heading-9">
<div class="panel-heading" id="heading-11">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion9" href="#collapseOne9"> 加载初始化 <span class="text-muted">/api/common/init</span></a>
<a data-toggle="collapse" data-parent="#accordion11" href="#collapseOne11"> 首页 <span class="text-muted">/api/crontab/index</span></a>
</h4>
</div>
<div id="collapseOne9" class="panel-collapse collapse">
<div id="collapseOne11" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab9">
<li class="active"><a href="#info9" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox9" data-toggle="tab">在线测试</a></li>
<li><a href="#sample9" data-toggle="tab">返回示例</a></li>
<ul class="nav nav-tabs" id="doctab11">
<li class="active"><a href="#info11" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox11" data-toggle="tab">在线测试</a></li>
<li><a href="#sample11" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info9">
<div class="tab-pane active" id="info11">
<div class="well">
加载初始化 </div>
首页 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>权限</strong></div>
<div class="panel-body">
... ... @@ -3214,36 +3214,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>version</td>
<td>string</td>
<td></td>
<td>版本号</td>
</tr>
<tr>
<td>lng</td>
<td>string</td>
<td></td>
<td>经度</td>
</tr>
<tr>
<td>lat</td>
<td>string</td>
<td></td>
<td>纬度</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -3253,7 +3224,7 @@
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox9">
<div class="tab-pane" id="sandbox11">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
... ... @@ -3263,22 +3234,13 @@
</div>
</div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/init" method="get" name="form9" id="form9">
<div class="form-group">
<label class="control-label" for="version">version</label>
<input type="string" class="form-control input-sm" id="version" required placeholder="版本号" name="version">
</div>
<div class="form-group">
<label class="control-label" for="lng">lng</label>
<input type="string" class="form-control input-sm" id="lng" required placeholder="经度" name="lng">
</div>
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/crontab/index" method="get" name="form11" id="form11">
<div class="form-group">
<label class="control-label" for="lat">lat</label>
<input type="string" class="form-control input-sm" id="lat" required placeholder="纬度" name="lat">
</div>
<div class="form-group form-group-submit">
<button type="submit" class="btn btn-success send" rel="9">提交</button>
<button type="reset" class="btn btn-info" rel="9">重置</button>
<button type="submit" class="btn btn-success send" rel="11">提交</button>
<button type="reset" class="btn btn-info" rel="11">重置</button>
</div>
</form>
</div>
... ... @@ -3288,8 +3250,8 @@
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers9"></pre>
<pre id="response9"></pre>
<pre id="response_headers11"></pre>
<pre id="response11"></pre>
</div>
</div>
</div>
... ... @@ -3304,10 +3266,10 @@
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample9">
<div class="tab-pane" id="sample11">
<div class="row">
<div class="col-md-12">
<pre id="sample_response9"></pre>
<pre id="sample_response11"></pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -3316,29 +3278,31 @@
</div>
</div>
</div>
<h2>公共接口</h2>
<hr>
<div class="panel panel-default">
<div class="panel-heading" id="heading-10">
<div class="panel-heading" id="heading-9">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion10" href="#collapseOne10"> 上传文件 <span class="text-muted">/api/common/upload</span></a>
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion9" href="#collapseOne9"> 加载初始化 <span class="text-muted">/api/common/init</span></a>
</h4>
</div>
<div id="collapseOne10" class="panel-collapse collapse">
<div id="collapseOne9" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab10">
<li class="active"><a href="#info10" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox10" data-toggle="tab">在线测试</a></li>
<li><a href="#sample10" data-toggle="tab">返回示例</a></li>
<ul class="nav nav-tabs" id="doctab9">
<li class="active"><a href="#info9" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox9" data-toggle="tab">在线测试</a></li>
<li><a href="#sample9" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info10">
<div class="tab-pane active" id="info9">
<div class="well">
上传文件 </div>
加载初始化 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>权限</strong></div>
<div class="panel-body">
... ... @@ -3346,7 +3310,7 @@
<tbody>
<tr>
<td>登录</td>
<td></td>
<td></td>
</tr>
<tr>
<td>鉴权</td>
... ... @@ -3376,10 +3340,22 @@
</thead>
<tbody>
<tr>
<td>file</td>
<td>File</td>
<td>version</td>
<td>string</td>
<td></td>
<td>文件流</td>
<td>版本号</td>
</tr>
<tr>
<td>lng</td>
<td>string</td>
<td></td>
<td>经度</td>
</tr>
<tr>
<td>lat</td>
<td>string</td>
<td></td>
<td>纬度</td>
</tr>
</tbody>
</table>
... ... @@ -3392,7 +3368,7 @@
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox10">
<div class="tab-pane" id="sandbox9">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
... ... @@ -3402,14 +3378,22 @@
</div>
</div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="POST" name="form10" id="form10">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/init" method="get" name="form9" id="form9">
<div class="form-group">
<label class="control-label" for="file">file</label>
<input type="File" class="form-control input-sm" id="file" required placeholder="文件流" name="file">
<label class="control-label" for="version">version</label>
<input type="string" class="form-control input-sm" id="version" required placeholder="版本号" name="version">
</div>
<div class="form-group">
<label class="control-label" for="lng">lng</label>
<input type="string" class="form-control input-sm" id="lng" required placeholder="经度" name="lng">
</div>
<div class="form-group">
<label class="control-label" for="lat">lat</label>
<input type="string" class="form-control input-sm" id="lat" required placeholder="纬度" name="lat">
</div>
<div class="form-group form-group-submit">
<button type="submit" class="btn btn-success send" rel="10">提交</button>
<button type="reset" class="btn btn-info" rel="10">重置</button>
<button type="submit" class="btn btn-success send" rel="9">提交</button>
<button type="reset" class="btn btn-info" rel="9">重置</button>
</div>
</form>
</div>
... ... @@ -3419,8 +3403,8 @@
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers10"></pre>
<pre id="response10"></pre>
<pre id="response_headers9"></pre>
<pre id="response9"></pre>
</div>
</div>
</div>
... ... @@ -3435,10 +3419,10 @@
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample10">
<div class="tab-pane" id="sample9">
<div class="row">
<div class="col-md-12">
<pre id="sample_response10"></pre>
<pre id="sample_response9"></pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -3447,31 +3431,29 @@
</div>
</div>
</div>
<h2>Crontab</h2>
<hr>
<div class="panel panel-default">
<div class="panel-heading" id="heading-11">
<div class="panel-heading" id="heading-10">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion11" href="#collapseOne11"> index <span class="text-muted">/api/crontab/index</span></a>
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion10" href="#collapseOne10"> 上传文件 <span class="text-muted">/api/common/upload</span></a>
</h4>
</div>
<div id="collapseOne11" class="panel-collapse collapse">
<div id="collapseOne10" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab11">
<li class="active"><a href="#info11" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox11" data-toggle="tab">在线测试</a></li>
<li><a href="#sample11" data-toggle="tab">返回示例</a></li>
<ul class="nav nav-tabs" id="doctab10">
<li class="active"><a href="#info10" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox10" data-toggle="tab">在线测试</a></li>
<li><a href="#sample10" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info11">
<div class="tab-pane active" id="info10">
<div class="well">
index </div>
上传文件 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>权限</strong></div>
<div class="panel-body">
... ... @@ -3479,7 +3461,7 @@
<tbody>
<tr>
<td>登录</td>
<td></td>
<td></td>
</tr>
<tr>
<td>鉴权</td>
... ... @@ -3498,7 +3480,24 @@
<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>file</td>
<td>File</td>
<td></td>
<td>文件流</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -3508,7 +3507,7 @@
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox11">
<div class="tab-pane" id="sandbox10">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
... ... @@ -3518,13 +3517,14 @@
</div>
</div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/crontab/index" method="get" name="form11" id="form11">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="POST" name="form10" id="form10">
<div class="form-group">
<label class="control-label" for="file">file</label>
<input type="File" class="form-control input-sm" id="file" required placeholder="文件流" name="file">
</div>
<div class="form-group form-group-submit">
<button type="submit" class="btn btn-success send" rel="11">提交</button>
<button type="reset" class="btn btn-info" rel="11">重置</button>
<button type="submit" class="btn btn-success send" rel="10">提交</button>
<button type="reset" class="btn btn-info" rel="10">重置</button>
</div>
</form>
</div>
... ... @@ -3534,8 +3534,8 @@
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers11"></pre>
<pre id="response11"></pre>
<pre id="response_headers10"></pre>
<pre id="response10"></pre>
</div>
</div>
</div>
... ... @@ -3550,10 +3550,10 @@
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample11">
<div class="tab-pane" id="sample10">
<div class="row">
<div class="col-md-12">
<pre id="sample_response11"></pre>
<pre id="sample_response10"></pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -4935,7 +4935,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-11 09:42:23 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-11 09:49:30 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...