From c59583577779d4841b3f859f34d0a627629bc81c Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 10 Aug 2021 16:20:27 +0800 Subject: [PATCH] aa --- business/jxstore/cms/job.go | 49 ++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/job.go b/business/jxstore/cms/job.go index e59aa327b..f9b10a3ed 100644 --- a/business/jxstore/cms/job.go +++ b/business/jxstore/cms/job.go @@ -2144,6 +2144,26 @@ func GetVendorMatterRcmmd(ctx *jxcontext.Context, vendorID int, goodsID string, return handler.GetUnionMatterListRcmmd(ctx, goodsID, rcmmdType, offset, pageSize) } +type ConfigUnion struct { + Type string `json:"type"` + Data []*ConfigUnionData `json:"data"` +} + +type ConfigUnionData struct { + Title string `json:"title"` + ID string `json:"id"` + Content *ConfigUnionDataContent `json:"content"` +} + +type ConfigUnionDataContent struct { + Imgsrc string `json:"imgSrc"` + Type int `json:"type"` + List []interface{} `json:"list"` + Bgcolor string `json:"bgColor"` + Ftcolor string `json:"ftColor"` + Topath int `json:"toPath"` +} + func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { var ( db = dao.GetDB() @@ -2181,7 +2201,6 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { } //建任务 for _, v := range addList { - fmt.Println(utils.Format4Output(v, true)) //推广规则 storeURL := "" percentage := 0 @@ -2222,6 +2241,34 @@ func MtUnionJobAutoUpdate(ctx *jxcontext.Context) (err error) { if err != nil { return err } + //更新banner + var ( + configUnions []*ConfigUnion + configs []*model.NewConfig + ) + if configs, _ = dao.QueryConfigs(db, "activeBanner", model.ConfigTypeSys, ""); len(configs) > 0 { + err = json.Unmarshal([]byte(configs[0].Value), &configUnions) + } + for _, config := range configUnions { + if config.Type == "美团外卖" { + config.Data = append(config.Data, &ConfigUnionData{ + Title: "banner", + ID: utils.Int2Str(job.ID), + Content: &ConfigUnionDataContent{ + Imgsrc: job.UnionImg, + Type: 1, + List: nil, + Bgcolor: "#ffffff", + Ftcolor: "#606266", + Topath: 10, + }, + }) + break + } + } + data, _ := json.Marshal(configUnions) + configs[0].Value = string(data) + dao.UpdateEntity(db, configs[0], "Value") break } return err