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

This commit is contained in:
苏尹岚
2019-11-07 08:50:53 +08:00
19 changed files with 291 additions and 235 deletions

View File

@@ -252,7 +252,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
if params["storeID"] != nil || params["storeIDs"] != nil {
var storeIDs []int
if params["storeIDs"] != nil {
if err = jxutils.Strings2Objs(utils.Interface2String("storeIDs"), &storeIDs); err != nil {
if err = jxutils.Strings2Objs(utils.Interface2String(params["storeIDs"]), &storeIDs); err != nil {
return "", nil, "", nil, err
}
}
@@ -311,7 +311,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
return sql, sqlParams, sqlFrom, sqlFromParams, nil
}
func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresInfo, storeIDs []int) (err error) {
func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresInfo, storeIDs []int, briefLevel int) (err error) {
storeMapList, err := dao.GetStoresMapList(db, nil, storeIDs, model.StoreStatusAll, model.StoreIsSyncAll, "")
if err != nil {
return err
@@ -331,6 +331,9 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
}
for _, v := range storesInfo.Stores {
if briefLevel > 0 {
v.DeliveryRange = ""
}
for _, v2 := range storeMapMap[v.ID] {
v.StoreMaps = append(v.StoreMaps, utils.Struct2FlatMap(v2))
}
@@ -343,6 +346,7 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
// todo 门店绑定信息可以考虑以数组形式返回,而不是现在这样
func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interface{}, offset, pageSize int, orderTimeFrom, orderTimeTo time.Time, orderCountFrom, orderCountTo int) (retVal *StoresInfo, err error) {
briefLevel := int(utils.ForceInterface2Int64(params["briefLevel"]))
sql, sqlParams, _, _, err := getStoresSql(ctx, keyword, params, orderTimeFrom, orderTimeTo)
if err != nil {
@@ -448,7 +452,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
}
if len(retVal.Stores) > 0 {
setStoreMapInfo(ctx, db, retVal, storeIDs)
setStoreMapInfo(ctx, db, retVal, storeIDs, briefLevel)
retVal.MapCenterLng, retVal.MapCenterLat = getMapCenter(retVal.Stores)
}
return retVal, err
@@ -1511,7 +1515,7 @@ func GetStoresVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, v
task := tasksch.NewParallelTask("GetStoresVendorSnapshot", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeMap := batchItemList[0].(*model.StoreMap)
if storeMap.VendorID != model.VendorIDWSC {
if model.IsVendorRemote(storeMap.VendorID) {
if handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID); handler != nil {
store, err2 := handler.ReadStore(ctx, storeMap.VendorStoreID)
if err = err2; err == nil {