作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

1

... ... @@ -42,6 +42,15 @@ class Common extends Api
/**
* 上传接口
* @ApiMethod (POST)
* @ApiParams (name="file", type="file", required=true, description="文件")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
})
*/
public function upload()
{
... ... @@ -118,7 +127,7 @@ class Common extends Api
'sha1' => $sha1,
'extparam' => json_encode($extparam),
);
$attachment = Attachment::create(array_filter($params), true);
$attachment = \app\common\model\Attachment::create(array_filter($params), true);
$policy = array(
'saveKey' => ltrim($savekey, '/'),
);
... ...
... ... @@ -2259,7 +2259,7 @@
<div class="panel panel-default">
<div class="panel-heading" id="heading-13">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion13" href="#collapseOne13"> 上传接口 <span class="text-muted">/api/common/upload</span></a>
</h4>
</div>
... ... @@ -2288,7 +2288,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">
... ... @@ -2304,9 +2321,10 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="get" name="form13" id="form13">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="POST" name="form13" id="form13">
<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">
<button type="submit" class="btn btn-success send" rel="13">提交</button>
... ... @@ -2329,7 +2347,32 @@
<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>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>integer</td>
<td></td>
</tr>
<tr>
<td>msg</td>
<td>string</td>
<td></td>
</tr>
<tr>
<td>data</td>
<td>object</td>
<td>扩展数据返回</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
... ... @@ -2339,7 +2382,10 @@
<div class="tab-pane" id="sample13">
<div class="row">
<div class="col-md-12">
<pre id="sample_response13"></pre>
<pre id="sample_response13">{
'code':'1',
'msg':'返回成功'
}</pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -10283,7 +10329,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-08-03 19:55:31 </div>
Generated on 2020-08-04 08:41:46 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">我的网站</a>
</div>
... ...