Merge remote-tracking branch 'origin/mark' into su
This commit is contained in:
@@ -146,10 +146,6 @@ type IPurchasePlatformHandler interface {
|
||||
GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error)
|
||||
UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error)
|
||||
|
||||
// SyncStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error)
|
||||
// // !!!注意,此操作会先清除门店已有的商品,一般用于初始化,小心使用
|
||||
// FullSyncStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync, isContinueWhenError bool) (hint string, err error)
|
||||
|
||||
RefreshAllStoresID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error)
|
||||
|
||||
UploadImg(ctx *jxcontext.Context, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error)
|
||||
|
||||
@@ -26,6 +26,22 @@ func getAPI(appOrgCode string) (apiObj *jdapi.API) {
|
||||
return partner.CurAPIManager.GetAPI(model.VendorIDJD, appOrgCode).(*jdapi.API)
|
||||
}
|
||||
|
||||
func GetAPIByToken(token string) (apiObj *jdapi.API) {
|
||||
if token == "" {
|
||||
apiObj = getAPI("")
|
||||
} else {
|
||||
apiList := partner.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD)
|
||||
for _, v := range apiList {
|
||||
jdAPI := partner.CurAPIManager.GetAPI(model.VendorIDJD, v).(*jdapi.API)
|
||||
if jdAPI.GetToken() == token {
|
||||
apiObj = jdAPI
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return apiObj
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetVendorID() int {
|
||||
return model.VendorIDJD
|
||||
}
|
||||
|
||||
@@ -207,24 +207,6 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
return err
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
func (p *PurchaseHandler) GetAllStoresFromRemote() ([]*model.Store, error) {
|
||||
ids, err := p.GetAllStoresVendorID(jxcontext.AdminCtx)
|
||||
if err == nil {
|
||||
retVal := make([]*model.Store, len(ids))
|
||||
for index, id := range ids {
|
||||
store, err2 := p.ReadStore(jxcontext.AdminCtx, id)
|
||||
if err2 == nil {
|
||||
retVal[index] = &store.Store
|
||||
} else {
|
||||
return nil, err2
|
||||
}
|
||||
}
|
||||
return retVal, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("jd RefreshAllStoresID")
|
||||
const stepCount = 3
|
||||
@@ -274,34 +256,6 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
||||
return rootTask.ID, err
|
||||
}
|
||||
|
||||
// func JdRange2JxRange(jdRanges string) (jxRanges string) {
|
||||
// coords := strings.Split(jdRanges, ";")
|
||||
// intCoords := []string{}
|
||||
// for _, coord := range coords {
|
||||
// items := strings.Split(coord, ",")
|
||||
// if len(items) == 2 {
|
||||
// lng := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[0]))
|
||||
// lat := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[1]))
|
||||
// intCoords = append(intCoords, fmt.Sprintf("%d,%d", lng, lat))
|
||||
// }
|
||||
// }
|
||||
// return strings.Join(intCoords, ";")
|
||||
// }
|
||||
|
||||
// func JxRange2JdRange(jxRanges string) (jdRanges string) {
|
||||
// coords := strings.Split(jxRanges, ";")
|
||||
// intCoords := []string{}
|
||||
// for _, coord := range coords {
|
||||
// items := strings.Split(coord, ",")
|
||||
// if len(items) == 2 {
|
||||
// lng := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[0])))
|
||||
// lat := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[1])))
|
||||
// intCoords = append(intCoords, fmt.Sprintf("%f,%f", lng, lat))
|
||||
// }
|
||||
// }
|
||||
// return strings.Join(intCoords, ";")
|
||||
// }
|
||||
|
||||
func JdDeliveryType2Jx(deliveryType int) int8 {
|
||||
if deliveryType == jdapi.CarrierNoSelfDelivery {
|
||||
return scheduler.StoreDeliveryTypeByStore
|
||||
|
||||
@@ -215,17 +215,3 @@ func (p *PurchaseHandler) SyncStoreProducts(ctx *jxcontext.Context, parentTask t
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
// func (p *PurchaseHandler) ReorderStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, vendorCatID string, storeSkuList []*partner.StoreSkuInfo) (err error) {
|
||||
// storeSkuCount := len(storeSkuList)
|
||||
// if storeSkuCount > 0 {
|
||||
// if storeSkuCount > jdapi.MaxAddByStoreAndSkusCount {
|
||||
// storeSkuList = storeSkuList[:jdapi.MaxAddByStoreAndSkusCount]
|
||||
// }
|
||||
// vendorSkuIDs := partner.BareStoreSkuInfoList(storeSkuList).GetVendorSkuIDIntList()
|
||||
// if globals.EnableJdStoreWrite {
|
||||
// err = getAPI("").AddByStoreAndSkus(utils.Str2Int64(vendorStoreID), vendorSkuIDs)
|
||||
// }
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
|
||||
@@ -57,6 +57,7 @@ func pay4OrderByWX(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
}
|
||||
|
||||
func OnWxPayCallback(msg *wxpay.CallbackMsg) (err error) {
|
||||
globals.SugarLogger.Debugf("OnWxPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||
switch msg.MsgType {
|
||||
case wxpay.MsgTypePay:
|
||||
err = onWxpayFinished(msg.Data.(*wxpay.PayResultMsg))
|
||||
@@ -88,6 +89,8 @@ func onWxpayFinished(msg *wxpay.PayResultMsg) (err error) {
|
||||
if msg.ResultCode == wxpay.ResponseCodeSuccess {
|
||||
err = OnPayFinished(orderPay)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("onWxpayFinished msg:%s, err:%v", utils.Format4Output(msg, true), err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -64,7 +64,9 @@ func callbackMsg2Status(msg *CallbackMsg) *model.OrderStatus {
|
||||
func onOrderNew(msg *CallbackMsg, subMsgType int, order *Data4Neworder) (retVal, errCode string, err error) {
|
||||
globals.SugarLogger.Debugf("onOrderNew orderID:%s", msg.ThingID)
|
||||
order.StoreID = int(utils.Str2Int64WithDefault(order.VendorStoreID, 0))
|
||||
order.DeliveryType = model.OrderDeliveryTypeStoreSelf
|
||||
if order.DeliveryType == "" {
|
||||
order.DeliveryType = model.OrderDeliveryTypeStoreSelf
|
||||
}
|
||||
order.GoodsOrder.Skus = order.Skus
|
||||
order.VendorID = model.VendorIDJX
|
||||
order.Flag = model.OrderFlagMaskTempJX
|
||||
|
||||
Reference in New Issue
Block a user