!!!门店相关的API全部添加vendorOrgCode依赖
This commit is contained in:
@@ -562,9 +562,9 @@ func getMapCenter(storeList []*StoreExt) (lng, lat float64) {
|
||||
return getMapCenter(newStoreList)
|
||||
}
|
||||
|
||||
func GetVendorStore(ctx *jxcontext.Context, vendorStoreID string, vendorID int) (retVal *StoreExt, err error) {
|
||||
func GetVendorStore(ctx *jxcontext.Context, vendorID int, vendorOrgCode, vendorStoreID string) (retVal *StoreExt, err error) {
|
||||
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
||||
result, err2 := handler.ReadStore(ctx, vendorStoreID)
|
||||
result, err2 := handler.ReadStore(ctx, vendorOrgCode, vendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
retVal = &StoreExt{
|
||||
Store: result.Store,
|
||||
@@ -961,7 +961,7 @@ func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vend
|
||||
}
|
||||
|
||||
// todo 需要对字段做有效性检查
|
||||
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
|
||||
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vendorOrgCode string, storeID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
|
||||
if storeID == 0 {
|
||||
return nil, fmt.Errorf("storeID不能为0")
|
||||
}
|
||||
@@ -970,7 +970,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
||||
}
|
||||
userName := ctx.GetUserName()
|
||||
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
||||
store, err2 := handler.ReadStore(ctx, storeMap.VendorStoreID)
|
||||
store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID)
|
||||
if err = err2; err == nil || storeMap.IsSync == 0 {
|
||||
dao.WrapAddIDCULDEntity(storeMap, userName)
|
||||
storeMap.StoreID = storeID
|
||||
@@ -1020,7 +1020,7 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
storeMap.DeletedAt = utils.DefaultTimeValue
|
||||
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err == nil {
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(vendorID); handler != nil {
|
||||
handler.UpdateStoreCustomID(ctx, storeMap.VendorStoreID, utils.Str2Int64WithDefault(storeMap.VendorStoreID, 0))
|
||||
handler.UpdateStoreCustomID(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID, utils.Str2Int64WithDefault(storeMap.VendorStoreID, 0))
|
||||
}
|
||||
num, err = dao.DeleteEntityLogically(db, storeMap, map[string]interface{}{
|
||||
model.FieldStatus: model.StoreStatusDisabled,
|
||||
@@ -1076,7 +1076,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
}
|
||||
|
||||
if vendorStoreID := utils.Interface2String(valid["vendorStoreID"]); vendorStoreID != "" {
|
||||
vendorStoreInfo, err2 := storeHandler.ReadStore(ctx, vendorStoreID)
|
||||
vendorStoreInfo, err2 := storeHandler.ReadStore(ctx, storeMap.VendorOrgCode, vendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
valid["deliveryType"] = vendorStoreInfo.DeliveryType
|
||||
}
|
||||
@@ -1591,7 +1591,7 @@ func GetStoresVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, v
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
if model.IsVendorRemote(storeMap.VendorID) {
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID); handler != nil {
|
||||
store, err2 := handler.ReadStore(ctx, storeMap.VendorStoreID)
|
||||
store, err2 := handler.ReadStore(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
retVal = []interface{}{&model.VendorStoreSnapshot{
|
||||
StoreID: storeMap.StoreID,
|
||||
@@ -1664,7 +1664,7 @@ func updateVendorStoreStatusBySnapshot(db *dao.DaoDB, curSnapshotList []*model.V
|
||||
if snapshot := snapshotMap[jxutils.Combine2Int(v.StoreID, v.VendorID)]; snapshot != nil {
|
||||
if snapshot.IsAutoOrder == 1 {
|
||||
if handler, ok := partner.GetPurchasePlatformFromVendorID(snapshot.VendorID).(partner.IStoreHandler); ok {
|
||||
handler.EnableAutoAcceptOrder(jxcontext.AdminCtx, v.StoreID, v.VendorStoreID, false)
|
||||
handler.EnableAutoAcceptOrder(jxcontext.AdminCtx, v.VendorOrgCode, v.StoreID, v.VendorStoreID, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2296,7 +2296,7 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
||||
case 0:
|
||||
for _, vendorID := range vendorIDList {
|
||||
iStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
||||
storeIDs, err := iStoreHandler.GetAllStoresVendorID(ctx)
|
||||
storeIDs, err := iStoreHandler.GetAllStoresVendorID(ctx, "") // TODO
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -2305,13 +2305,13 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
||||
storeID := batchItemList[0].(string)
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
multiHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IMultipleStoresHandler)
|
||||
storeDetail, err = multiHandler.ReadStore(ctx, storeID)
|
||||
storeDetail, err = multiHandler.ReadStore(ctx, "", storeID)
|
||||
if err != nil {
|
||||
return retVal, err
|
||||
}
|
||||
} else {
|
||||
singleHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreHandler)
|
||||
storeDetail, err = singleHandler.ReadStore(ctx, storeID)
|
||||
storeDetail, err = singleHandler.ReadStore(ctx, "", storeID)
|
||||
if err != nil {
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func OpenRemoteStoreByJxStatus(ctx *jxcontext.Context, vendorIDs, storeIDs []int
|
||||
if handler, _ := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID).(partner.IStoreHandler); handler != nil {
|
||||
storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID)
|
||||
if err == nil && storeDetail.Status == model.StoreStatusOpened {
|
||||
if err = handler.UpdateStoreStatus(ctx, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil {
|
||||
if err = handler.UpdateStoreStatus(ctx, storeMap.VendorOrgCode, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil {
|
||||
storeMap.Status = model.StoreStatusOpened
|
||||
dao.UpdateEntity(db, storeMap, model.FieldStatus)
|
||||
retVal = []int{1}
|
||||
|
||||
Reference in New Issue
Block a user