api 產生介面文檔樣本:
{
"name": "9月份贈險領取分享活動微信介面",
"version": "1.0.0",
"description": "9月份贈險領取分享活動微信介面文檔 (t=1) ",
"sampleUrl" : "http://www.phpernote.com/"
}
另存檔案名稱為:apidoc.json
apidoc -i 要產生文檔的項目目錄 -o 介面檔案的組建目錄
介面代碼檔案代碼如下:
<?php
/**
* @api {post} /news/lists 新聞資訊列表
* @apiVersion 1.0.0
* @apiName lists
* @apiGroup User
* @apiPermission 登入使用者
*
* @apiDescription 使用者登入後進入該頁面,將顯示新聞資訊列表
*
* @apiSampleRequest /v1/news/lists
*
* @apiSuccess (傳回值) {string} id 主鍵ID
* @apiSuccess (傳回值) {string} name 客戶姓名
* @apiSuccess (傳回值) {string} user_head_img 客戶頭像
* @apiSuccess (傳回值) {integer} sex 性別:0-未設定,1-男,2-女
* @apiSuccess (傳回值) {string} demand 客戶需求
*
* @apiSuccessExample {json} 成功樣本:
* {"code": 1,"msg": "","data": {"id": "57b3cdb46b787","name": "餘浩苗","user_head_img": "userHead/2016-08-18/1034587522576.jpg","sex": "1","demand": "本人想買保險,請速聯絡!"}}
*
* @apiErrorExample (json) 錯誤樣本:
* {"code":-1,"msg":"密碼錯誤","data":{}}
*/
///////////////////////////////////////
/**
* @api {post} /news/rob 搶客戶
* @apiVersion 1.0.0
* @apiName rob
* @apiGroup User
* @apiPermission 登入使用者
*
* @apiDescription 搶客戶
*
* @apiParam {string} id 主鍵ID
*
* @apiSampleRequest /v1/news/rob
*
* @apiSuccessExample {json} 成功樣本:
* {"code":1,"msg":"","data":{}}
*
* @apiErrorExample (json) 錯誤樣本:
* {"code":-1,"msg":"錯誤資訊","data":{}}
*/
///////////////////////////////////////
更多關於apidoc的用法請參考:http://apidocjs.com/