+GetMyOrderCountInfo
This commit is contained in:
@@ -918,3 +918,31 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat
|
||||
}
|
||||
return orders, totalCount, err
|
||||
}
|
||||
|
||||
func GetMyOrderCountInfo(db *DaoDB, userID string, fromDate, toDate time.Time, statuss []int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
if utils.IsTimeZero(fromDate) {
|
||||
return nil, fmt.Errorf("必须指定开始日期")
|
||||
}
|
||||
if utils.IsTimeZero(toDate) {
|
||||
toDate = fromDate
|
||||
}
|
||||
|
||||
sql := `
|
||||
SELECT t1.lock_status, t1.status, COUNT(*) count
|
||||
FROM goods_order t1
|
||||
WHERE t1.user_id = ? AND t1.vendor_id = ?
|
||||
AND t1.order_created_at >= ? AND t1.order_created_at <= ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
userID,
|
||||
model.VendorIDJX,
|
||||
fromDate, toDate,
|
||||
}
|
||||
if len(statuss) > 0 {
|
||||
sql += " AND t1.status IN (" + GenQuestionMarks(len(statuss)) + ")"
|
||||
sqlParams = append(sqlParams, statuss)
|
||||
}
|
||||
sql += " GROUP BY 1,2"
|
||||
err = GetRows(db, &countInfo, sql, sqlParams...)
|
||||
return countInfo, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user