This commit is contained in:
gazebo
2019-12-02 14:23:14 +08:00
parent dc881a2acc
commit 351551bfe1
2 changed files with 12 additions and 5 deletions

View File

@@ -923,15 +923,22 @@ func GetMyOrderCountInfo(db *DaoDB, userID string, fromDate, toDate time.Time, s
if utils.IsTimeZero(fromDate) {
return nil, fmt.Errorf("必须指定开始日期")
}
if utils.IsTimeZero(toDate) {
toDate = fromDate
if !utils.IsTimeZero(fromDate) {
fromDate = utils.Time2Date(fromDate)
if utils.IsTimeZero(toDate) {
toDate = fromDate
}
}
if !utils.IsTimeZero(toDate) {
toDate = utils.Time2Date(toDate)
toDate = toDate.Add(24 * time.Hour)
}
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 <= ?
AND t1.order_created_at >= ? AND t1.order_created_at < ?
`
sqlParams := []interface{}{
userID,