魔众积分商城系统接口文档注解

魔众积分商城系统 / 文档中心
文档中心
开发教程
安装常见问题

使用注解可以在模块打包时生成接口文档,一个接口文档注解示例如下

/**
 * @Api 新闻
 */
class NewsController extends Controller
{
  /**
   * @Api 新闻分页
   * @ApiBodyParam search.categoryId int 新闻分类ID
   * @ApiResponseData {
   *  "total": 1,
   *  "page" : 1,
   *  "pageSize": 10,
   *  "records": [
   *      {
   *        "id":1,
   *        "categoryId":1,
   *        "title":"标题",
   *        "summary":"摘要",
   *        "content":"内容"
   *      }
   *  ]
   * }
   */
  public function paginate()
  {
     // ...
  }
}

类注解

  • 接口分组:@Api 分组

方法注解

  • 接口名称:@Api 名称
  • 接口说明:@ApiDesc 接口说明
  • 接口请求方式:@ApiMethod post|get
  • 接口请求格式:@ApiDataType json|formData
  • 接口请求头:@ApiHeadParam api-token string required 参数说明
  • 接口请求Body参数:@ApiBodyParam bizId int required 企业ID
  • 接口请求Query参数:@ApiQueryParam bizId int required 企业ID
  • 接口返回Code特殊值:@ApiResponseCode 10000 用户未登录
  • 接口返回Data内容格式:@ApiResponseData { }
QQ
微信
公众号