aa
This commit is contained in:
@@ -1840,64 +1840,48 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// tasksch.HandleTask(task, nil, true).Run()
|
||||
// task.GetID()
|
||||
//删京东会员价
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
//vendorThingIDs []int64
|
||||
// result3 []int
|
||||
)
|
||||
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 != "" {
|
||||
//vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(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)
|
||||
// result1, _ :=
|
||||
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)]),
|
||||
})
|
||||
// result = []bool{true}
|
||||
// return result, 0, err
|
||||
}
|
||||
}
|
||||
if len(list) > 0 {
|
||||
err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||
}
|
||||
return result, 0, err
|
||||
}, ctx, task, storeSkus, 50, true)
|
||||
// for _, v := range result1 {
|
||||
// if v.(bool) {
|
||||
// retVal = []int{storeMap.StoreID}
|
||||
// return retVal, err
|
||||
// }
|
||||
// }
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
_, err = task.GetResult(0)
|
||||
//for _, v := range result2 {
|
||||
// result3 = append(result3, v.(int))
|
||||
//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)
|
||||
// }
|
||||
//}
|
||||
//fmt.Println("result3", result3)
|
||||
//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()
|
||||
@@ -1914,21 +1898,22 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// }
|
||||
// }
|
||||
//刷新京东真实订单号
|
||||
//var (
|
||||
// db = dao.GetDB()
|
||||
// goods []*model.GoodsOrder
|
||||
//)
|
||||
//sql := `
|
||||
// SELECT * FROM goods_order WHERE vendor_id = 0 and consignee_mobile2 = '' and order_created_at > '2021-04-13' and vendor_org_code = '339032'
|
||||
//`
|
||||
//dao.GetRows(db, &goods, sql, nil)
|
||||
//for _, v := range goods {
|
||||
// mobile, _ := api.JdAPI.GetRealMobile4Order(v.VendorOrderID, v.VendorStoreID)
|
||||
// if v.ConsigneeMobile2 == "" {
|
||||
// v.ConsigneeMobile2 = mobile
|
||||
// dao.UpdateEntity(db, v, "ConsigneeMobile2")
|
||||
// }
|
||||
//}
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
goods []*model.GoodsOrder
|
||||
)
|
||||
sql := `
|
||||
SELECT * FROM goods_order WHERE vendor_id = 0 and consignee_mobile2 = '' and order_created_at > '2021-04-13' and vendor_org_code = '339032'
|
||||
`
|
||||
dao.GetRows(db, &goods, sql, nil)
|
||||
for _, v := range goods {
|
||||
mobile, _ := api.JdAPI.GetRealMobile4Order(v.VendorOrderID, v.VendorStoreID)
|
||||
if v.ConsigneeMobile2 == "" {
|
||||
v.ConsigneeMobile2 = mobile
|
||||
dao.UpdateEntity(db, v, "ConsigneeMobile2")
|
||||
}
|
||||
}
|
||||
//补商品
|
||||
//order, _ := partner.CurOrderManager.LoadOrder("2113480902000652", model.VendorIDJD)
|
||||
//handler := partner.GetPurchaseOrderHandlerFromVendorID(model.VendorIDJD)
|
||||
//order2, _ := handler.GetOrder(order.VendorOrgCode, order.VendorOrderID, "")
|
||||
|
||||
@@ -94,9 +94,7 @@ func (c *PurchaseHandler) onOrderMsg(a *jdapi.API, msg *jdapi.CallbackOrderMsg)
|
||||
if jdapi.StatusIDNewOrder == msg.StatusID {
|
||||
status.Status = model.OrderStatusNew // 因为京东将事件32000与状态32000混用,事件32000可能是新订单,也可能是已接单,统一当成新订单处理
|
||||
}
|
||||
globals.SugarLogger.Debugf("jd deliverOrder 4 %v", utils.Format4Output(msg, true))
|
||||
if partner.CurOrderManager.GetStatusDuplicatedCount(status) > 0 {
|
||||
globals.SugarLogger.Debugf("jd deliverOrder 5 %d", partner.CurOrderManager.GetStatusDuplicatedCount(status))
|
||||
return nil
|
||||
}
|
||||
if msg.MsgURL == jdapi.CallbackMsgOrderAccounting {
|
||||
@@ -124,7 +122,6 @@ func (c *PurchaseHandler) onOrderMsg(a *jdapi.API, msg *jdapi.CallbackOrderMsg)
|
||||
// globals.SugarLogger.Warnf("京东取消拣货:%v", err2)
|
||||
// }
|
||||
// }
|
||||
globals.SugarLogger.Debugf("OnOrderStatusChanged jd %s", AppKey2OrgCode(msg.AppKey))
|
||||
globals.SugarLogger.Debug("OnOrderStatusChanged jd %v", utils.Format4Output(status, true))
|
||||
err := partner.CurOrderManager.OnOrderStatusChanged(AppKey2OrgCode(msg.AppKey), status)
|
||||
retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus)
|
||||
@@ -205,7 +202,8 @@ func (c *PurchaseHandler) getOrder(a *jdapi.API, orderID string) (order *model.G
|
||||
if err == nil {
|
||||
order = c.Map2Order(orderMap)
|
||||
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||
a.SetJdCookie(configs[0].Value)
|
||||
//a.SetJdCookie(configs[0].Value)
|
||||
a.SetCookieWithStr(configs[0].Value)
|
||||
}
|
||||
realMobile, err = a.GetRealMobile4Order(orderID, order.VendorStoreID)
|
||||
if err == nil && realMobile != "" {
|
||||
|
||||
Reference in New Issue
Block a user