diff --git a/business/jxstore/cms/job.go b/business/jxstore/cms/job.go index ec2cd9c11..604c48d79 100644 --- a/business/jxstore/cms/job.go +++ b/business/jxstore/cms/job.go @@ -2149,9 +2149,9 @@ func GetVendorMatterRcmmd(ctx *jxcontext.Context, vendorID int, goodsID string, func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { var ( db = dao.GetDB() - actMap = make(map[int]*mtunionapi.ActivityListResult) + actMap = make(map[int]*partner.ActivityList) jobMap = make(map[int]*dao.GetJobsResult) - addList []*mtunionapi.ActivityListResult + addList []*partner.ActivityList now = time.Now() ) //先找出美团联盟所有发布任务(此任务只用于显示) @@ -2160,18 +2160,15 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { return err } //再查美团联盟上的所有活动 - acts, err := mt.GetAPI().ActivityList(1, 20, 0) + handler := partner.GetHandler(model.VendorIDMTWM) + acts, err := handler.GetUnionActList(ctx, 1) if err != nil { return err } for _, v := range acts { - if v.DateBound != "" { - dateBegin := utils.Str2Time(v.DateBound[:strings.LastIndex(v.DateBound, "至")-1]) - dateEnd := utils.Str2Time(v.DateBound[strings.LastIndex(v.DateBound, "至")+4:]) - //在有效期内 - if now.Sub(dateBegin) > 0 && dateEnd.Sub(now) > 0 { - actMap[v.ID] = v - } + //在有效期内 + if now.Sub(v.DateBegin) > 0 && v.DateEnd.Sub(now) > 0 { + actMap[v.ActID] = v } } //筛一下 @@ -2189,7 +2186,6 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { //推广规则 storeURL := "" percentage := 0 - dateEnd := v.DateBound[strings.LastIndex(v.DateBound, "至")+4:] if v.ActRule != "" { if storeURLs := regexp.MustCompile(`href=\\\\\\"(.*?)"\\\\\\`).FindStringSubmatch(v.ActRule); len(storeURLs) > 0 { fmt.Println("storeURLs .........................", storeURLs) @@ -2202,7 +2198,7 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { } } PublishJob(ctx, &model.JobExt{ - FinishedAtStr: dateEnd, + FinishedAtStr: utils.Time2Str(v.DateEnd), Job: model.Job{ VendorID: model.VendorIDMTWM, Title: v.ActName, @@ -2218,9 +2214,9 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { Type: model.JobTypeOther, CashbackType: 1, JobCityCode: 999, - UnionImg: v.URL, + UnionImg: v.Img, UnionQrcodePosition: "SouthEast", - UnionActID: utils.Int2Str(v.ID), + UnionActID: utils.Int2Str(v.ActID), Percentage: percentage, }, })