From 2ab1434719852346aec7a62e3a220ee014c678a8 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 17 Nov 2023 10:01:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_order.go | 2 +- db/db_order_count.go | 10 +++++----- db/db_order_sum.go | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/db_order.go b/db/db_order.go index f3f7000..a6df4c0 100644 --- a/db/db_order.go +++ b/db/db_order.go @@ -102,7 +102,7 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta if strings.Contains(serializeStr, "0") { types = "create_at" } - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", types, stime, types, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", types, stime, types, etime) total, _ = Db.Where("uid = ? AND ? and settle_at=0", uid, sqlStr).In("state", state).Sum(&model.OrdList{}, "paid_price") total1, _ := Db.Where("uid = ? AND ? and settle_at>0", uid, sqlStr).Sum(&model.OrdList{}, "paid_price") total2, _ := Db.Where("uid = ? AND created_at > ? AND created_at < ? and state=?", uid, stime, etime, 1).Sum(&model.PrivilegeCardOrd{}, "paid_price") diff --git a/db/db_order_count.go b/db/db_order_count.go index ce0c2ba..b06e885 100644 --- a/db/db_order_count.go +++ b/db/db_order_count.go @@ -38,7 +38,7 @@ func OrderListCountByUIDByOrderTypeByTimeNew(Db *xorm.Engine, uid interface{}, t sess1 = sess1.And(sqlStr) sqlStr2 := fmt.Sprintf(" %s > %d AND %s < %d", timeType2, stime.Unix(), timeType2, etime.Unix()) sess2 = sess2.And(sqlStr2) - sqlStr4 := fmt.Sprintf(" %s > %s AND %s < %s", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) + sqlStr4 := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) sess4 = sess4.And(sqlStr4) } if task.OrdState == 3 { @@ -78,7 +78,7 @@ func MallOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevel etime := t.Format("2006-01-02 15:04:05") sess := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 { @@ -114,7 +114,7 @@ func O2oOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelU etime := t.Format("2006-01-02 15:04:05") sess := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 { @@ -131,7 +131,7 @@ func O2oOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelU } sess1 := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType1, stime, timeType1, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType1, stime, timeType1, etime) sess1.And(sqlStr) } if task.OrdState == 3 { @@ -161,7 +161,7 @@ func B2cOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelU etime := t.Format("2006-01-02 15:04:05") sess := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 { diff --git a/db/db_order_sum.go b/db/db_order_sum.go index 13b0e9d..42b3b85 100644 --- a/db/db_order_sum.go +++ b/db/db_order_sum.go @@ -35,7 +35,7 @@ func OrderListSumByUIDByOrderTypeByTimeNew(Db *xorm.Engine, uid interface{}, tas if task.WithinDays > 0 { sqlStr := fmt.Sprintf(" %s > %d AND %s < %d", timeType, stime.Unix(), timeType, etime.Unix()) sqlStr2 := fmt.Sprintf(" %s > %d AND %s < %d", timeType2, stime.Unix(), timeType2, etime.Unix()) - sqlStr4 := fmt.Sprintf(" %s > %s AND %s < %s", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) + sqlStr4 := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) sess.And(sqlStr) sess1.And(sqlStr) sess2.And(sqlStr2) @@ -77,7 +77,7 @@ func MallOrdWithSumNew(Db *xorm.Engine, uid interface{}, orderType int, task *mo sess.And("order_type=?", orderType) } if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s > '%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 { @@ -113,7 +113,7 @@ func O2oOrdWithSumNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpg etime := t.Format("2006-01-02 15:04:05") sess := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 { @@ -130,7 +130,7 @@ func O2oOrdWithSumNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpg } sess1 := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType1, stime, timeType1, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType1, stime, timeType1, etime) sess.And(sqlStr) } if task.OrdState == 3 { @@ -160,7 +160,7 @@ func B2cOrdWithSumNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpg etime := t.Format("2006-01-02 15:04:05") sess := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime) + sqlStr := fmt.Sprintf(" %s >'%s' AND %s < '%s'", timeType, stime, timeType, etime) sess.And(sqlStr) } if task.OrdState == 3 {