Browse Source

add method to add fundData

adv_callback
shenjiachi 1 month ago
parent
commit
f146c434b5
6 changed files with 253 additions and 0 deletions
  1. +43
    -0
      app/hdl/institutional_management/egg_energy/hdl_basic.go
  2. +16
    -0
      app/md/institutional_management/egg_energy/md_basic.go
  3. +1
    -0
      app/router/router.go
  4. +72
    -0
      docs/docs.go
  5. +72
    -0
      docs/swagger.json
  6. +49
    -0
      docs/swagger.yaml

+ 43
- 0
app/hdl/institutional_management/egg_energy/hdl_basic.go View File

@@ -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)
}

+ 16
- 0
app/md/institutional_management/egg_energy/md_basic.go View File

@@ -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:"备注"`
}

+ 1
- 0
app/router/router.go View File

@@ -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)
}
}
}


+ 72
- 0
docs/docs.go View File

@@ -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": {


+ 72
- 0
docs/swagger.json View File

@@ -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": {


+ 49
- 0
docs/swagger.yaml View File

@@ -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:


Loading…
Cancel
Save