diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 99b578d5c..6d372f0d8 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1888,25 +1888,35 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // }, storeMaps) // tasksch.HandleTask(task, nil, true).Run() // _, err = task.GetResult(0) - skuIDMap := make(map[int]int) - order, _ := partner.CurOrderManager.LoadOrder("2105998332000452", 0) - for _, v := range order.Skus { - if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 { - skuIDMap[skuID] = 1 - } + var ( + db = dao.GetDB() + skuNames []*model.SkuName + ) + sql := ` + SELECT * FROM sku_name WHERE deleted_at = ? AND img = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, model.NOSkuNameImg, } - actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(dao.GetDB(), 0, []int{0}, model.ActTypeAll, []int{103168}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) - fmt.Println("actStoreSkuList111111111111111111", utils.Format4Output(actStoreSkuList, false)) - if actStoreSkuMap := jxutils.NewActStoreSkuMap(actStoreSkuList, false); actStoreSkuMap != nil { - for _, v := range order.Skus { - if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 { - if actStoreSku := actStoreSkuMap.GetActStoreSku(103168, skuID, order.VendorID); actStoreSku != nil { - fmt.Println("actStoreSku11111111111111", utils.Format4Output(actStoreSku, false)) - v.EarningPrice = actStoreSku.EarningPrice - if true { //v.StoreSubName != "" { // 之前这里为什么要加判断? - v.StoreSubID = actStoreSku.ActID - } + dao.GetRows(db, &skuNames, sql, sqlParams) + for _, v := range skuNames { + if v.Upc != nil { + result, _ := api.MtwmAPI.GetStandardProductListWithCond(*v.Upc) + if v.Img == model.NOSkuNameImg { + imgs := strings.Split(result.Pic, ",") + if len(imgs) == 1 { + v.Img = imgs[0] } + if len(imgs) == 2 { + v.Img = imgs[0] + v.Img2 = imgs[1] + } + if len(imgs) >= 3 { + v.Img = imgs[0] + v.Img2 = imgs[1] + v.Img3 = imgs[3] + } + dao.UpdateEntity(db, v, "Img", "Img2", "Img3") } } }