aa
This commit is contained in:
@@ -1481,3 +1481,21 @@ func GetPriceDefendOrder(db *DaoDB, vendorOrderID string, storeIDs, skuIDs, issu
|
||||
err = GetRows(db, &priceDefendOrders, sql, sqlParams)
|
||||
return priceDefendOrders, err
|
||||
}
|
||||
|
||||
func GetCoupons(db *DaoDB, couponType int, keyword string) (coupons []*model.Coupons, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM coupons
|
||||
WHERE deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
if couponType != 0 {
|
||||
sql += " AND coupon_type = ?"
|
||||
sqlParams = append(sqlParams, couponType)
|
||||
}
|
||||
if keyword != "" {
|
||||
sql += " AND (name LIKE ? OR desc LIKE ?)"
|
||||
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%")
|
||||
}
|
||||
return coupons, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user