diff --git a/common/platform.go b/common/platform.go index 1821514..b2fd2d0 100644 --- a/common/platform.go +++ b/common/platform.go @@ -209,10 +209,11 @@ type Channel struct { ADUpload int `gorm:"column:ad_upload;type:int(11);default:0;comment:上报事件的平台" json:"ad_upload"` ShareURL string `gorm:"column:share_url;type:varchar(256);not null;default:'https://d.slotgolden777.com/s/s.html';comment:分享地址" json:"share_url"` - HotURL string `gorm:"column:hot_url;type:varchar(256);not null;default:'';comment:热更地址" json:"hot_url"` - ApiURL string `gorm:"column:api_url;type:varchar(256);not null;default:'';comment:服务器切换地址" json:"api_url"` - UIVersion string `gorm:"column:ui_version;type:varchar(256);not null;default:'';comment:ui版本" json:"ui_version"` - Is int `gorm:"column:is;type:tinyint(4);default:0;comment:是不是审核服" json:"is"` + HotURL string `gorm:"column:hot_url;type:varchar(256);not null;default:'';comment:热更地址" json:"hot_url"` + ApiURL string `gorm:"column:api_url;type:varchar(256);not null;default:'';comment:服务器切换地址" json:"api_url"` + UIVersion string `gorm:"column:ui_version;type:varchar(256);not null;default:'';comment:ui版本" json:"ui_version"` + Is int `gorm:"column:is;type:tinyint(4);default:0;comment:是不是审核服" json:"is"` + TemplateRecharge int `gorm:"column:template_recharge;type:int(11);default:30000;comment:模板控制金额" json:"template_recharge"` } func (c *Channel) TableName() string { diff --git a/modules/backend/handler/sys/sys.go b/modules/backend/handler/sys/sys.go index 28f35ae..3de50ea 100644 --- a/modules/backend/handler/sys/sys.go +++ b/modules/backend/handler/sys/sys.go @@ -355,7 +355,9 @@ func EditChannel(c *gin.Context) { if req.Is != nil && one.Is != *req.Is { update["is"] = *req.Is } - + if req.TemplateRecharge != nil && one.TemplateRecharge != *req.TemplateRecharge { + update["template_recharge"] = *req.TemplateRecharge + } if len(update) == 0 { a.Code = values.CodeParam a.Msg = "无内容修改" diff --git a/modules/backend/values/protocol.go b/modules/backend/values/protocol.go index 5ccb9d2..3551659 100644 --- a/modules/backend/values/protocol.go +++ b/modules/backend/values/protocol.go @@ -231,29 +231,30 @@ type AddChannelReq struct { // Show 是否开启展示 0不开 1开启 // IgnoreOrganic 是否屏蔽自然量 1不屏蔽 2屏蔽 type EditChannelReq struct { - ID int `json:"ID" binding:"required"` - PlatformID *int `json:"PlatformID"` - ChannelID *int `json:"ChannelID"` - Name *string `json:"Name"` - PackName *string `json:"PackName"` - Version *int `json:"Version"` - MainVersion *int `json:"MainVersion"` - IsHot *int `json:"IsHot"` - AdjustAuth *string `json:"AdjustAuth"` - AdjustAppToken *string `json:"AdjustAppToken"` - AdjustEventID *string `json:"AdjustEventID"` - URL *string `json:"URL"` - Show *int `json:"Show"` - IgnoreOrganic *int `json:"IgnoreOrganic"` - FBPixelID *string - FBAccessToken *string - UP *int - ADUpload *int - ShareUrl *string `json:"ShareUrl"` - UIVersion *string `json:"UIVersion"` - ApiURL *string `json:"ApiURL"` - HotURL *string `json:"HotURL"` - Is *int `json:"Is"` + ID int `json:"ID" binding:"required"` + PlatformID *int `json:"PlatformID"` + ChannelID *int `json:"ChannelID"` + Name *string `json:"Name"` + PackName *string `json:"PackName"` + Version *int `json:"Version"` + MainVersion *int `json:"MainVersion"` + IsHot *int `json:"IsHot"` + AdjustAuth *string `json:"AdjustAuth"` + AdjustAppToken *string `json:"AdjustAppToken"` + AdjustEventID *string `json:"AdjustEventID"` + URL *string `json:"URL"` + Show *int `json:"Show"` + IgnoreOrganic *int `json:"IgnoreOrganic"` + FBPixelID *string + FBAccessToken *string + UP *int + ADUpload *int + ShareUrl *string `json:"ShareUrl"` + UIVersion *string `json:"UIVersion"` + ApiURL *string `json:"ApiURL"` + HotURL *string `json:"HotURL"` + Is *int `json:"Is"` + TemplateRecharge *int `json:"TemplateRecharge"` } // DelChannelReq 删除渠道 diff --git a/modules/web/providers/sn/handler.go b/modules/web/providers/sn/handler.go index c94eda3..d5a6ed4 100644 --- a/modules/web/providers/sn/handler.go +++ b/modules/web/providers/sn/handler.go @@ -661,6 +661,17 @@ func Control(uid int, controlId int) error { }, } + defaultTemplateRecharge := 300 * common.DecimalDigits + userInfo, _ := call.GetUserInfo(uid) + channelInfo := call.GetChannelByID(userInfo.ChannelID) + if channelInfo.TemplateRecharge > 0 { + defaultTemplateRecharge = channelInfo.TemplateRecharge + } + rechargeInfo := call.GetRechargeInfo(uid) + if rechargeInfo.TotalRecharge >= int64(defaultTemplateRecharge) { + req.TemplateId = "" + } + log.Debug("sn control req, %+v", *req) reqBody, _ := json.Marshal(req) var tmpValue map[string]interface{}