StoreExt的StoreMaps与CourierMaps从map数组改为struct数组
This commit is contained in:
@@ -55,15 +55,17 @@ type StoreExt struct {
|
||||
FloatLng float64 `json:"lng"`
|
||||
FloatLat float64 `json:"lat"`
|
||||
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
StoreMapStr string `json:"-"`
|
||||
CourierMapStr string `json:"-"`
|
||||
PayeeBankName string `json:"payeeBankName"` // 开户行名称
|
||||
StoreMaps []map[string]interface{} `orm:"-"`
|
||||
CourierMaps []map[string]interface{} `orm:"-"`
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
StoreMapStr string `json:"-"`
|
||||
CourierMapStr string `json:"-"`
|
||||
PayeeBankName string `json:"payeeBankName"` // 开户行名称
|
||||
// StoreMaps []map[string]interface{} `orm:"-"`
|
||||
// CourierMaps []map[string]interface{} `orm:"-"`
|
||||
StoreMaps []*model.StoreMap `json:"StoreMaps"`
|
||||
CourierMaps []*model.StoreCourierMap `json:"CourierMaps"`
|
||||
|
||||
OrderCount int `json:"orderCount"`
|
||||
}
|
||||
@@ -404,10 +406,10 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
|
||||
v.Licence2Image = ""
|
||||
}
|
||||
for _, v2 := range storeMapMap[v.ID] {
|
||||
v.StoreMaps = append(v.StoreMaps, utils.Struct2FlatMap(v2))
|
||||
v.StoreMaps = append(v.StoreMaps, v2)
|
||||
}
|
||||
for _, v2 := range storeCourierMap[v.ID] {
|
||||
v.CourierMaps = append(v.CourierMaps, utils.Struct2FlatMap(v2))
|
||||
v.CourierMaps = append(v.CourierMaps, v2)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -277,10 +277,10 @@ func GetFilterStoreList(storeList []*StoreExt, vendorMap, storeIDMap map[int]boo
|
||||
}
|
||||
}
|
||||
if storeInfo.StoreMaps != nil {
|
||||
var tempStoreMaps []map[string]interface{}
|
||||
var tempStoreMaps []*model.StoreMap
|
||||
for _, vendorStoreInfo := range storeInfo.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorStoreInfo["vendorID"]))
|
||||
isSyncStoreSku := int(utils.MustInterface2Int64(vendorStoreInfo["isSync"]))
|
||||
vendorID := vendorStoreInfo.VendorID
|
||||
isSyncStoreSku := int(vendorStoreInfo.IsSync)
|
||||
if isSyncStoreSku == 0 {
|
||||
continue
|
||||
}
|
||||
@@ -549,7 +549,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
var filterJxSkuInfoMapSingle map[int]*dao.StoreSkuNameExt
|
||||
var filterJxSkuInfoMapMulti map[int]*dao.StoreSkuNameExt
|
||||
for _, vendorListValue := range jxStoreInfoListValue.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorListValue["vendorID"]))
|
||||
vendorID := vendorListValue.VendorID
|
||||
var flag = false
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
if flag == false {
|
||||
@@ -565,14 +565,13 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
}
|
||||
}
|
||||
|
||||
vendorStoreID := utils.Interface2String(vendorListValue["vendorStoreID"])
|
||||
vendorStoreID := vendorListValue.VendorStoreID
|
||||
baseapi.SugarLogger.Debugf("CheckSkuDiffBetweenJxAndVendor storeID:%d vendorID:%d vendorStoreID:%s vendorListValue:%v", storeID, vendorID, vendorStoreID, vendorListValue)
|
||||
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||
allSkuInfoList := GetMultiStoreAllSkuInfoList(vendorID)
|
||||
// TODO vendorOrgCode
|
||||
skuBareInfoList, err := singleStoreHandler.GetStoreSkusBareInfo(ctx, "", task, storeID, vendorStoreID, allSkuInfoList)
|
||||
skuBareInfoList, err := singleStoreHandler.GetStoreSkusBareInfo(ctx, vendorListValue.VendorOrgCode, task, storeID, vendorStoreID, allSkuInfoList)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Infof("CheckSkuDiffBetweenJxAndVendor GetStoreSkusBareInfo error:%v", err)
|
||||
} else if len(skuBareInfoList) > 0 {
|
||||
|
||||
@@ -181,7 +181,7 @@ func GetFilterStoreList(storeList []*cms.StoreExt, vendorMap, storeIDMap map[int
|
||||
}
|
||||
}
|
||||
for _, vendorStoreInfo := range storeInfo.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorStoreInfo["vendorID"]))
|
||||
vendorID := vendorStoreInfo.VendorID
|
||||
//filter for vendorID
|
||||
if len(vendorMap) > 0 {
|
||||
if _, ok := vendorMap[vendorID]; !ok {
|
||||
@@ -193,7 +193,7 @@ func GetFilterStoreList(storeList []*cms.StoreExt, vendorMap, storeIDMap map[int
|
||||
}
|
||||
temp := *storeInfo
|
||||
newStoreInfo := &temp
|
||||
newStoreInfo.StoreMaps = []map[string]interface{}{vendorStoreInfo}
|
||||
newStoreInfo.StoreMaps = []*model.StoreMap{vendorStoreInfo}
|
||||
outStoreList = append(outStoreList, newStoreInfo)
|
||||
}
|
||||
}
|
||||
@@ -224,9 +224,9 @@ func StartOrEndOpStoreEx(ctx *jxcontext.Context, isStart bool, startTime, endTim
|
||||
storeListValue := batchItemList[0].(*cms.StoreExt)
|
||||
storeID := storeListValue.ID
|
||||
for _, vendorListValue := range storeListValue.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorListValue["vendorID"]))
|
||||
startOpStoreTime := int16(utils.MustInterface2Int64(vendorListValue["fakeOpenStart"]))
|
||||
endOpStoreTime := int16(utils.MustInterface2Int64(vendorListValue["fakeOpenStop"]))
|
||||
vendorID := vendorListValue.VendorID
|
||||
startOpStoreTime := vendorListValue.FakeOpenStart
|
||||
endOpStoreTime := vendorListValue.FakeOpenStop
|
||||
//startOpStoreTime, endOpStoreTime := GetOpStoreTime(vendorID)
|
||||
if startTime != 0 && endTime != 0 {
|
||||
startOpStoreTime = startTime
|
||||
@@ -236,7 +236,7 @@ func StartOrEndOpStoreEx(ctx *jxcontext.Context, isStart bool, startTime, endTim
|
||||
if isStart && (startOpStoreTime == 0 || endOpStoreTime == 0) {
|
||||
continue
|
||||
}
|
||||
vendorStoreID := utils.Interface2String(vendorListValue["vendorStoreID"])
|
||||
vendorStoreID := vendorListValue.VendorStoreID
|
||||
baseapi.SugarLogger.Debugf("StartOrEndOpStore storeID:%d vendorID:%d vendorStoreID:%s", storeID, vendorID, vendorStoreID)
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
storeSkuNameList, err := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, nil)
|
||||
@@ -341,8 +341,8 @@ func InitEx() {
|
||||
if err == nil {
|
||||
for _, storeInfo := range storeList {
|
||||
for _, vendorStoreInfo := range storeInfo.StoreMaps {
|
||||
startOpStoreTime := int16(utils.MustInterface2Int64(vendorStoreInfo["fakeOpenStart"]))
|
||||
endOpStoreTime := int16(utils.MustInterface2Int64(vendorStoreInfo["fakeOpenStop"]))
|
||||
startOpStoreTime := vendorStoreInfo.FakeOpenStart
|
||||
endOpStoreTime := vendorStoreInfo.FakeOpenStop
|
||||
if startOpStoreTime == 0 || endOpStoreTime == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -263,8 +263,8 @@ func ScoreStoreOpenTime(storeInfo *cms.StoreExt) {
|
||||
finalScore := 0
|
||||
if isStoreOpen {
|
||||
for _, storeMap := range storeInfo.StoreMaps {
|
||||
isSyncStoreSku := int(utils.MustInterface2Int64(storeMap["isSync"]))
|
||||
vendorStoreStatus := int(utils.MustInterface2Int64(storeMap["status"]))
|
||||
isSyncStoreSku := storeMap.IsSync
|
||||
vendorStoreStatus := storeMap.Status
|
||||
isVendorStoreOpen := vendorStoreStatus == model.StoreStatusOpened
|
||||
opTimeList := storeInfo.GetOpTimeList()
|
||||
if len(opTimeList) > 0 && isStoreOpen && isVendorStoreOpen && isSyncStoreSku != 0 {
|
||||
@@ -428,8 +428,8 @@ func ScoreFullVendor(storeInfo *cms.StoreExt) {
|
||||
isStoreOpen := storeStatus == model.StoreStatusOpened
|
||||
count := 0
|
||||
for _, storeMap := range storeInfo.StoreMaps {
|
||||
isSyncStoreSku := int(utils.MustInterface2Int64(storeMap["isSync"]))
|
||||
vendorStoreStatus := int(utils.MustInterface2Int64(storeMap["status"]))
|
||||
isSyncStoreSku := storeMap.IsSync
|
||||
vendorStoreStatus := storeMap.Status
|
||||
isVendorStoreOpen := vendorStoreStatus == model.StoreStatusOpened
|
||||
opTimeList := storeInfo.GetOpTimeList()
|
||||
if len(opTimeList) > 0 && isStoreOpen && isVendorStoreOpen && isSyncStoreSku != 0 {
|
||||
@@ -569,9 +569,9 @@ func GetFilterStoreListEx(storeList []*cms.StoreExt, storeIDMap map[int]int) (ou
|
||||
continue
|
||||
}
|
||||
}
|
||||
var tempStoreMaps []map[string]interface{}
|
||||
var tempStoreMaps []*model.StoreMap
|
||||
for _, vendorStoreInfo := range storeInfo.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorStoreInfo["vendorID"]))
|
||||
vendorID := vendorStoreInfo.VendorID
|
||||
if _, ok := fullVendorList[vendorID]; !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user