aa
This commit is contained in:
@@ -1827,53 +1827,49 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// })
|
||||
// }
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
idLists2 [][]int64
|
||||
db = dao.GetDB()
|
||||
)
|
||||
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, []int{667281}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||
for i := 0; i < len(things); i += 50 {
|
||||
// var idList []*jdapi.SkuIdEntity
|
||||
var idList2 []int64
|
||||
j := i + 50
|
||||
if j > len(things)-1 {
|
||||
j = len(things) - 1
|
||||
}
|
||||
for _, v := range things[i:j] {
|
||||
if v.VendorThingID != "" {
|
||||
// idList = append(idList, &jdapi.SkuIdEntity{
|
||||
// OutSkuId: utils.Int64ToStr(v.ThingID),
|
||||
// })
|
||||
idList2 = append(idList2, utils.Str2Int64(v.VendorThingID))
|
||||
}
|
||||
}
|
||||
// idLists = append(idLists, idList)
|
||||
idLists2 = append(idLists2, idList2)
|
||||
}
|
||||
// for i := 0; i < len(things); i += 50 {
|
||||
// // var idList []*jdapi.SkuIdEntity
|
||||
// var idList2 []int64
|
||||
// j := i + 50
|
||||
// if j > len(things)-1 {
|
||||
// j = len(things) - 1
|
||||
// }
|
||||
// for _, v := range things[i:j] {
|
||||
// if v.VendorThingID != "" {
|
||||
// // idList = append(idList, &jdapi.SkuIdEntity{
|
||||
// // OutSkuId: utils.Int64ToStr(v.ThingID),
|
||||
// // })
|
||||
// idList2 = append(idList2, utils.Str2Int64(v.VendorThingID))
|
||||
// }
|
||||
// }
|
||||
// // idLists = append(idLists, idList)
|
||||
// idLists2 = append(idLists2, idList2)
|
||||
// }
|
||||
|
||||
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
for _, v := range idLists2 {
|
||||
if v != nil && storeMap != nil {
|
||||
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, v)
|
||||
var idLists []*jdapi.SkuIdEntity
|
||||
task2 := tasksch.NewParallelTask("uuuuu2", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
thing := batchItemList[0].(*model.ThingMap)
|
||||
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, []int64{utils.Str2Int64(thing.VendorThingID)})
|
||||
for _, vv := range priceInfo {
|
||||
if vv.VipPrice != 0 {
|
||||
thingMap := &model.ThingMap{}
|
||||
sql := `
|
||||
SELECT * FROM thing_map WHERE thing_type = 3 AND deletad_at = '1970-01-01 00:00:00' AND vendor_org_code = 320406 AND vendor_id = 0 AND vendor_thing_id = ?
|
||||
`
|
||||
sqlParams := []interface{}{vv.SkuID}
|
||||
dao.GetRow(db, &thingMap, sql, sqlParams)
|
||||
idLists = append(idLists, &jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int64ToStr(thingMap.ThingID),
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
||||
&jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int64ToStr(thing.ThingID),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), idLists)
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, things)
|
||||
tasksch.HandleTask(task2, nil, true).Run()
|
||||
_, err = task2.GetResult(0)
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
|
||||
Reference in New Issue
Block a user