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