huangjiajun 1 рік тому
джерело
коміт
6ffb27eaee
2 змінених файлів з 20 додано та 18 видалено
  1. +12
    -10
      db/db_order_count.go
  2. +8
    -8
      db/db_order_sum.go

+ 12
- 10
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")


+ 8
- 8
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")


Завантаження…
Відмінити
Зберегти