Merge remote-tracking branch 'origin/mark' into su

This commit is contained in:
苏尹岚
2019-12-04 09:17:27 +08:00
17 changed files with 352 additions and 626 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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
// }