This commit is contained in:
苏尹岚
2021-03-10 17:25:59 +08:00
parent 8859a41bdf
commit a76e30bc35
3 changed files with 49 additions and 24 deletions

View File

@@ -1607,3 +1607,40 @@ func GetUserCoupons(db *DaoDB, couponIDs []int, userIDs, mobiles []string, userS
err = GetRows(db, &userCoupons, sql, sqlParams)
return userCoupons, err
}
type QueryOrdersForManageStateResult struct {
VendorOrderID string `orm:"column(vendor_order_id)"`
BindID int `orm:"column(bind_id)"`
}
func QueryOrdersForManageState(db *DaoDB, storeID, vendorID, status int, fromTime, toTime time.Time) (userCoupons []*QueryOrdersForManageStateResult, err error) {
sql := `
SELECT a.vendor_order_id ,b.id bind_id
FROM goods_order a
LEFT JOIN waybill b ON a.vendor_order_id = b.vendor_order_id
WHERE 1 = 1
`
sqlParams := []interface{}{}
if storeID != 0 {
sql += " AND (a.storeID = ? OR a.jx_store_id = ?)"
sqlParams = append(sqlParams, storeID, storeID)
}
if vendorID != -1 {
sql += " AND a.vendor_id = ?"
sqlParams = append(sqlParams, vendorID)
}
if status != 0 {
sql += " AND a.status = ?"
sqlParams = append(sqlParams, status)
}
if !utils.IsTimeZero(fromTime) {
sql += " AND a.order_created_at > ?"
sqlParams = append(sqlParams, fromTime)
}
if !utils.IsTimeZero(toTime) {
sql += " AND a.order_created_at < ?"
sqlParams = append(sqlParams, toTime)
}
err = GetRows(db, &userCoupons, sql, sqlParams)
return userCoupons, err
}

View File

@@ -769,7 +769,7 @@ func GetDataResFieldName(vendorID int) (fieldName string) {
// return fieldName
// }
func GetStoresSkusInfo(db *DaoDB, storeIDs, skuIDs []int, status int) (storeSkuList []*model.StoreSkuBind, err error) {
func GetStoresSkusInfo(db *DaoDB, storeIDs, skuIDs []int) (storeSkuList []*model.StoreSkuBind, err error) {
sql := `
SELECT *
FROM store_sku_bind t1