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
req.AppChannelList = append(req.AppChannelList, models.ChannelCode)
productChannelCode := models.GetProductChannelCode(orderInfo.ChannelCode)
req.AppChannelList = append(req.AppChannelList, productChannelCode)
req.Mobile = checkPhoneNum
resp, err := models.MiGuQueryRightsInfo(&req)

View File

@ -24,8 +24,9 @@ const (
MiGUCheckOrderUrl = "https://mg.zeqinkeji.cn/coupon-provider/api/orders/exchange-type/check"
MiGUQueryRightsInfoUrl = "https://betagame.migufun.com/member/shareRights/v1.1.0.7/queryRightsInfo"
ProductID = 1
ChannelCode = "40458652536"
ProductID = 1
ChannelCode = "40458652536"
NewChannelCode = "40458653076"
SM4KEy = "ve3N1I75AJ0Oy6nA"
@ -898,6 +899,18 @@ func GetChannelInfoByChannelCode(channel string, db *gorm.DB) (MgChannel, error)
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小时退订
func CheckOrderState() {
if database.Db == nil {
@ -924,9 +937,15 @@ func CheckOrderState() {
}
for i, _ := range orderList {
productChannelCode := GetProductChannelCode(orderList[i].ChannelCode)
if productChannelCode == "" {
fmt.Println("未知的渠道编码:", orderList[i].ChannelCode)
continue
}
for j := 0; j < 5; j++ {
var req QueryRightsInfoReq
req.AppChannelList = append(req.AppChannelList, ChannelCode)
req.AppChannelList = append(req.AppChannelList, productChannelCode)
req.Mobile = orderList[i].PhoneNumber
resp, err := MiGuQueryRightsInfo(&req)