门店商品管理查询增加低价品
This commit is contained in:
@@ -237,10 +237,10 @@ 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) {
|
||||
return GetStoresSkus(ctx, []int{storeID}, skuIDs, isFocus, false, keyword, isBySku, isAct, params, offset, pageSize)
|
||||
return GetStoresSkus(ctx, []int{storeID}, skuIDs, isFocus, 0, 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 bool, isHighPrice int, actVendorID int, params map[string]interface{}) (sql string, sqlParams []interface{}, err error) {
|
||||
sql = `
|
||||
FROM sku_name t1
|
||||
JOIN sku t2 FORCE INDEX(PRIMARY) ON t1.id = t2.name_id AND t2.deleted_at = ?/* AND t2.status = ?*/
|
||||
@@ -312,8 +312,10 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
|
||||
utils.DefaultTimeValue,
|
||||
utils.Bool2Int(isFocus),
|
||||
})
|
||||
if isHighPrice {
|
||||
if isHighPrice == 1 {
|
||||
sql += " AND t4.unit_price > t6.mid_unit_price / IF(t3.pay_percentage < 50 , 70, t3.pay_percentage) * 1.2 * 100"
|
||||
} else if isHighPrice == -1 {
|
||||
sql += " AND t4.unit_price < t6.mid_unit_price / IF(t3.pay_percentage < 50 , 70, t3.pay_percentage) / 1.2 * 100"
|
||||
}
|
||||
if isFocus {
|
||||
sql += " AND ((t2.status = ? AND t1.status = ?) OR t4.status = ?)"
|
||||
@@ -441,11 +443,11 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
|
||||
return sql, sqlParams, err
|
||||
}
|
||||
|
||||
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) {
|
||||
func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bool, isHighPrice int, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
|
||||
return GetStoresSkusNew(ctx, storeIDs, skuIDs, isFocus, isHighPrice, keyword, isBySku, isAct, params, offset, pageSize)
|
||||
}
|
||||
|
||||
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) {
|
||||
func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bool, isHighPrice int, 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) {
|
||||
return nil, fmt.Errorf("未关注按SkuName只能查询单店")
|
||||
}
|
||||
@@ -535,7 +537,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
|
||||
t4.status_sale_begin, t4.status_sale_end,
|
||||
t6.mid_unit_price real_mid_unit_price
|
||||
` + sql
|
||||
if isHighPrice {
|
||||
if isHighPrice != 0 {
|
||||
sql += " , t4.unit_price DESC LIMIT 99"
|
||||
}
|
||||
var tmpList []*tGetStoresSkusInfo
|
||||
|
||||
@@ -87,7 +87,7 @@ func (c *StoreSkuController) GetStoreSkus() {
|
||||
// @Param ebaiSyncStatus query int false "饿百同步标识"
|
||||
// @Param mtwmSyncStatus query int false "美团外卖同步标识"
|
||||
// @Param lockTime query string false "价格锁定时间"
|
||||
// @Param isHighPrice query bool false "是否查过高价格商品"
|
||||
// @Param isHighPrice query int false "是否查过高价格商品,0是忽略,1是高价,-1是低价"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoresSkus [get,post]
|
||||
|
||||
Reference in New Issue
Block a user