feat:完善项目

This commit is contained in:
henry
2021-11-09 14:08:02 +08:00
parent 08083d26d3
commit d544b7f80c
14 changed files with 338 additions and 61 deletions

View File

@ -33,20 +33,109 @@ type (
* @apiDefine Manage 数据管理
*/
/**
* @api {post} /api/v1/manage/equipment 装备信息
* @apiVersion 1.0.0
* @apiName ManageEquipment
* @apiGroup Manage
*
* @apiHeader {string} x-token token
*
* @apiParam {String} [parent_id="''"] 父集ID
* @apiParam {String} [title="''"] 名称
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Object} data 数据信息
* @apiSuccess (200) {String} data.id ID
* @apiSuccess (200) {String} data.code 装备编码
* @apiSuccess (200) {String} data.title 装备名称
* @apiSuccess (200) {String} data.image 装备图片
* @apiSuccess (200) {String} data.created_at 创建时间
* @apiSuccess (200) {Object} data.childrens 子集
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": [
* {
* "id": "EgmJ4Ga7LQ",
* "code": "S110",
* "title": "装甲车-11",
* "image": "http://192.168.31.195:8030/",
* "created_at": "2021-11-09T13:39:19+08:00",
* "children": []
* }
* ]
* }
*/
func (*Manage) Equipment(c *gin.Context) {
form := &struct {
ParentID uint64 `json:"parent_id" form:"parent_id"`
Title string `json:"title" form:"title"`
PageForm
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := manage.NewEquipment()(getSession()(c).(*service.Session)).List(form.ParentID, form.Title, form.Page, form.PageSize)
data, err := manage.NewEquipment()(getSession()(c).(*service.Session)).List(form.ParentID, form.Title)
APIResponse(err, data)(c)
}
/**
* @api {post} /api/v1/manage/equipment/detail 装备详细信息
* @apiVersion 1.0.0
* @apiName ManageEquipmentDetail
* @apiGroup Manage
*
* @apiHeader {string} x-token token
*
* @apiParam {String} [id="''"] 区域标识
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Object} data 数据信息
* @apiSuccess (200) {String} data.id ID
* @apiSuccess (200) {String} data.code 装备编码
* @apiSuccess (200) {String} data.title 装备名称
* @apiSuccess (200) {String} data.image 装备图片
* @apiSuccess (200) {String} data.created_at 创建时间
* @apiSuccess (200) {Object} data.materials 器材信息
* @apiSuccess (200) {String} data.materials.id 器材ID
* @apiSuccess (200) {String} data.materials.code 器材编码
* @apiSuccess (200) {String} data.materials.title 器材名称
* @apiSuccess (200) {Number} data.materials.unit 器材单位
* @apiSuccess (200) {String} data.materials.manufacturer_name 器材制造商
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": [
* {
* "id": "EgmJ4Ga7LQ",
* "code": "S110",
* "title": "装甲车-11",
* "image": "http://192.168.31.195:8030/",
* "config": "",
* "remark": "",
* "created_at": "2021-11-09T13:39:19+08:00",
* "materials": [
* {
* "id": "EgmJ4Ga7LQ",
* "code": "S110",
* "title": "装甲车-11",
* "unit": 1,
* "manufacturer_name": "测试的"
* }
* ]
* }
* ]
* }
*/
func (*Manage) EquipmentDetail(c *gin.Context) {
form := new(IDStringForm)