setting -> Editor -> Live Template -> add template group -> add live template:
/**
* api url配置在apidoc.json里
* sampleUrl配置在apidoc.json里
* @api {post} /v1/方法名 方法名
* @apiGroup 项目名
* @apiName 方法名
* @apiVersion 1.0.0
*
* @apiDescription 接口描述
*
* @apiParam {String} param1 参数说明
*
* @apiSuccess {Number} status 状态码,1:有数据/成功,-1:没数据/失败
* @apiSuccess {String} msg 提示信息
* @apiSuccess {Object} data 返回数据
*
* @apiSuccessExample {json} Success-Response:
* {"status":1,"msg":"成功","data":[]}
*
* @apiErrorExample {json} Error-Response:
* {"status":-1,"msg":"没有数据"}
*
* @apiSampleRequest /方法名
*/
public function $NAME$($PARAMETERS$){
$END$
}
apidoc.json :
{
"name": "xxxx接口文档",
"version": "1.0.0",
"description": "xxxx接口文档",
"title": "xxxx接口文档",
"url" : "https://www.xxx.com/xxx/api",
"sampleUrl" : "https://www.xxx.com/xxx/api/v1"
}
命令行:
$ apidoc -i ./path/api/ -o ./apidoc