aa
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -1841,48 +1840,48 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// tasksch.HandleTask(task, nil, true).Run()
|
||||
// task.GetID()
|
||||
//删京东会员价
|
||||
//var (
|
||||
// db = dao.GetDB()
|
||||
//)
|
||||
//storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||
//things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||
//thingIDmap := make(map[int64]string)
|
||||
//thingIDmap2 := make(map[string]int)
|
||||
//for _, v := range things {
|
||||
// if v.VendorThingID != "" {
|
||||
// thingIDmap[v.ThingID] = v.VendorThingID
|
||||
// thingIDmap2[v.VendorThingID] = int(v.ThingID)
|
||||
// }
|
||||
//}
|
||||
//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)
|
||||
// storeSkus, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, nil)
|
||||
// FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []*model.StoreSkuBind) (result interface{}, successCount int, err error) {
|
||||
// api := jd.GetAPI("320406")
|
||||
// var ids []int64
|
||||
// for _, v := range batchedStoreSkuList {
|
||||
// ids = append(ids, utils.Str2Int64(thingIDmap[int64(v.SkuID)]))
|
||||
// }
|
||||
// priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, ids)
|
||||
// var list []*jdapi.SkuIdEntity
|
||||
// for _, vv := range priceInfo {
|
||||
// if vv.VipPrice != 0 {
|
||||
// list = append(list, &jdapi.SkuIdEntity{
|
||||
// OutSkuId: utils.Int2Str(thingIDmap2[utils.Int64ToStr(vv.SkuID)]),
|
||||
// })
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// if len(list) > 0 {
|
||||
// err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||
// }
|
||||
// return result, 0, err
|
||||
// }, ctx, task, storeSkus, 50, true)
|
||||
// return retVal, err
|
||||
// }, storeMaps)
|
||||
//tasksch.HandleTask(task, nil, true).Run()
|
||||
//_, err = task.GetResult(0)
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, []int{6092260, 27007, 6043692, 27008, 27009}, []string{"320406"})
|
||||
thingIDmap := make(map[int64]string)
|
||||
thingIDmap2 := make(map[string]int)
|
||||
for _, v := range things {
|
||||
if v.VendorThingID != "" {
|
||||
thingIDmap[v.ThingID] = v.VendorThingID
|
||||
thingIDmap2[v.VendorThingID] = int(v.ThingID)
|
||||
}
|
||||
}
|
||||
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)
|
||||
storeSkus, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, nil)
|
||||
FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []*model.StoreSkuBind) (result interface{}, successCount int, err error) {
|
||||
api := jd.GetAPI("320406")
|
||||
var ids []int64
|
||||
for _, v := range batchedStoreSkuList {
|
||||
ids = append(ids, utils.Str2Int64(thingIDmap[int64(v.SkuID)]))
|
||||
}
|
||||
priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, ids)
|
||||
var list []*jdapi.SkuIdEntity
|
||||
for _, vv := range priceInfo {
|
||||
if vv.VipPrice != 0 {
|
||||
list = append(list, &jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int2Str(thingIDmap2[utils.Int64ToStr(vv.SkuID)]),
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
if len(list) > 0 {
|
||||
err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||
}
|
||||
return result, 0, err
|
||||
}, ctx, task, storeSkus, 50, true)
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
_, err = task.GetResult(0)
|
||||
//京东账号更新
|
||||
// var (
|
||||
// db = dao.GetDB()
|
||||
@@ -1929,12 +1928,12 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// }
|
||||
//}
|
||||
//report.RefreshJDMembers(ctx)
|
||||
weixinmsg.SmartMessageTemplateSend("oYN_uskdlApt6sv5Y4m_t62iO0f4", weixinmsg.WX_AFS_ORDER_WAIT4APPROVE_TEMPLATE_ID,
|
||||
globals.WxBackstageHost+fmt.Sprintf("%s%d", weixinmsg.WX_TO_ORDER_PAGE_URL, 667092),
|
||||
weixinmsg.WX_MINI_TO_ORDER_PAGE_URL+fmt.Sprintf("?data=%v", `{
|
||||
"address": "甬旺农贸市场蔬菜摊","cityName":"苏州市","id":100002,"name":"斜塘顺达广场店","payeeName":"李川川","status":1,"tel1":"13812641804","tel2":""
|
||||
}`),
|
||||
map[string]interface{}{"1123": 1})
|
||||
//weixinmsg.SmartMessageTemplateSend("oYN_uskdlApt6sv5Y4m_t62iO0f4", weixinmsg.WX_AFS_ORDER_WAIT4APPROVE_TEMPLATE_ID,
|
||||
// globals.WxBackstageHost+fmt.Sprintf("%s%d", weixinmsg.WX_TO_ORDER_PAGE_URL, 667092),
|
||||
// weixinmsg.WX_MINI_TO_ORDER_PAGE_URL+fmt.Sprintf("?data=%v", `{
|
||||
// "address": "甬旺农贸市场蔬菜摊","cityName":"苏州市","id":100002,"name":"斜塘顺达广场店","payeeName":"李川川","status":1,"tel1":"13812641804","tel2":""
|
||||
// }`),
|
||||
// map[string]interface{}{"1123": 1})
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user