- GetStoreSkus, fromStatus and toStatus only valid when isFoucs is true.

This commit is contained in:
gazebo
2018-09-30 09:35:32 +08:00
parent 3e336b1f33
commit dfa39b8a04

View File

@@ -50,7 +50,7 @@ type tStoreSkuBindAndSpec struct {
RealSkuID int `orm:"column(real_sku_id)"`
}
func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
func GetStoreSkus(storeID int, isFocus bool, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
db := dao.GetDB()
sql := `
FROM sku_name t1
@@ -60,7 +60,7 @@ func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string
LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code
WHERE t1.deleted_at = '1970-01-01 00:00:00' AND (t1.is_global = 1 OR t5.id IS NOT NULL OR t4.status = ?)
`
if isFocused {
if isFocus {
sql += " AND t4.sku_id IS NOT NULL"
} else {
sql += " AND t4.sku_id IS NULL"
@@ -127,7 +127,7 @@ func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string
sqlParams = append(sqlParams, skuIDs)
}
}
if params["fromStatus"] != nil {
if isFocus && params["fromStatus"] != nil {
fromStatus := params["fromStatus"].(int)
toStatus := fromStatus
if params["toStatus"] != nil {