1、新增渠道适配,后续需改成通过数据库配置;

This commit is contained in:
chenlin 2025-05-21 16:14:07 +08:00
parent eae0fceb11
commit c48cff83ac
2 changed files with 24 additions and 4 deletions

View File

@ -167,7 +167,8 @@ func (e MiGuDeployService) SubscribeNotice(c *gin.Context) {
} }
var req models.QueryRightsInfoReq var req models.QueryRightsInfoReq
req.AppChannelList = append(req.AppChannelList, models.ChannelCode) productChannelCode := models.GetProductChannelCode(orderInfo.ChannelCode)
req.AppChannelList = append(req.AppChannelList, productChannelCode)
req.Mobile = checkPhoneNum req.Mobile = checkPhoneNum
resp, err := models.MiGuQueryRightsInfo(&req) resp, err := models.MiGuQueryRightsInfo(&req)

View File

@ -26,6 +26,7 @@ const (
ProductID = 1 ProductID = 1
ChannelCode = "40458652536" ChannelCode = "40458652536"
NewChannelCode = "40458653076"
SM4KEy = "ve3N1I75AJ0Oy6nA" SM4KEy = "ve3N1I75AJ0Oy6nA"
@ -898,6 +899,18 @@ func GetChannelInfoByChannelCode(channel string, db *gorm.DB) (MgChannel, error)
return channelInfo, nil return channelInfo, nil
} }
// GetProductChannelCode 根据渠道编码返回对应的产品渠道编码
func GetProductChannelCode(channelID string) string {
switch channelID {
case "6015150807":
return ChannelCode // ChannelCode
case "8159641101":
return NewChannelCode // NewChannelCode
default:
return "" // 未知渠道时返回空字符串
}
}
// CheckOrderState 定时任务检查订单状态是否有1小时退订 // CheckOrderState 定时任务检查订单状态是否有1小时退订
func CheckOrderState() { func CheckOrderState() {
if database.Db == nil { if database.Db == nil {
@ -924,9 +937,15 @@ func CheckOrderState() {
} }
for i, _ := range orderList { for i, _ := range orderList {
productChannelCode := GetProductChannelCode(orderList[i].ChannelCode)
if productChannelCode == "" {
fmt.Println("未知的渠道编码:", orderList[i].ChannelCode)
continue
}
for j := 0; j < 5; j++ { for j := 0; j < 5; j++ {
var req QueryRightsInfoReq var req QueryRightsInfoReq
req.AppChannelList = append(req.AppChannelList, ChannelCode) req.AppChannelList = append(req.AppChannelList, productChannelCode)
req.Mobile = orderList[i].PhoneNumber req.Mobile = orderList[i].PhoneNumber
resp, err := MiGuQueryRightsInfo(&req) resp, err := MiGuQueryRightsInfo(&req)