diff --git a/app/hdl/institutional_management/egg_energy/hdl_basic.go b/app/hdl/institutional_management/egg_energy/hdl_basic.go index 1429c52..55f837a 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_basic.go +++ b/app/hdl/institutional_management/egg_energy/hdl_basic.go @@ -465,3 +465,46 @@ func GetFundDataRecordList(c *gin.Context) { e.OutSuc(c, resp, nil) } + +// AddFundData +// @Summary 制度中心-蛋蛋能量-价值明细数据(新增) +// @Tags 蛋蛋能量 +// @Description 价值明细数据(新增) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.AddFundDataReq true "数据种类、金额、时长(最长24h)、执行次数必填,备注选填" +// @Success 200 {int} "插入数据 id" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/globalData/fundDataAdd [post] +func AddFundData(c *gin.Context) { + var req *md.AddFundDataReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + + fundDataDb := implement.NewEggEnergyFundDataDb(db.Db) + now := time.Now() + hour := now.Hour() + if req.Hours > 24 { + hour = 24 + } + m := model.EggEnergyFundData{ + Kind: req.Kind, + TotalAmount: req.TotalAmount, + BalanceAmount: req.TotalAmount, + Hours: hour, + BalanceTimes: req.Times, + Memo: req.Memo, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + } + id, err := fundDataDb.EggEnergyFundDataInsert(&m) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + e.OutSuc(c, id, nil) +} diff --git a/app/md/institutional_management/egg_energy/md_basic.go b/app/md/institutional_management/egg_energy/md_basic.go index 73212c3..ece39e2 100644 --- a/app/md/institutional_management/egg_energy/md_basic.go +++ b/app/md/institutional_management/egg_energy/md_basic.go @@ -118,3 +118,19 @@ type GetFundDataRecordListResp struct { List []FundDataRecordNode `json:"list"` Paginate Paginate `json:"paginate"` } + +type GetFundDataRecordDataListReq struct { + Kind int `json:"kind"` //种类(1:公司补贴 2:资方投资 3:市场期望) + StartAt string `json:"start_at"` + EndAt string `json:"end_at"` + Page int `json:"page"` + Limit int `json:"limit"` +} + +type AddFundDataReq struct { + Kind int `json:"kind,required"` // 种类(1:公司补贴 2:资方投资 3:市场期望) + TotalAmount string `json:"total_amount,required"` // 金额 + Hours int `json:"hours,required"` // 时长(小时) + Times int `json:"times,required"` // 剩余执行次数 + Memo string `json:"memo" example:"备注"` +} diff --git a/app/router/router.go b/app/router/router.go index 6f42182..350da37 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -106,6 +106,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rEggGlobalData.GET("/pointsCenterPriceCurve", egg_energy.GetPriceCurve) rEggGlobalData.POST("/fundDataList", egg_energy.GetFundDataList) rEggGlobalData.POST("/fundDataRecordList", egg_energy.GetFundDataRecordList) + rEggGlobalData.POST("/fundDataAdd", egg_energy.AddFundData) } } } diff --git a/docs/docs.go b/docs/docs.go index ac87c61..5a3ffbc 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -180,6 +180,53 @@ const docTemplate = `{ } } }, + "/api/institutionalManagement/eggEnergy/globalData/fundDataAdd": { + "post": { + "description": "价值明细数据(新增)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-价值明细数据(新增)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "数据种类、金额、时长(最长24h)、执行次数必填,备注选填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AddFundDataReq" + } + } + ], + "responses": { + "200": { + "description": "插入数据 id", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/globalData/fundDataList": { "post": { "description": "新增数据列表(获取)", @@ -1352,6 +1399,31 @@ const docTemplate = `{ } } }, + "md.AddFundDataReq": { + "type": "object", + "properties": { + "hours": { + "description": "时长(小时)", + "type": "integer" + }, + "kind": { + "description": "种类(1:公司补贴 2:资方投资 3:市场期望)", + "type": "integer" + }, + "memo": { + "type": "string", + "example": "备注" + }, + "times": { + "description": "剩余执行次数", + "type": "integer" + }, + "total_amount": { + "description": "金额", + "type": "string" + } + } + }, "md.DailyActivityAnalysisTopData": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index a031f35..088ba3a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -173,6 +173,53 @@ } } }, + "/api/institutionalManagement/eggEnergy/globalData/fundDataAdd": { + "post": { + "description": "价值明细数据(新增)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-价值明细数据(新增)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "数据种类、金额、时长(最长24h)、执行次数必填,备注选填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AddFundDataReq" + } + } + ], + "responses": { + "200": { + "description": "插入数据 id", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/globalData/fundDataList": { "post": { "description": "新增数据列表(获取)", @@ -1345,6 +1392,31 @@ } } }, + "md.AddFundDataReq": { + "type": "object", + "properties": { + "hours": { + "description": "时长(小时)", + "type": "integer" + }, + "kind": { + "description": "种类(1:公司补贴 2:资方投资 3:市场期望)", + "type": "integer" + }, + "memo": { + "type": "string", + "example": "备注" + }, + "times": { + "description": "剩余执行次数", + "type": "integer" + }, + "total_amount": { + "description": "金额", + "type": "string" + } + } + }, "md.DailyActivityAnalysisTopData": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 42db0cf..62b239c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -109,6 +109,24 @@ definitions: uid: type: integer type: object + md.AddFundDataReq: + properties: + hours: + description: 时长(小时) + type: integer + kind: + description: 种类(1:公司补贴 2:资方投资 3:市场期望) + type: integer + memo: + example: 备注 + type: string + times: + description: 剩余执行次数 + type: integer + total_amount: + description: 金额 + type: string + type: object md.DailyActivityAnalysisTopData: properties: activity_count: @@ -1232,6 +1250,37 @@ paths: summary: 制度中心-蛋蛋能量-数据概览(获取) tags: - 蛋蛋能量 + /api/institutionalManagement/eggEnergy/globalData/fundDataAdd: + post: + consumes: + - application/json + description: 价值明细数据(新增) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 数据种类、金额、时长(最长24h)、执行次数必填,备注选填 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.AddFundDataReq' + produces: + - application/json + responses: + "200": + description: 插入数据 id + schema: + type: int + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-蛋蛋能量-价值明细数据(新增) + tags: + - 蛋蛋能量 /api/institutionalManagement/eggEnergy/globalData/fundDataList: post: consumes: