feat:完善项目
This commit is contained in:
@ -28,14 +28,19 @@ type Account struct{}
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {String} data token
|
||||
* @apiSuccess (200) {Json} data 具体信息
|
||||
* @apiSuccess (200) {String} data.token token信息,接口需要携带
|
||||
* @apiSuccess (200) {Number} data.effect_time token有效时长,秒
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIxNjE3NDU2OTMwIiwiaWF0IjoiMTYxNjg1MjEzMCIsInVpZCI6IjIwMTMxMTI4MTMwMTg0MTkyMDAifQ.D7oSD4OGdz8rJt0rFNVEl5Ea47_vtuC51IDrY9mUTPo"
|
||||
* "data": {
|
||||
* "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIxNjM4NjA0NDYwIiwiaWF0IjoiMTYzNjAxMjQ2MCIsInVpZCI6IjIwOTU2MTg2ODk5ODEyMjI5MTIifQ.Q4_peBb9aeGaZAfUFMMzn21cbfhY6_DEocI9xlj9v9g",
|
||||
* "effect_time": 2592000
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
func (a *Account) Login(c *gin.Context) {
|
||||
|
||||
@ -12,6 +12,34 @@ type Config struct{}
|
||||
* @apiDefine Config 配置管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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": "天津市", ...}
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": {
|
||||
* "110000": "北京市",
|
||||
* "120000": "天津市",
|
||||
* "130000": "河北省",
|
||||
* "140000": "山西省",
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
func (*Config) Area(c *gin.Context) {
|
||||
form := &struct {
|
||||
Key string `json:"key" form:"key"`
|
||||
@ -21,5 +49,5 @@ func (*Config) Area(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
data := config.NewInstance()(getSession()(c).(*service.Session)).Area(form.Key)
|
||||
APIResponse(nil, data)
|
||||
APIResponse(nil, data)(c)
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
package api
|
||||
|
||||
type Manage struct{}
|
||||
|
||||
/**
|
||||
* @apiDefine Manage 数据管理
|
||||
*/
|
||||
|
||||
@ -45,7 +45,7 @@ func (*Supplier) MaterialAdd(c *gin.Context) {
|
||||
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||
Kind: model.ManageSupplierKindForMaterial,
|
||||
})
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Supplier) MaterialEdit(c *gin.Context) {
|
||||
@ -61,7 +61,7 @@ func (*Supplier) MaterialEdit(c *gin.Context) {
|
||||
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||
Kind: model.ManageSupplierKindForMaterial,
|
||||
})
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Supplier) MaterialDelete(c *gin.Context) {
|
||||
@ -72,7 +72,7 @@ func (*Supplier) MaterialDelete(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Supplier) Repair(c *gin.Context) {
|
||||
@ -101,7 +101,7 @@ func (*Supplier) RepairAdd(c *gin.Context) {
|
||||
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||
Kind: model.ManageSupplierKindForRepair,
|
||||
})
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Supplier) RepairEdit(c *gin.Context) {
|
||||
@ -117,7 +117,7 @@ func (*Supplier) RepairEdit(c *gin.Context) {
|
||||
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||
Kind: model.ManageSupplierKindForRepair,
|
||||
})
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Supplier) RepairDelete(c *gin.Context) {
|
||||
@ -128,5 +128,5 @@ func (*Supplier) RepairDelete(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -10,12 +10,12 @@ type User struct{}
|
||||
|
||||
func (*User) Info(c *gin.Context) {
|
||||
data := user.NewInstance()(getSession()(c).(*service.Session)).Info()
|
||||
APIResponse(nil, data)
|
||||
APIResponse(nil, data)(c)
|
||||
}
|
||||
|
||||
func (*User) Menu(c *gin.Context) {
|
||||
data, err := user.NewMenu()(getSession()(c).(*service.Session)).Menu()
|
||||
APIResponse(err, data)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*User) List(c *gin.Context) {
|
||||
@ -31,7 +31,7 @@ func (*User) List(c *gin.Context) {
|
||||
}
|
||||
data, err := user.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.TenantID,
|
||||
form.Page, form.PageSize)
|
||||
APIResponse(err, data)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*User) Add(c *gin.Context) {
|
||||
@ -47,7 +47,7 @@ func (*User) Add(c *gin.Context) {
|
||||
}
|
||||
data, err := user.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.TenantID,
|
||||
form.Page, form.PageSize)
|
||||
APIResponse(err, data)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*User) Edit(c *gin.Context) {
|
||||
@ -63,5 +63,5 @@ func (*User) Edit(c *gin.Context) {
|
||||
}
|
||||
data, err := user.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.TenantID,
|
||||
form.Page, form.PageSize)
|
||||
APIResponse(err, data)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user