Selaa lähdekoodia

过滤下架产品

kobe6258 4 kuukautta sitten
vanhempi
commit
578722ebc6
1 muutettua tiedostoa jossa 4 lisäystä ja 17 poistoa
  1. 4 17
      models/merchant/merchant_product.go

+ 4 - 17
models/merchant/merchant_product.go

@@ -53,7 +53,7 @@ func (MerchantProduct) TableName() string {
 
 func GetMerchantProductById(id int) (product MerchantProduct, err error) {
 	db := models.Main()
-	err = db.Select(detailColumns).Where("id = ?", id).First(&product).Error
+	err = db.Select(detailColumns).Where("id = ? ", id).First(&product).Error
 	return
 }
 
@@ -61,12 +61,12 @@ func GetMerchantProductBySourceId(sourceId int, productType ...MerchantProductTy
 	db := models.Main()
 	if len(productType) > 0 {
 		if len(productType) == 1 {
-			err = db.Select(detailColumns).Where("source_id =? and type = ? and deleted =?", sourceId, productType[0], false).First(&product).Error
+			err = db.Select(detailColumns).Where("source_id =? and type = ? and deleted =?", sourceId, productType[0], 0).First(&product).Error
 		} else {
-			err = db.Select(detailColumns).Where("source_id =? and type in (?) and deleted =?", sourceId, productType, false).First(&product).Error
+			err = db.Select(detailColumns).Where("source_id =? and type in (?) and deleted =?", sourceId, productType, 0).First(&product).Error
 		}
 	} else {
-		err = db.Select(detailColumns).Where("source_id =? and deleted =?", sourceId, false).First(&product).Error
+		err = db.Select(detailColumns).Where("source_id =? and deleted =?", sourceId, 0).First(&product).Error
 	}
 
 	return
@@ -126,19 +126,6 @@ func GetProductListByProductType(productType MerchantProductType, detail bool) (
 	err = db.Select(columns).Where(" type = ? and deleted =? order by created_time desc", productType, false).Find(&list).Error
 	return
 }
-func CountProductList(isSignal bool) (total, latestId int64, ids []int) {
-	db := models.Main()
-	var condition string
-	if isSignal {
-		condition = "type !=?"
-	} else {
-		condition = "type =?"
-	}
-	_ = db.Select("count(*)").Where(" ? and deleted =? order by id desc ", condition, Package, false).Scan(&total).Error
-	_ = db.Select("max(id)").Where(" ? and deleted =? order by id desc ", condition, Package, false).Scan(&total).Error
-	_ = db.Select("id").Where(" ? and deleted =? order by id desc ", condition, Package, false).Scan(&ids).Error
-	return
-}
 
 type MerchantProductIdMap struct {
 	Type     string