Ver a proveniência

更新

master
huangjiajun há 1 ano
ascendente
cometimento
ecfeadd84b
3 ficheiros alterados com 40 adições e 23 eliminações
  1. +3
    -2
      db/db_order.go
  2. +22
    -13
      db/db_order_count.go
  3. +15
    -8
      db/db_order_sum.go

+ 3
- 2
db/db_order.go Ver ficheiro

@@ -102,8 +102,9 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta
if strings.Contains(serializeStr, "0") {
types = "create_at"
}
total, _ = Db.Where("uid = ? AND ? > ? AND ? < ? and settle_at=0", uid, types, stime, types, etime).In("state", state).Sum(&model.OrdList{}, "paid_price")
total1, _ := Db.Where("uid = ? AND ? > ? AND ? < ? and settle_at>0", uid, types, stime, types, etime).Sum(&model.OrdList{}, "paid_price")
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")
total4, _ := Db.Where("uid = ? AND create_time > ? AND create_time < ? and status=?", uid, time.Unix(zhios_condition_statistics_utils.AnyToInt64(stime), 0).Format("2006-01-02 15:04:05"), time.Unix(zhios_condition_statistics_utils.AnyToInt64(etime), 0).Format("2006-01-02 15:04:05"), "已付款").Sum(&model.RechargeOrder{}, "amount")
total = total + total1 + total2 + total4


+ 22
- 13
db/db_order_count.go Ver ficheiro

@@ -33,17 +33,22 @@ 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, 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"))
sqlStr := fmt.Sprintf(" %s > %d AND %s < %d", timeType, stime.Unix(), timeType, etime.Unix())
sess = sess.And(sqlStr)
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"))
sess4 = sess4.And(sqlStr4)
}
if task.OrdState == 3 {
sess2.And("settle_at>0")
sess4.And("settle_at>0")
sess2 = sess2.And("settle_at>0")
sess4 = sess4.And("settle_at>0")
}
var err error
if task.OrdState != 3 {
total, _ = sess.In("state", state).Count(&model.OrdList{})
total, err = sess.In("state", state).Count(&model.OrdList{})
fmt.Println(err)
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
@@ -73,7 +78,8 @@ 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, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
@@ -108,7 +114,8 @@ 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, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
@@ -124,12 +131,13 @@ func O2oOrdWithCountNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelU
}
sess1 := Db.Where("uid = ? ", uid)
if task.WithinDays > 0 {
sess1.And(" ? > ? AND ? < ?", timeType1, stime, timeType1, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType1, stime, timeType1, etime)
sess1.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
sess1.And("settle_time is not null")
} else {
sess.And("state in (?)", "1,4")
sess1.And("state in (?)", "1,4")
}
total1, err1 := sess1.Count(&model.O2oPayToMerchant{})
if err1 != nil {
@@ -153,7 +161,8 @@ 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, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")


+ 15
- 8
db/db_order_sum.go Ver ficheiro

@@ -33,10 +33,13 @@ 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, 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"))
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"))
sess.And(sqlStr)
sess1.And(sqlStr)
sess2.And(sqlStr2)
sess4.And(sqlStr4)
}
if task.OrdState == 3 {
sess2.And("settle_at>0")
@@ -74,7 +77,8 @@ func MallOrdWithSumNew(Db *xorm.Engine, uid interface{}, orderType int, task *mo
sess.And("order_type=?", orderType)
}
if task.WithinDays > 0 {
sess.And(" ? > ? AND ? < ?", timeType, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
@@ -109,7 +113,8 @@ 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, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
@@ -125,7 +130,8 @@ func O2oOrdWithSumNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpg
}
sess1 := Db.Where("uid = ? ", uid)
if task.WithinDays > 0 {
sess1.And(" ? > ? AND ? < ?", timeType1, stime, timeType1, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType1, stime, timeType1, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")
@@ -154,7 +160,8 @@ 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, stime, timeType, etime)
sqlStr := fmt.Sprintf(" %s > %s AND %s < %s", timeType, stime, timeType, etime)
sess.And(sqlStr)
}
if task.OrdState == 3 {
sess.And("settle_time is not null")


Carregando…
Cancelar
Guardar