查询高价格商品修改
This commit is contained in:
@@ -228,7 +228,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func GetStoreSkus(ctx *jxcontext.Context, storeID int, skuIDs []int, isFocus bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
func GetStoreSkus(ctx *jxcontext.Context, storeID int, skuIDs []int, isFocus bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
||||||
return GetStoresSkus(ctx, []int{storeID}, skuIDs, isFocus, keyword, isBySku, isAct, params, offset, pageSize)
|
return GetStoresSkus(ctx, []int{storeID}, skuIDs, isFocus, false, keyword, isBySku, isAct, params, offset, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool, keyword string, isBySku, isAct, isHighPrice bool, actVendorID int, params map[string]interface{}) (sql string, sqlParams []interface{}, err error) {
|
func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool, keyword string, isBySku, isAct, isHighPrice bool, actVendorID int, params map[string]interface{}) (sql string, sqlParams []interface{}, err error) {
|
||||||
@@ -431,11 +431,11 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
|
|||||||
return sql, sqlParams, err
|
return sql, sqlParams, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, isHighPrice bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
||||||
return GetStoresSkusNew(ctx, storeIDs, skuIDs, isFocus, keyword, isBySku, isAct, params, offset, pageSize)
|
return GetStoresSkusNew(ctx, storeIDs, skuIDs, isFocus, isHighPrice, keyword, isBySku, isAct, params, offset, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, isHighPrice bool, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
||||||
if !isFocus && !isBySku && (len(storeIDs) > 1 || len(storeIDs) == 0) {
|
if !isFocus && !isBySku && (len(storeIDs) > 1 || len(storeIDs) == 0) {
|
||||||
return nil, fmt.Errorf("未关注按SkuName只能查询单店")
|
return nil, fmt.Errorf("未关注按SkuName只能查询单店")
|
||||||
}
|
}
|
||||||
@@ -446,10 +446,6 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
|
|||||||
if params["actVendorID"] != nil {
|
if params["actVendorID"] != nil {
|
||||||
actVendorID = int(utils.Interface2Int64WithDefault(params["actVendorID"], -1))
|
actVendorID = int(utils.Interface2Int64WithDefault(params["actVendorID"], -1))
|
||||||
}
|
}
|
||||||
isHighPrice := false
|
|
||||||
if params["isHighPrice"] != nil {
|
|
||||||
isHighPrice = params["isHighPrice"].(bool)
|
|
||||||
}
|
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
sql, sqlParams, err := getGetStoresSkusBaseSQL(db, storeIDs, skuIDs, isFocus, keyword, isBySku, isAct, isHighPrice, actVendorID, params)
|
sql, sqlParams, err := getGetStoresSkusBaseSQL(db, storeIDs, skuIDs, isFocus, keyword, isBySku, isAct, isHighPrice, actVendorID, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -530,9 +526,6 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo
|
|||||||
t4.status_sale_begin, t4.status_sale_end,
|
t4.status_sale_begin, t4.status_sale_end,
|
||||||
t6.mid_unit_price real_mid_unit_price
|
t6.mid_unit_price real_mid_unit_price
|
||||||
` + sql
|
` + sql
|
||||||
if isHighPrice {
|
|
||||||
sql += " , t4.unit_price DESC"
|
|
||||||
}
|
|
||||||
var tmpList []*tGetStoresSkusInfo
|
var tmpList []*tGetStoresSkusInfo
|
||||||
beginTime := time.Now()
|
beginTime := time.Now()
|
||||||
if err = dao.GetRows(db, &tmpList, sql, sqlParams...); err != nil {
|
if err = dao.GetRows(db, &tmpList, sql, sqlParams...); err != nil {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ func (c *StoreSkuController) GetStoresSkus() {
|
|||||||
c.callGetStoresSkus(func(params *tStoreSkuGetStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
c.callGetStoresSkus(func(params *tStoreSkuGetStoresSkusParams) (retVal interface{}, errCode string, err error) {
|
||||||
var storeIDs, skuIDs []int
|
var storeIDs, skuIDs []int
|
||||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err == nil {
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err == nil {
|
||||||
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, params.IsFocus, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, params.IsFocus, params.IsHighPrice, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user