修正minimumPrice\highestPrice查询

This commit is contained in:
平凡梦
2020-07-08 17:05:29 +08:00
parent 4bbfe12171
commit f8670a5820

View File

@@ -464,6 +464,8 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
sql += " AND t4.unit_price >= ? "
sqlParams = append(sqlParams, params["minimumPrice"])
}
globals.SugarLogger.Debug("params的值打印位置4")
globals.SugarLogger.Debug(sql)
return sql, sqlParams, err
}
@@ -472,8 +474,6 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, isHi
}
func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, isHighPrice bool, priceType int, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
globals.SugarLogger.Debug("params的值打印位置")
globals.SugarLogger.Debug(params)
if !isFocus && !isBySku && (len(storeIDs) > 1 || len(storeIDs) == 0) {
return nil, fmt.Errorf("未关注按SkuName只能查询单店")
}
@@ -484,6 +484,8 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
if params["actVendorID"] != nil {
actVendorID = int(utils.Interface2Int64WithDefault(params["actVendorID"], -1))
}
globals.SugarLogger.Debug("params的值打印位置")
globals.SugarLogger.Debug(params)
var highestPrice, minimumPrice float64
if params["highestPrice"] != nil {
if _, ok := params["highestPrice"].(float64); !ok {
@@ -492,6 +494,8 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
highestPrice = params["highestPrice"].(float64)
}
}
globals.SugarLogger.Debug("params的值打印位置1")
globals.SugarLogger.Debug(params)
if params["minimumPrice"] != nil {
if _, ok := params["minimumPrice"].(float64); !ok {
delete(params, "minimumPrice")
@@ -499,12 +503,16 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
minimumPrice = params["minimumPrice"].(float64)
}
}
globals.SugarLogger.Debug("params的值打印位置2")
globals.SugarLogger.Debug(params)
if !(highestPrice > 0 && highestPrice > minimumPrice) || !(highestPrice > 0) {
delete(params, "highestPrice")
}
if !(minimumPrice >= 0 && highestPrice > 0 && highestPrice > minimumPrice) || !(minimumPrice >= 0) {
delete(params, "minimumPrice")
}
globals.SugarLogger.Debug("params的值打印位置3")
globals.SugarLogger.Debug(params)
db := dao.GetDB()
sql, sqlParams, err := getGetStoresSkusBaseSQL(db, storeIDs, skuIDs, isFocus, keyword, isBySku, isAct, isHighPrice, priceType, actVendorID, params)
if err != nil {