Browse Source

add reverse:for v1.0.8 条件调整

tags/v1.0.8
huangjiajun 2 years ago
parent
commit
a1b20ae03c
2 changed files with 11 additions and 11 deletions
  1. +4
    -4
      db/db_mall_order.go
  2. +7
    -7
      db/db_order.go

+ 4
- 4
db/db_mall_order.go View File

@@ -9,7 +9,7 @@ import (
) )


func MallOrdByTimeWithCount(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (int64, error) { func MallOrdByTimeWithCount(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (int64, error) {
total, err := Db.Where("uid = ? AND state in (?) AND create_time > ? AND create_time < ?", uid, state, stime, etime).Count(&model.MallOrd{})
total, err := Db.Where("uid = ? AND state in (?) AND confirm_time > ? AND confirm_time < ?", uid, state, stime, etime).Count(&model.MallOrd{})
fmt.Println(err) fmt.Println(err)
fmt.Println(total) fmt.Println(total)
if err != nil { if err != nil {
@@ -40,7 +40,7 @@ func MallOrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, en
fmt.Println("============test佣金数=================") fmt.Println("============test佣金数=================")
fmt.Println(str) fmt.Println(str)
// 已结算的订单数据 // 已结算的订单数据
err = Db.In("ord_id", ids).Where("state in (?) AND create_time > ? AND create_time < ?", state, startTime, endTime).Find(&o)
err = Db.In("ord_id", ids).Where("state in (?) AND confirm_time > ? AND confirm_time < ?", state, startTime, endTime).Find(&o)
if err != nil { if err != nil {
zhios_condition_statistics_logx.Error(err) zhios_condition_statistics_logx.Error(err)
return nil, 0, err return nil, 0, err
@@ -65,7 +65,7 @@ func MallOrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, en
} }


func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) {
sess := Db.Where("uid = ? AND state in (?) AND create_time > ? AND create_time < ?", uid, state, stime, etime)
sess := Db.Where("uid = ? AND state in (?) AND confirm_time > ? AND confirm_time < ?", uid, state, stime, etime)
if zhios_condition_statistics_utils.AnyToInt64(buyType) > 0 { if zhios_condition_statistics_utils.AnyToInt64(buyType) > 0 {
sess.And("order_type", buyType) sess.And("order_type", buyType)
} }
@@ -76,4 +76,4 @@ func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{
return 0, zhios_condition_statistics_logx.Error(err) return 0, zhios_condition_statistics_logx.Error(err)
} }
return total, nil return total, nil
}
}

+ 7
- 7
db/db_order.go View File

@@ -14,9 +14,9 @@ func OrderListCountByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, state,
zhios_condition_statistics_utils.AnyToString(uid), buyType, state, stime, etime) zhios_condition_statistics_utils.AnyToString(uid), buyType, state, stime, etime)
fmt.Println("============test订单数=================") fmt.Println("============test订单数=================")
fmt.Println(str) fmt.Println(str)
total, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at=0", uid, stime, etime).In("state", state).Count(&model.OrdList{})
total1, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at>0", uid, stime, etime).Count(&model.OrdList{})
total2, _ := Db.Where("uid = ? AND created_at > ? AND created_at < ? and state=?", uid, stime, etime, 1).Count(&model.PrivilegeCardOrd{})
total, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and settle_at=0", uid, stime, etime).In("state", state).Count(&model.OrdList{})
total1, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and settle_at>0", uid, stime, etime).Count(&model.OrdList{})
total2, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and state=?", uid, stime, etime, 1).Count(&model.PrivilegeCardOrd{})


fmt.Println(total) fmt.Println(total)


@@ -45,7 +45,7 @@ func OrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, endTim
fmt.Println("============test佣金数=================") fmt.Println("============test佣金数=================")
fmt.Println(str) fmt.Println(str)
// 已结算的订单数据 // 已结算的订单数据
err = Db.In("ord_id", ids).In("state", state).Where(" create_at > ? AND create_at < ?", startTime, endTime).Find(&o)
err = Db.In("ord_id", ids).In("state", state).Where(" confirm_at > ? AND confirm_at < ?", startTime, endTime).Find(&o)
if err != nil { if err != nil {
zhios_condition_statistics_logx.Error(err) zhios_condition_statistics_logx.Error(err)
return nil, err return nil, err
@@ -73,9 +73,9 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta
zhios_condition_statistics_utils.AnyToString(uid), buyType, state, stime, etime) zhios_condition_statistics_utils.AnyToString(uid), buyType, state, stime, etime)
fmt.Println("============test订单数=================") fmt.Println("============test订单数=================")
fmt.Println(str) fmt.Println(str)
total, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at=0", uid, stime, etime).In("state", state).Sum(&model.OrdList{}, "paid_price")
total1, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at>0", uid, stime, etime).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")
total, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and settle_at=0", uid, stime, etime).In("state", state).Sum(&model.OrdList{}, "paid_price")
total1, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and settle_at>0", uid, stime, etime).Sum(&model.OrdList{}, "paid_price")
total2, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and state=?", uid, stime, etime, 1).Sum(&model.PrivilegeCardOrd{}, "paid_price")
fmt.Println(total) fmt.Println(total)


return total + total1 + total2, nil return total + total1 + total2, nil


Loading…
Cancel
Save