開源地址:http://git.oschina.net/chejiangyi/ApiView
開源QQ群: .net 開源基礎服務 238543768
ApiView
.net api的接口文檔查看網站,用於解決分布式開發過程中的Api接口管理和溝通問題。
- 自動生成api文檔;
- 方便api調試及第三方開發人員對接,可以應用在asp.net mvc,wcf,webservice 中使用;
- 代碼及原理都很簡單,方便二次開發和完善。
安裝包
使用git下載項目並打開目錄 “\安裝包\” 可直接安裝使用
使用Demo示例
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Mvc;
6 using BSF.BaseService.OpenApi.Attributes;
7 using BSF.Extensions;
8 using BSF.Api;
9
10 namespace ApiViewTestWeb.Controllers
11 {
12 public class DemoController:Controller
13 {
14 //
15 // GET: /Demo/
16
17 [OpenDoc("Index","test method","參數描述","結果描述","結果狀態描述","作者",1.0,1.0,"備注")]
18 public string Index(int a,string b,float d)
19 {
20 return a+b.NullToEmpty()+d;
21 }
22
23 [OpenDoc("某一店鋪的商品列表V15", "某一店鋪的商品列表V15",
24 @"token:token(可選參數),
25 商戶賬號:shopid,
26 類目id:categoryid int?,
27 關鍵詞:keyword,
28 條形碼: barcode,
29 顯示數量:pageSize ,
30 頁碼:pageIndex",
31 @"活動序號(Int):hdxh,
32 商品條碼(string):sptm,
33 商品名稱(string):spmc,
34 規格型號(string):ggxh,
35 計量單位(string):jldw,
36 商品圖片(string):sptp,
37 圖片修改時間(string):sptpxgsj,
38 原零售價(Decimal):original_lsj,
39 零售價(Decimal):lsj,
40 商品銷量(Decimal):spxl,
41 是否活動商品(int):isActivity,
42 活動總數量(Decimal):hdzsl,
43 每人限購數量(Decimal):mrxgsl,
44 ", "-5缺少參數", "車江毅", 1.5, 1.5, "")]
45 public ActionResult List(string shopid, int? categoryid, string keyword, string barcode, long? pageSize, long? pageIndex)
46 {
47 return Json( new ServiceResult() { code=1, data="測試數據", msg="成功", total=1 });
48 }
49 }
50 }
部分截圖
by 車江毅