@@ -0,0 +1,132 @@ | |||
package financial_center | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md "applet/app/md/financial_center" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | |||
"github.com/gin-gonic/gin" | |||
"time" | |||
) | |||
// GetWithdrawSetting | |||
// @Summary 财务中心-提现-基础设置(获取) | |||
// @Tags 提现 | |||
// @Description 基础设置(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Success 200 {object} md.GetWithdrawSettingResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financialCenter/withdraw/setting [get] | |||
func GetWithdrawSetting(c *gin.Context) { | |||
settingDb := implement.NewFinWithdrawSettingDb(db.Db) | |||
setting, err := settingDb.FinWithdrawSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
// 不存在则初始化 | |||
if setting == nil { | |||
now := time.Now() | |||
frequency := md2.WithdrawFrequencySetStruct{ | |||
Day: 0, | |||
Times: 0, | |||
} | |||
frequencyStr := utils.SerializeStr(frequency) | |||
m := model.FinWithdrawSetting{ | |||
FrequencySet: frequencyStr, | |||
WithdrawType: 0, | |||
VipLevelLimit: 0, | |||
IsRealName: 0, | |||
WithdrawNumsLimit: 0, | |||
WithdrawAmountLimit: "", | |||
WithdrawMultipleLimit: "", | |||
IsSupportDecimalPoint: 0, | |||
IsAuto: 0, | |||
WithdrawTimeInterval: "", | |||
WithdrawFeeSet: "", | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
UpdateAt: "", | |||
} | |||
_, err2 := settingDb.FinWithdrawSettingInsert(&m) | |||
if err2 != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | |||
return | |||
} | |||
setting, err = settingDb.FinWithdrawSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
} | |||
var frequency md2.WithdrawFrequencySetStruct | |||
utils.Unserialize([]byte(setting.FrequencySet), &frequency) | |||
resp := md.GetWithdrawSettingResp{ | |||
Id: setting.Id, | |||
FrequencySet: frequency, | |||
WithdrawType: setting.WithdrawType, | |||
VipLevelLimit: setting.VipLevelLimit, | |||
IsRealName: setting.IsRealName, | |||
WithdrawNumsLimit: setting.WithdrawNumsLimit, | |||
WithdrawAmountLimit: setting.WithdrawAmountLimit, | |||
WithdrawMultipleLimit: setting.WithdrawMultipleLimit, | |||
IsSupportDecimalPoint: setting.IsSupportDecimalPoint, | |||
IsAuto: setting.IsAuto, | |||
WithdrawTimeInterval: setting.WithdrawTimeInterval, | |||
WithdrawFeeSet: setting.WithdrawFeeSet, | |||
CreateAt: setting.CreateAt, | |||
UpdateAt: setting.UpdateAt, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
} | |||
// UpdateWithdrawSetting | |||
// @Summary 财务中心-提现-基础设置(更新) | |||
// @Tags 提现 | |||
// @Description 基础设置(更新) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param req body md.UpdateWithdrawSettingReq true "id 必填" | |||
// @Success 200 {int} "修改数据条数" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financialCenter/withdraw/updateWithdrawSetting [POST] | |||
func UpdateWithdrawSetting(c *gin.Context) { | |||
var req *md.UpdateWithdrawSettingReq | |||
if err1 := c.ShouldBindJSON(&req); err1 != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) | |||
return | |||
} | |||
frequencyStr := utils.SerializeStr(req.FrequencySet) | |||
m := model.FinWithdrawSetting{ | |||
Id: req.Id, | |||
FrequencySet: frequencyStr, | |||
WithdrawType: req.WithdrawType, | |||
VipLevelLimit: req.VipLevelLimit, | |||
IsRealName: req.IsRealName, | |||
WithdrawNumsLimit: req.WithdrawNumsLimit, | |||
WithdrawAmountLimit: req.WithdrawAmountLimit, | |||
WithdrawMultipleLimit: req.WithdrawMultipleLimit, | |||
IsSupportDecimalPoint: req.IsSupportDecimalPoint, | |||
IsAuto: req.IsAuto, | |||
WithdrawTimeInterval: req.WithdrawTimeInterval, | |||
WithdrawFeeSet: req.WithdrawFeeSet, | |||
} | |||
forceColumns := []string{"is_real_name", "withdraw_nums_limit", "withdraw_amount_limit", "withdraw_multiple_limit", "is_support_decimal_point", "is_auto"} | |||
settingDb := implement.NewFinWithdrawSettingDb(db.Db) | |||
affected, err := settingDb.FinWithdrawSettingUpdate(req.Id, &m, forceColumns...) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
e.OutSuc(c, affected, nil) | |||
} |
@@ -3,7 +3,7 @@ package new_user_red_package | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md "applet/app/md/institutional_management/new_user_red_package" | |||
"applet/app/md/marketing_applications/new_user_red_package" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"github.com/gin-gonic/gin" | |||
@@ -3,7 +3,7 @@ package member_center | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md "applet/app/md/institutional_management/member_center" | |||
md2 "applet/app/md/member_center" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
@@ -47,7 +47,7 @@ func GetLevelList(c *gin.Context) { | |||
countMap[utils.StrToInt(res["level"])] = res["total"] | |||
} | |||
list := make([]md.LevelListNode, 0) | |||
list := make([]md2.LevelListNode, 0) | |||
for i, level := range levels { | |||
list[i].LevelWeight = level.LevelWeight | |||
list[i].LevelID = level.Id | |||
@@ -58,9 +58,9 @@ func GetLevelList(c *gin.Context) { | |||
list[i].Memo = level.Memo | |||
} | |||
resp := md.GetLevelListResp{ | |||
resp := md2.GetLevelListResp{ | |||
List: list, | |||
Paginate: md.Paginate{ | |||
Paginate: md2.Paginate{ | |||
Limit: utils.StrToInt(limit), | |||
Page: utils.StrToInt(page), | |||
Total: total, | |||
@@ -120,7 +120,7 @@ func GetOneLevel(c *gin.Context) { | |||
return | |||
} | |||
resp := md.GetOneLevelResp{ | |||
resp := md2.GetOneLevelResp{ | |||
TaskType: taskType, | |||
LevelID: level.Id, | |||
IsUse: level.IsUse, | |||
@@ -147,7 +147,7 @@ func GetOneLevel(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/addLevelTask [post] | |||
func AddLevelTask(c *gin.Context) { | |||
var req *md.AddLevelTaskReq | |||
var req *md2.AddLevelTaskReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -195,7 +195,7 @@ func AddLevelTask(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/updateLevelTask [post] | |||
func UpdateLevelTask(c *gin.Context) { | |||
var req *md.UpdateLevelTaskReq | |||
var req *md2.UpdateLevelTaskReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -241,7 +241,7 @@ func UpdateLevelTask(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/updateLevel [post] | |||
func UpdateLevel(c *gin.Context) { | |||
var req *md.UpdateLevelReq | |||
var req *md2.UpdateLevelReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -285,7 +285,7 @@ func UpdateLevel(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/addLevel [post] | |||
func AddLevel(c *gin.Context) { | |||
var req *md.AddLevelReq | |||
var req *md2.AddLevelReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -328,7 +328,7 @@ func AddLevel(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/deleteLevelTask [delete] | |||
func DeleteLevelTask(c *gin.Context) { | |||
var req *md.DeleteTaskReq | |||
var req *md2.DeleteTaskReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -355,7 +355,7 @@ func DeleteLevelTask(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/levelManagement/deleteLevel [delete] | |||
func DeleteLevel(c *gin.Context) { | |||
var req *md.DeleteLevelReq | |||
var req *md2.DeleteLevelReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -3,7 +3,7 @@ package member_center | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md "applet/app/md/institutional_management/member_center" | |||
md2 "applet/app/md/member_center" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
@@ -45,7 +45,7 @@ func GetTagList(c *gin.Context) { | |||
return | |||
} | |||
list := make([]md.TagListNode, len(*tags)) | |||
list := make([]md2.TagListNode, len(*tags)) | |||
for i, tag := range *tags { | |||
list[i].Name = tag.TagName | |||
list[i].Count = countMap[int64(tag.Id)] | |||
@@ -53,9 +53,9 @@ func GetTagList(c *gin.Context) { | |||
list[i].Memo = tag.Memo | |||
} | |||
resp := md.GetTagListResp{ | |||
resp := md2.GetTagListResp{ | |||
List: list, | |||
Paginate: md.Paginate{ | |||
Paginate: md2.Paginate{ | |||
Limit: utils.StrToInt(limit), | |||
Page: utils.StrToInt(page), | |||
Total: total, | |||
@@ -76,7 +76,7 @@ func GetTagList(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/tagManagement/addTag [post] | |||
func AddTag(c *gin.Context) { | |||
var req *md.AddTagReq | |||
var req *md2.AddTagReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -111,7 +111,7 @@ func AddTag(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/tagManagement/updateTag [post] | |||
func UpdateTag(c *gin.Context) { | |||
var req *md.UpdateTagReq | |||
var req *md2.UpdateTagReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -147,7 +147,7 @@ func UpdateTag(c *gin.Context) { | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/memberCenter/tagManagement/deleteTag [delete] | |||
func DeleteTag(c *gin.Context) { | |||
var req *md.DeleteTagReq | |||
var req *md2.DeleteTagReq | |||
if err := c.ShouldBindJSON(&req); err != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
@@ -3,7 +3,7 @@ package member_center | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md "applet/app/md/institutional_management/member_center" | |||
"applet/app/md/member_center" | |||
svc "applet/app/svc/member_center" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
@@ -0,0 +1,35 @@ | |||
package md | |||
import "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | |||
type GetWithdrawSettingResp struct { | |||
Id int64 `json:"id"` | |||
FrequencySet md.WithdrawFrequencySetStruct `json:"frequency_set"` // 频率设置 x 天提现 y 次 | |||
WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) | |||
VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 | |||
IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) | |||
WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) | |||
WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) | |||
WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) | |||
IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) | |||
IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) | |||
WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 | |||
WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 | |||
CreateAt string `json:"create_at"` // 申请时间 | |||
UpdateAt string `json:"update_at"` // 处理时间 | |||
} | |||
type UpdateWithdrawSettingReq struct { | |||
Id int64 `json:"id,required"` | |||
FrequencySet md.WithdrawFrequencySetStruct `json:"frequency_set"` // 频率设置 x 天提现 y 次 | |||
WithdrawType int `json:"withdraw_type"` // 提现方式(1:支付宝 2:微信) | |||
VipLevelLimit int `json:"vip_level_limit"` // 提现等级限制 | |||
IsRealName int `json:"is_real_name"` // 是否实名(0:否 1:是) | |||
WithdrawNumsLimit int `json:"withdraw_nums_limit"` // 提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 ) | |||
WithdrawAmountLimit string `json:"withdraw_amount_limit"` // 提现金额限制(0为不限制,大于等于该金额才可以申请提现 ) | |||
WithdrawMultipleLimit string `json:"withdraw_multiple_limit"` // 提现倍数限制(0为不限制,金额限制倍数才可以申请提现 ) | |||
IsSupportDecimalPoint int `json:"is_support_decimal_point"` // 是否支持小数点(0:否 1:是) | |||
IsAuto int `json:"is_auto"` // 是否开启自动提现(0:否 1:是) | |||
WithdrawTimeInterval string `json:"withdraw_time_interval"` // 提现时段 | |||
WithdrawFeeSet string `json:"withdraw_fee_set"` // 提现手续费设置 | |||
} |
@@ -4,6 +4,7 @@ import ( | |||
"applet/app/cfg" | |||
"applet/app/hdl" | |||
"applet/app/hdl/comm" | |||
"applet/app/hdl/financial_center" | |||
"applet/app/hdl/institutional_management/egg_energy" | |||
"applet/app/hdl/institutional_management/public_platoon" | |||
"applet/app/hdl/marketing_applications/new_user_red_package" | |||
@@ -61,6 +62,7 @@ func route(r *gin.RouterGroup) { | |||
rMarketingApplications(r.Group("/marketingApplications")) | |||
rMemberCenter(r.Group("/memberCenter")) | |||
rSettCenter(r.Group("/settCenter")) | |||
rFinancialCenter(r.Group("/financialCenter")) | |||
} | |||
func rSettCenter(r *gin.RouterGroup) { //设置中心 | |||
@@ -186,6 +188,14 @@ func rMemberCenter(r *gin.RouterGroup) { // 会员中心 | |||
} | |||
} | |||
func rFinancialCenter(r *gin.RouterGroup) { | |||
rWithdraw := r.Group("/withdraw") | |||
{ | |||
rWithdraw.GET("/setting", financial_center.GetWithdrawSetting) | |||
rWithdraw.POST("/updateWithdrawSetting", financial_center.UpdateWithdrawSetting) | |||
} | |||
} | |||
func rComm(r *gin.RouterGroup) { | |||
r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表 | |||
r.GET("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL | |||
@@ -1,7 +1,7 @@ | |||
package svc | |||
import ( | |||
md "applet/app/md/institutional_management/member_center" | |||
"applet/app/md/member_center" | |||
"xorm.io/xorm" | |||
) | |||
@@ -33,8 +33,8 @@ require ( | |||
) | |||
require ( | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241121055036-fe2db8190b16 | |||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241121120649-65cd7a1f776c | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241125064737-27042dbc26da | |||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125064517-f490fbb9b9a0 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | |||
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible | |||