diff --git a/db/db_order_count.go b/db/db_order_count.go index 4e20a77..3ea6695 100644 --- a/db/db_order_count.go +++ b/db/db_order_count.go @@ -33,10 +33,10 @@ func OrderListCountByUIDByOrderTypeByTimeNew(Db *xorm.Engine, uid interface{}, t sess2 := Db.Where("uid = ?", uid) sess4 := Db.Where("uid = ?", uid) if task.WithinDays > 0 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime.Unix(), etime.Unix()) - sess1.And(" ? > ? AND ? < ?", timeType, timeType, stime.Unix(), etime.Unix()) - sess2.And(" ? > ? AND ? < ?", timeType2, timeType2, stime.Unix(), etime.Unix()) - sess4.And(" ? > ? AND ? < ?", timeType4, timeType4, stime.Format("2006-01-02 15:04:05"), etime.Format("2006-01-02 15:04:05")) + sess.And(" ? > ? AND ? < ?", timeType, stime.Unix(), timeType, etime.Unix()) + sess1.And(" ? > ? AND ? < ?", timeType, stime.Unix(), timeType, etime.Unix()) + sess2.And(" ? > ? AND ? < ?", timeType2, stime.Unix(), timeType2, etime.Unix()) + sess4.And(" ? > ? AND ? < ?", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) } if task.OrdState == 3 { sess2.And("settle_at>0") @@ -44,8 +44,10 @@ func OrderListCountByUIDByOrderTypeByTimeNew(Db *xorm.Engine, uid interface{}, t } if task.OrdState != 3 { total, _ = sess.In("state", state).Count(&model.OrdList{}) - total3, _ := Db.Where("uid = ? AND settle_at > ? AND settle_at < ? and confirm_at=0", uid, stime, etime).Count(&model.OrdList{}) - total += total3 + if task.OrdState != 1 { + total3, _ := Db.Where("uid = ? AND settle_at > ? AND settle_at < ? and confirm_at=0", uid, stime, etime).Count(&model.OrdList{}) + total += total3 + } } total1, _ := sess1.Count(&model.OrdList{}) total2, _ := sess2.Where("state=?", uid, 1).Count(&model.PrivilegeCardOrd{}) @@ -71,7 +73,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 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -106,7 +108,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 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -122,7 +124,7 @@ func O2oOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelU } sess1 := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sess1.And(" ? > ? AND ? < ?", timeType1, timeType1, stime, etime) + sess1.And(" ? > ? AND ? < ?", timeType1, stime, timeType1, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -151,7 +153,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 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") diff --git a/db/db_order_sum.go b/db/db_order_sum.go index 3376e11..47617ea 100644 --- a/db/db_order_sum.go +++ b/db/db_order_sum.go @@ -33,10 +33,10 @@ func OrderListSumByUIDByOrderTypeByTimeNew(Db *xorm.Engine, uid interface{}, tas sess2 := Db.Where("uid = ?", uid) sess4 := Db.Where("uid = ?", uid) if task.WithinDays > 0 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime.Unix(), etime.Unix()) - sess1.And(" ? > ? AND ? < ?", timeType, timeType, stime.Unix(), etime.Unix()) - sess2.And(" ? > ? AND ? < ?", timeType2, timeType2, stime.Unix(), etime.Unix()) - sess4.And(" ? > ? AND ? < ?", timeType4, timeType4, stime.Format("2006-01-02 15:04:05"), etime.Format("2006-01-02 15:04:05")) + sess.And(" ? > ? AND ? < ?", timeType, stime.Unix(), timeType, etime.Unix()) + sess1.And(" ? > ? AND ? < ?", timeType, stime.Unix(), timeType, etime.Unix()) + sess2.And(" ? > ? AND ? < ?", timeType2, stime.Unix(), timeType2, etime.Unix()) + sess4.And(" ? > ? AND ? < ?", timeType4, stime.Format("2006-01-02 15:04:05"), timeType4, etime.Format("2006-01-02 15:04:05")) } if task.OrdState == 3 { sess2.And("settle_at>0") @@ -74,7 +74,7 @@ func MallOrdWithSumNew(Db *xorm.Engine, uid interface{}, orderType int, task *mo sess.And("order_type=?", orderType) } if task.WithinDays > 0 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -109,7 +109,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 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -125,7 +125,7 @@ func O2oOrdWithSumNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpg } sess1 := Db.Where("uid = ? ", uid) if task.WithinDays > 0 { - sess1.And(" ? > ? AND ? < ?", timeType1, timeType1, stime, etime) + sess1.And(" ? > ? AND ? < ?", timeType1, stime, timeType1, etime) } if task.OrdState == 3 { sess.And("settle_time is not null") @@ -154,7 +154,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 { - sess.And(" ? > ? AND ? < ?", timeType, timeType, stime, etime) + sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime) } if task.OrdState == 3 { sess.And("settle_time is not null")