修改商户端用户商户登录,进店错误"
This commit is contained in:
@@ -511,38 +511,48 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
briefLevel := int(utils.ForceInterface2Int64(params["briefLevel"]))
|
||||
//权限
|
||||
if permission.IsRoled(ctx) {
|
||||
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||
var storeIDs2 []int
|
||||
if params["storeIDs"] != nil {
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||
for _, v := range storeIDs {
|
||||
if storeIDsMap[v] != 0 {
|
||||
// 查询用户门店
|
||||
configs, _ := dao.QueryConfigs(dao.GetDB(), "checkversion", model.ConfigTypeSys, "")
|
||||
storeIdInterface, _, err := GetMyStoreListNew(ctx, configs[0].Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
storeIDsMap := storeIdInterface.([]map[string]interface{})
|
||||
var storeIDs2 []int
|
||||
if params["storeIDs"] != nil {
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||
for _, v := range storeIDs {
|
||||
for _, s := range storeIDsMap {
|
||||
if s["id"].(int) != 0 && s["id"].(int) == v {
|
||||
storeIDs2 = append(storeIDs2, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(storeIDs2) == 0 {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
} else {
|
||||
if params["storeID"] != nil {
|
||||
intStoreId := int(utils.Interface2Int64WithDefault(params["storeID"], 0))
|
||||
for _, v := range storeIDsMap {
|
||||
if v["id"].(int) == intStoreId && intStoreId != 0 {
|
||||
storeIDs2 = append(storeIDs2, intStoreId)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if params["storeID"] != nil {
|
||||
if storeIDsMap[int(utils.Interface2Int64WithDefault(params["storeID"], 0))] == 0 {
|
||||
params["storeID"] = nil
|
||||
}
|
||||
} else {
|
||||
if len(storeIDsMap) > 0 {
|
||||
for k, _ := range storeIDsMap {
|
||||
storeIDs2 = append(storeIDs2, k)
|
||||
}
|
||||
} else {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
if len(storeIDsMap) > 0 {
|
||||
for _, v := range storeIDsMap {
|
||||
storeIDs2 = append(storeIDs2, v["id"].(int))
|
||||
}
|
||||
}
|
||||
}
|
||||
if data, err := json.Marshal(storeIDs2); err == nil {
|
||||
params["storeIDs"] = string(data)
|
||||
}
|
||||
}
|
||||
if len(storeIDs2) == 0 {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
|
||||
if data, err := json.Marshal(storeIDs2); err == nil {
|
||||
params["storeIDs"] = string(data)
|
||||
}
|
||||
}
|
||||
sql, sqlParams, _, _, err := getStoresSql(ctx, keyword, params, orderTimeFrom, orderTimeTo)
|
||||
@@ -4735,7 +4745,7 @@ func RefreshPageStore() {
|
||||
|
||||
func QueryPageStores2(db *dao.DaoDB, pageSize, offset int, keyword, vendorStoreID, brandName string, vendorID, cityCode, districtCode int, tel string,
|
||||
minShopScore float32, minRecentOrderNum, minSkuCount int, lng1, lat1, lng2, lat2 float64, cat string) (pagedInfo *model.PagedInfo, err error) {
|
||||
// db.Db = orm.NewOrmUsingDB("c4beta")
|
||||
// db.Db = orm.NewOrmUsingDB("c4beta")
|
||||
sqlJD := `
|
||||
SELECT name, 0 vendor_id, wmpoiid vendor_store_id, orgcode org_code, 1 vendor_status, address, phone tel1, pj shop_score, month_sales_tip recent_order_num,
|
||||
bak_info city_name, goods_number sku_count, lat, lng, district_name, brand_name, third_category category, shipping_time
|
||||
|
||||
@@ -1255,12 +1255,6 @@ func GetUserStoreAuth(ctx *jxcontext.Context, storeID int) (outStoreID int, err
|
||||
}
|
||||
return storeID, nil
|
||||
}
|
||||
//storeMap, _ := permission.GetUserStoresResultMap(ctx.GetUserID())
|
||||
//if storeMap[storeID] != 0 {
|
||||
// return storeID, err
|
||||
//} else {
|
||||
// return 0, err
|
||||
//}
|
||||
}
|
||||
return storeID, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user