feat:完善项目

This commit is contained in:
henry
2021-11-04 16:44:42 +08:00
parent c41adc075a
commit fe7c9ad983
8 changed files with 61 additions and 32 deletions

View File

@ -20,19 +20,19 @@ type Account struct{}
*
* @apiHeader {string} Content-Type=application/json 传输方式
*
* @apiParam {String} account 登录账号
* @apiParam {String} password 登录密码
* @apiParam {Json} captcha 验证码信息
* @apiParam {String} captcha.key 验证key
* @apiParam {String} captcha.value 验证value
* @apiParam {Object} captcha 验证码信息
* @apiParam {String} captcha.key="key" 验证key
* @apiParam {String} captcha.value="value" 验证value
* @apiParam {String} account="admin" 登录账号
* @apiParam {String} password="123456" 登录密码
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Json} data 具体信息
* @apiSuccess (200) {Object} data 具体信息
* @apiSuccess (200) {String} data.token token信息接口需要携带
* @apiSuccess (200) {Number} data.effect_time token有效时长
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* @apiSuccessExample {Json} Success response:
* HTTPS 200 OK
* {
* "code": 200
@ -62,7 +62,7 @@ func (a *Account) Login(c *gin.Context) {
}
/**
* @api {post} /api/account/logout 账号退出
* @api {post} /api/v1/account/logout 账号退出
* @apiVersion 1.0.0
* @apiName AccountLogout
* @apiGroup Account

View File

@ -14,16 +14,16 @@ type Captcha struct{}
*/
/**
* @api {get} /api/captcha 获取验证码
* @api {get} /api/v1/captcha 获取验证码
* @apiVersion 1.0.0
* @apiName Captcha
* @apiGroup Captcha
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Json} data 具体信息
* @apiSuccess (200) {Object} data 具体信息
* @apiSuccess (200) {String} data.key 验证码key
* @apiSuccess (200) {String} data.captcha 验证码图片地址
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK

View File

@ -13,19 +13,18 @@ type Config struct{}
*/
/**
* @api {get} /api/v1/config/area 区域管理
* @api {get} /api/v1/config/area 区域信息
* @apiVersion 1.0.0
* @apiName ConfigArea
* @apiGroup Config
*
* @apiHeader {string} x-token token
* @apiHeader {string} Content-Type=application/json 传输方式
*
* @apiParam {String} [key="''"] 区域标识
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Json} data 数据信息{"110000": "北京市", "120000": "天津市", ...}
* @apiSuccess (200) {Object} data 数据信息{"110000": "北京市", "120000": "天津市", ...}
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK

View File

@ -12,7 +12,6 @@ type Upload struct{}
/**
* @apiDefine Upload 上传管理
*/
/**
* @api {post} /api/v1/upload 上传接口
* @apiVersion 1.0.0
@ -23,12 +22,12 @@ type Upload struct{}
*
* @apiParam {File} file 文件信息
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Object} data 具体信息
* @apiSuccess (200) {Number} data.url 文件访问地址
* @apiSuccess (200) {String} data.filepath 文件地址
* @apiSuccess (200) {String} data.filename 文件名称
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
@ -36,12 +35,13 @@ type Upload struct{}
* "code": 200
* "msg": "ok"
* "data":{
* "url": "http://192.168.99.185:8010/upload/20210401/ad228811386cb8cd089a9d668d2885cd.png",
* "filepath": "/upload/20210401/ad228811386cb8cd089a9d668d2885cd.png",
* "filename": "8251863448d7ed13393bf0aae2211272.jpg"
* "url": "http://192.168.99.185:8010/upload/20210401/ad228811386cb8cd089a9d668d2885cd.png",
* "filepath": "/upload/20210401/ad228811386cb8cd089a9d668d2885cd.png",
* "filename": "8251863448d7ed13393bf0aae2211272.jpg"
* }
* }
*/
func (a *Upload) Upload(c *gin.Context) {
file, err := c.FormFile("file")

View File

@ -8,6 +8,35 @@ import (
type User struct{}
/**
* @apiDefine User 用户管理
*/
/**
* @api {get} /api/v1/user/info 用户信息
* @apiVersion 1.0.0
* @apiName UserInfo
* @apiGroup User
*
* @apiHeader {string} x-token token
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Json} data 数据信息
* @apiSuccess (200) {String} data.name 用户名
* @apiSuccess (200) {String} data.avatar 用户头像
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": {
* "name": "商挈智能",
* "avatar": "",
* }
* }
*/
func (*User) Info(c *gin.Context) {
data := user.NewInstance()(getSession()(c).(*service.Session)).Info()
APIResponse(nil, data)(c)

View File

@ -11,10 +11,10 @@ var (
ConfigFile = flag.String("config", "./config.yaml", "config.yaml path")
)
// @title TenantServe API文档
// @title ArmedPolice API文档
// @version 1.0
// @description TenantServe API文档
// @host 192.168.0.153:9000
// @description ArmedPolice API文档
// @host 127.0.0.1:8010
// @contact.name Henry
// @contact.url https://ipeace.org.cn

View File

@ -16,13 +16,14 @@
"author": "Henry",
"license": "ISC",
"apidoc": {
"name": "Tenant",
"title": "TenantAPI",
"description": "Tenant多租户管理-让用户更加紧密",
"url": "http://192.168.0.153:9000",
"sampleUrl": "http://192.168.0.153:9000",
"name": "ArmedPolice",
"title": "ArmedPoliceAPI",
"description": "话不多说",
"url": "http://127.0.0.1:8010",
"sampleUrl": "http://127.0.0.1:8010",
"order": [
"Account",
"Config",
"User",
"Menu",
"Role",

View File

@ -39,7 +39,7 @@ func (this *Router) registerAPI() {
g.Use(NeedLogin(AddSkipperURL([]string{
apiPrefix + "/v1/account/login",
apiPrefix + "/v1/account/logout",
apiPrefix + "/v1/user/info",
apiPrefix + "/v1/captcha",
}...)))
v1 := g.Group("/v1")