feat:完善项目
This commit is contained in:
@ -20,19 +20,19 @@ type Account struct{}
|
|||||||
*
|
*
|
||||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||||
*
|
*
|
||||||
* @apiParam {String} account 登录账号
|
* @apiParam {Object} captcha 验证码信息
|
||||||
* @apiParam {String} password 登录密码
|
* @apiParam {String} captcha.key="key" 验证key
|
||||||
* @apiParam {Json} captcha 验证码信息
|
* @apiParam {String} captcha.value="value" 验证value
|
||||||
* @apiParam {String} captcha.key 验证key
|
* @apiParam {String} account="admin" 登录账号
|
||||||
* @apiParam {String} captcha.value 验证value
|
* @apiParam {String} password="123456" 登录密码
|
||||||
*
|
*
|
||||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
* @apiSuccess (200) {Object} data 具体信息
|
||||||
* @apiSuccess (200) {String} msg 成功提示
|
|
||||||
* @apiSuccess (200) {Json} data 具体信息
|
|
||||||
* @apiSuccess (200) {String} data.token token信息,接口需要携带
|
* @apiSuccess (200) {String} data.token token信息,接口需要携带
|
||||||
* @apiSuccess (200) {Number} data.effect_time 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
|
* HTTPS 200 OK
|
||||||
* {
|
* {
|
||||||
* "code": 200
|
* "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
|
* @apiVersion 1.0.0
|
||||||
* @apiName AccountLogout
|
* @apiName AccountLogout
|
||||||
* @apiGroup Account
|
* @apiGroup Account
|
||||||
|
@ -14,16 +14,16 @@ type Captcha struct{}
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /api/captcha 获取验证码
|
* @api {get} /api/v1/captcha 获取验证码
|
||||||
* @apiVersion 1.0.0
|
* @apiVersion 1.0.0
|
||||||
* @apiName Captcha
|
* @apiName Captcha
|
||||||
* @apiGroup Captcha
|
* @apiGroup Captcha
|
||||||
*
|
*
|
||||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
* @apiSuccess (200) {Object} data 具体信息
|
||||||
* @apiSuccess (200) {String} msg 成功提示
|
|
||||||
* @apiSuccess (200) {Json} data 具体信息
|
|
||||||
* @apiSuccess (200) {String} data.key 验证码key
|
* @apiSuccess (200) {String} data.key 验证码key
|
||||||
* @apiSuccess (200) {String} data.captcha 验证码图片地址
|
* @apiSuccess (200) {String} data.captcha 验证码图片地址
|
||||||
|
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||||
|
* @apiSuccess (200) {String} msg 成功提示
|
||||||
*
|
*
|
||||||
* @apiSuccessExample {json} Success response:
|
* @apiSuccessExample {json} Success response:
|
||||||
* HTTPS 200 OK
|
* HTTPS 200 OK
|
||||||
|
@ -13,19 +13,18 @@ type Config struct{}
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /api/v1/config/area 区域管理
|
* @api {get} /api/v1/config/area 区域信息
|
||||||
* @apiVersion 1.0.0
|
* @apiVersion 1.0.0
|
||||||
* @apiName ConfigArea
|
* @apiName ConfigArea
|
||||||
* @apiGroup Config
|
* @apiGroup Config
|
||||||
*
|
*
|
||||||
* @apiHeader {string} x-token token
|
* @apiHeader {string} x-token token
|
||||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
|
||||||
*
|
*
|
||||||
* @apiParam {String} [key="''"] 区域标识
|
* @apiParam {String} [key="''"] 区域标识
|
||||||
*
|
*
|
||||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||||
* @apiSuccess (200) {String} msg 成功提示
|
* @apiSuccess (200) {String} msg 成功提示
|
||||||
* @apiSuccess (200) {Json} data 数据信息{"110000": "北京市", "120000": "天津市", ...}
|
* @apiSuccess (200) {Object} data 数据信息{"110000": "北京市", "120000": "天津市", ...}
|
||||||
*
|
*
|
||||||
* @apiSuccessExample {json} Success response:
|
* @apiSuccessExample {json} Success response:
|
||||||
* HTTPS 200 OK
|
* HTTPS 200 OK
|
||||||
|
@ -12,7 +12,6 @@ type Upload struct{}
|
|||||||
/**
|
/**
|
||||||
* @apiDefine Upload 上传管理
|
* @apiDefine Upload 上传管理
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /api/v1/upload 上传接口
|
* @api {post} /api/v1/upload 上传接口
|
||||||
* @apiVersion 1.0.0
|
* @apiVersion 1.0.0
|
||||||
@ -23,12 +22,12 @@ type Upload struct{}
|
|||||||
*
|
*
|
||||||
* @apiParam {File} file 文件信息
|
* @apiParam {File} file 文件信息
|
||||||
*
|
*
|
||||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
|
||||||
* @apiSuccess (200) {String} msg 成功提示
|
|
||||||
* @apiSuccess (200) {Object} data 具体信息
|
* @apiSuccess (200) {Object} data 具体信息
|
||||||
* @apiSuccess (200) {Number} data.url 文件访问地址
|
* @apiSuccess (200) {Number} data.url 文件访问地址
|
||||||
* @apiSuccess (200) {String} data.filepath 文件地址
|
* @apiSuccess (200) {String} data.filepath 文件地址
|
||||||
* @apiSuccess (200) {String} data.filename 文件名称
|
* @apiSuccess (200) {String} data.filename 文件名称
|
||||||
|
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||||
|
* @apiSuccess (200) {String} msg 成功提示
|
||||||
*
|
*
|
||||||
* @apiSuccessExample {json} Success response:
|
* @apiSuccessExample {json} Success response:
|
||||||
* HTTPS 200 OK
|
* HTTPS 200 OK
|
||||||
@ -42,6 +41,7 @@ type Upload struct{}
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (a *Upload) Upload(c *gin.Context) {
|
func (a *Upload) Upload(c *gin.Context) {
|
||||||
file, err := c.FormFile("file")
|
file, err := c.FormFile("file")
|
||||||
|
|
||||||
|
@ -8,6 +8,35 @@ import (
|
|||||||
|
|
||||||
type User struct{}
|
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) {
|
func (*User) Info(c *gin.Context) {
|
||||||
data := user.NewInstance()(getSession()(c).(*service.Session)).Info()
|
data := user.NewInstance()(getSession()(c).(*service.Session)).Info()
|
||||||
APIResponse(nil, data)(c)
|
APIResponse(nil, data)(c)
|
||||||
|
6
main.go
6
main.go
@ -11,10 +11,10 @@ var (
|
|||||||
ConfigFile = flag.String("config", "./config.yaml", "config.yaml path")
|
ConfigFile = flag.String("config", "./config.yaml", "config.yaml path")
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title TenantServe API文档
|
// @title ArmedPolice API文档
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description TenantServe API文档
|
// @description ArmedPolice API文档
|
||||||
// @host 192.168.0.153:9000
|
// @host 127.0.0.1:8010
|
||||||
|
|
||||||
// @contact.name Henry
|
// @contact.name Henry
|
||||||
// @contact.url https://ipeace.org.cn
|
// @contact.url https://ipeace.org.cn
|
||||||
|
11
package.json
11
package.json
@ -16,13 +16,14 @@
|
|||||||
"author": "Henry",
|
"author": "Henry",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"apidoc": {
|
"apidoc": {
|
||||||
"name": "Tenant",
|
"name": "ArmedPolice",
|
||||||
"title": "TenantAPI",
|
"title": "ArmedPoliceAPI",
|
||||||
"description": "Tenant多租户管理-让用户更加紧密",
|
"description": "话不多说",
|
||||||
"url": "http://192.168.0.153:9000",
|
"url": "http://127.0.0.1:8010",
|
||||||
"sampleUrl": "http://192.168.0.153:9000",
|
"sampleUrl": "http://127.0.0.1:8010",
|
||||||
"order": [
|
"order": [
|
||||||
"Account",
|
"Account",
|
||||||
|
"Config",
|
||||||
"User",
|
"User",
|
||||||
"Menu",
|
"Menu",
|
||||||
"Role",
|
"Role",
|
||||||
|
@ -39,7 +39,7 @@ func (this *Router) registerAPI() {
|
|||||||
g.Use(NeedLogin(AddSkipperURL([]string{
|
g.Use(NeedLogin(AddSkipperURL([]string{
|
||||||
apiPrefix + "/v1/account/login",
|
apiPrefix + "/v1/account/login",
|
||||||
apiPrefix + "/v1/account/logout",
|
apiPrefix + "/v1/account/logout",
|
||||||
apiPrefix + "/v1/user/info",
|
apiPrefix + "/v1/captcha",
|
||||||
}...)))
|
}...)))
|
||||||
v1 := g.Group("/v1")
|
v1 := g.Group("/v1")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user