dengbiao 6 giorni fa
parent
commit
5c70eba02c
7 ha cambiato i file con 855 aggiunte e 535 eliminazioni
  1. +16
    -16
      app/hdl/marketing_applications/new_user_red_package/hdl_basic.go
  2. +10
    -10
      app/md/institutional_management/new_user_red_package/md_basic.go
  3. +34
    -22
      app/task/svc/svc_save_egg_energy_price.go
  4. +293
    -180
      docs/docs.go
  5. +293
    -180
      docs/swagger.json
  6. +205
    -124
      docs/swagger.yaml
  7. +4
    -3
      go.mod

+ 16
- 16
app/hdl/marketing_applications/new_user_red_package/hdl_basic.go Vedi File

@@ -11,15 +11,15 @@ import (
)

// NewUserRedPackageGetBasic
// @Summary 制度中心-新人红包-新人红包设置(获取)
// @Tags 新人红包
// @Summary 制度中心-营销应用-新人红包设置(获取)
// @Tags 营销应用
// @Description 新人红包设置(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.NewUserRedPackageGetBasicResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/newUserRedPackage/getBasic [get]
// @Router /api/marketingApplications/newUserRedPackage/getBasic [get]
func NewUserRedPackageGetBasic(c *gin.Context) {
redPackageDb := implement.NewNewUserRedPackageDb(db.Db)
setting, err := redPackageDb.NewUserRedPackageGetOne()
@@ -57,8 +57,8 @@ func NewUserRedPackageGetBasic(c *gin.Context) {
}

// NewUserRedPackageUpdateBasic
// @Summary 制度中心-新人红包-新人红包设置(修改)
// @Tags 新人红包
// @Summary 制度中心-营销应用-新人红包设置(修改)
// @Tags 营销应用
// @Description 新人红包设置(修改)
// @Accept json
// @Produce json
@@ -66,7 +66,7 @@ func NewUserRedPackageGetBasic(c *gin.Context) {
// @Param req body md.NewUserRedPackageUpdateBasicReq true "新人红包设置表单"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/newUserRedPackage/updateBasic [put]
// @Router /api/marketingApplications/newUserRedPackage/updateBasic [put]
func NewUserRedPackageUpdateBasic(c *gin.Context) {
var req *md.NewUserRedPackageUpdateBasicReq
if err := c.ShouldBindJSON(&req); err != nil {
@@ -105,16 +105,16 @@ func NewUserRedPackageUpdateBasic(c *gin.Context) {
}

// NewUserRedPackageRecordList
// @Summary 制度中心-新人红包-新人红包列表(查询)
// @Tags 新人红包
// @Summary 制度中心-营销应用-新人红包列表(查询)
// @Tags 营销应用
// @Description 新人红包列表(查询)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.NewUserRedPackageRecordListReq true "新人红包列表查询条件(分页信息必填)"
// @Success 200 {object} md.PaginateResp "具体数据"
// @Success 200 {object} md.NewUserRedPackageRecordListResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/newUserRedPackage/recordList [post]
// @Router /api/marketingApplications/newUserRedPackage/recordList [post]
func NewUserRedPackageRecordList(c *gin.Context) {
var req *md.NewUserRedPackageRecordListReq
if err := c.ShouldBindJSON(&req); err != nil {
@@ -142,7 +142,7 @@ func NewUserRedPackageRecordList(c *gin.Context) {
list[i].UpdateAt = record.UpdateAt
}

resp := md.PaginateResp{
resp := md.NewUserRedPackageRecordListResp{
List: list,
Paginate: md.Paginate{
Page: req.Page,
@@ -155,16 +155,16 @@ func NewUserRedPackageRecordList(c *gin.Context) {
}

// NewUserRedPackageRecordFlowList
// @Summary 制度中心-新人红包-新人红包列表明细(查询)
// @Tags 新人红包
// @Summary 制度中心-营销应用-新人红包列表明细(查询)
// @Tags 营销应用
// @Description 新人红包列表明细(查询)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.NewUserRedPackageRecordFlowListReq true "新人红包列表明细查询条件(分页信息、用户 ID必填)"
// @Success 200 {object} md.PaginateResp "具体数据"
// @Success 200 {object} md.NewUserRedPackageRecordFlowListResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/institutionalManagement/newUserRedPackage/recordFlowList [post]
// @Router /api/marketingApplications/newUserRedPackage/recordFlowList [post]
func NewUserRedPackageRecordFlowList(c *gin.Context) {
var req *md.NewUserRedPackageRecordFlowListReq
if err := c.ShouldBindJSON(&req); err != nil {
@@ -193,7 +193,7 @@ func NewUserRedPackageRecordFlowList(c *gin.Context) {
list[i].CreateAt = flow.CreateAt
}

resp := md.PaginateResp{
resp := md.NewUserRedPackageRecordFlowListResp{
List: list,
Paginate: md.Paginate{
Page: req.Page,


+ 10
- 10
app/md/institutional_management/new_user_red_package/md_basic.go Vedi File

@@ -1,21 +1,11 @@
package md

type PaginateReq struct {
Page int `form:"page" json:"page" binding:"required"`
Limit int `form:"limit" json:"limit" binding:"required"`
}

type Paginate struct {
Page int `json:"page"`
Limit int `json:"limit"`
Total int64 `json:"total"`
}

type PaginateResp struct {
List interface{} `json:"list"`
Paginate Paginate `json:"paginate"`
}

type NewUserRedPackageGetBasicResp struct {
IsOpen int `json:"is_open"` // 是否开启(1:开启 0:关闭)
TotalAmount string `json:"total_amount" example:"总金额"`
@@ -53,6 +43,11 @@ type NewUserRedPackageRecordNode struct {
UpdateAt string `json:"update_at"` // 修改时间
}

type NewUserRedPackageRecordListResp struct {
List []NewUserRedPackageRecordNode `json:"list"`
Paginate Paginate `json:"paginate"`
}

type NewUserRedPackageRecordFlowListReq struct {
Uid int64 `json:"uid,required"` // 用户 ID
Page int `json:"page,required"` // 页数
@@ -74,3 +69,8 @@ type NewUserRedPackageRecordFlowNode struct {
ReceiveDays int `json:"receive_days"` // 领取天数
CreateAt string `json:"create_at"` // 创建时间
}

type NewUserRedPackageRecordFlowListResp struct {
List []NewUserRedPackageRecordFlowNode `json:"list"`
Paginate Paginate `json:"paginate"`
}

+ 34
- 22
app/task/svc/svc_save_egg_energy_price.go Vedi File

@@ -1,9 +1,11 @@
package svc

import (
"applet/app/cfg"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"code.fnuoos.com/EggPlanet/egg_system_rules.git"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc"
"errors"
"fmt"
@@ -32,15 +34,9 @@ func EggEnergyAutoRecordPrices(engine *xorm.Engine) {
fmt.Println("EggEnergyAutoRecordPrices_ERR:::::", err.Error())
return
}
if has {
// 2. 判断最后一条记录是否间隔一个小时 不能在同一天的同一小时
if lastPrice.Date == dateNowStr && lastPrice.Hour == hourNowStr {
fmt.Println("当前小时已记录过价格")
return
}
}

// 3. 查询当前价格
// 2. 查询当前价格
egg_system_rules.Init(cfg.RedisAddr)
eggEnergyCoreData, cb, err1 := svc.GetEggEnergyCoreData(engine)
if err1 != nil {
fmt.Println("EggEnergyAutoRecordPrices_ERR:::::", err1.Error())
@@ -50,20 +46,36 @@ func EggEnergyAutoRecordPrices(engine *xorm.Engine) {
defer cb() // 释放锁
}

// 4. 保存当前价格
priceData := model.EggEnergyPrice{
Price: eggEnergyCoreData.NowPrice,
Date: dateNowStr,
Hour: hourNowStr,
}
id, err2 := priceDb.EggEnergyPriceInsert(&priceData)
if err2 != nil {
fmt.Println("EggEnergyAutoRecordPrices_ERR:::::", err2.Error())
return
}
if id == 0 {
fmt.Println("EggEnergyAutoRecordPrices_ERR:::::", errors.New(fmt.Sprintf("%s 新增价格失败, 当前价格 %s", now.Format("2006-01-02 15:04:05"), eggEnergyCoreData.NowPrice)))
return
if has {
// 3. 当前时间已经有记录 更新价格
if lastPrice.Date == dateNowStr && lastPrice.Hour == hourNowStr {
lastPrice.Price = eggEnergyCoreData.NowPrice
affected, err2 := priceDb.EggEnergyPriceUpdate(lastPrice)
if err2 != nil {
fmt.Println("SaveEggEnergyPrice_ERR:::::", err2.Error())
return
}
if affected == 0 {
fmt.Println("SaveEggEnergyPrice_ERR:::::", errors.New(fmt.Sprintf("%s 新增价格失败, 当前价格 %s", now.Format("2006-01-02 15:04:05"), eggEnergyCoreData.NowPrice)))
return
}
}
} else {
// 4. 保存当前价格
priceData := model.EggEnergyPrice{
Price: eggEnergyCoreData.NowPrice,
Date: dateNowStr,
Hour: hourNowStr,
}
id, err2 := priceDb.EggEnergyPriceInsert(&priceData)
if err2 != nil {
fmt.Println("SaveEggEnergyPrice_ERR:::::", err2.Error())
return
}
if id == 0 {
fmt.Println("SaveEggEnergyPrice_ERR:::::", errors.New(fmt.Sprintf("%s 新增价格失败, 当前价格 %s", now.Format("2006-01-02 15:04:05"), eggEnergyCoreData.NowPrice)))
return
}
}
return
}

+ 293
- 180
docs/docs.go
File diff soppresso perché troppo grande
Vedi File


+ 293
- 180
docs/swagger.json
File diff soppresso perché troppo grande
Vedi File


+ 205
- 124
docs/swagger.yaml Vedi File

@@ -954,6 +954,51 @@ definitions:
description: 用户 ID
type: integer
type: object
md.NewUserRedPackageRecordFlowListResp:
properties:
list:
items:
$ref: '#/definitions/md.NewUserRedPackageRecordFlowNode'
type: array
paginate:
$ref: '#/definitions/applet_app_md_institutional_management_new_user_red_package.Paginate'
type: object
md.NewUserRedPackageRecordFlowNode:
properties:
balance_amount:
description: 剩余金额
type: string
balance_days:
description: 剩余天数
type: integer
basic_amount:
description: 基础金额
type: string
create_at:
description: 创建时间
type: string
day_num:
description: 第x天
type: integer
double_rate:
description: 倍率
type: string
id:
description: 流水 ID
type: integer
is_double:
description: 是否翻倍
type: integer
receive_days:
description: 领取天数
type: integer
total_amount:
description: 实际金额
type: string
uid:
description: 用户 ID
type: integer
type: object
md.NewUserRedPackageRecordListReq:
properties:
end_at:
@@ -972,6 +1017,48 @@ definitions:
description: 用户 ID
type: integer
type: object
md.NewUserRedPackageRecordListResp:
properties:
list:
items:
$ref: '#/definitions/md.NewUserRedPackageRecordNode'
type: array
paginate:
$ref: '#/definitions/applet_app_md_institutional_management_new_user_red_package.Paginate'
type: object
md.NewUserRedPackageRecordNode:
properties:
balance_amount:
description: 剩余金额
type: string
balance_days:
description: 剩余天数
type: integer
create_at:
description: 创建时间
type: string
days:
description: 天数
type: integer
receive_days:
description: 领取天数
type: integer
state:
description: 状态(0:待领取 1:领取中 2:已领取 3:已冻结)
type: integer
system_id:
description: 系统中记录的 ID
type: integer
total_amount:
description: 金额
type: string
uid:
description: 用户 ID
type: integer
update_at:
description: 修改时间
type: string
type: object
md.NewUserRedPackageUpdateBasicReq:
properties:
days:
@@ -999,12 +1086,6 @@ definitions:
description: 奖励系数
type: number
type: object
md.PaginateResp:
properties:
list: {}
paginate:
$ref: '#/definitions/applet_app_md_institutional_management_new_user_red_package.Paginate'
type: object
md.PlatformRevenueDataNode:
properties:
balance_amount:
@@ -1970,124 +2051,6 @@ paths:
summary: 制度中心-绿色能量持有者明细-绿色能量(获取)
tags:
- 公排管理
/api/institutionalManagement/newUserRedPackage/getBasic:
get:
consumes:
- application/json
description: 新人红包设置(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.NewUserRedPackageGetBasicResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-新人红包-新人红包设置(获取)
tags:
- 新人红包
/api/institutionalManagement/newUserRedPackage/recordFlowList:
post:
consumes:
- application/json
description: 新人红包列表明细(查询)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包列表明细查询条件(分页信息、用户 ID必填)
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordFlowListReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.PaginateResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-新人红包-新人红包列表明细(查询)
tags:
- 新人红包
/api/institutionalManagement/newUserRedPackage/recordList:
post:
consumes:
- application/json
description: 新人红包列表(查询)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包列表查询条件(分页信息必填)
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordListReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.PaginateResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-新人红包-新人红包列表(查询)
tags:
- 新人红包
/api/institutionalManagement/newUserRedPackage/updateBasic:
put:
consumes:
- application/json
description: 新人红包设置(修改)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包设置表单
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageUpdateBasicReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-新人红包-新人红包设置(修改)
tags:
- 新人红包
/api/institutionalManagement/publicPlatoon/communityDividends/communityDividendsAdd:
post:
consumes:
@@ -2513,6 +2476,124 @@ paths:
summary: 登陆
tags:
- 登录
/api/marketingApplications/newUserRedPackage/getBasic:
get:
consumes:
- application/json
description: 新人红包设置(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.NewUserRedPackageGetBasicResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-营销应用-新人红包设置(获取)
tags:
- 营销应用
/api/marketingApplications/newUserRedPackage/recordFlowList:
post:
consumes:
- application/json
description: 新人红包列表明细(查询)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包列表明细查询条件(分页信息、用户 ID必填)
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordFlowListReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordFlowListResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-营销应用-新人红包列表明细(查询)
tags:
- 营销应用
/api/marketingApplications/newUserRedPackage/recordList:
post:
consumes:
- application/json
description: 新人红包列表(查询)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包列表查询条件(分页信息必填)
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordListReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.NewUserRedPackageRecordListResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-营销应用-新人红包列表(查询)
tags:
- 营销应用
/api/marketingApplications/newUserRedPackage/updateBasic:
put:
consumes:
- application/json
description: 新人红包设置(修改)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 新人红包设置表单
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.NewUserRedPackageUpdateBasicReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 制度中心-营销应用-新人红包设置(修改)
tags:
- 营销应用
securityDefinitions:
MasterID:
in: header


+ 4
- 3
go.mod Vedi File

@@ -2,9 +2,10 @@ module applet

go 1.19

replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models
//replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models

replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules
//
//replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules

require (
github.com/boombuler/barcode v1.0.1
@@ -34,7 +35,7 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.0.5
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241115090315-a9a84aba8235
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.3
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible


Caricamento…
Annulla
Salva