diff --git a/db/db_mall_order.go b/db/db_mall_order.go index c06fba1..208cd06 100644 --- a/db/db_mall_order.go +++ b/db/db_mall_order.go @@ -9,7 +9,7 @@ import ( ) 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(total) if err != nil { @@ -40,7 +40,7 @@ func MallOrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, en fmt.Println("============test佣金数=================") 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 { zhios_condition_statistics_logx.Error(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) { - 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 { 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 total, nil -} \ No newline at end of file +} diff --git a/db/db_order.go b/db/db_order.go index ecd6106..401be1b 100644 --- a/db/db_order.go +++ b/db/db_order.go @@ -14,9 +14,9 @@ func OrderListCountByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, state, zhios_condition_statistics_utils.AnyToString(uid), buyType, state, stime, etime) fmt.Println("============test订单数=================") 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) @@ -45,7 +45,7 @@ func OrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, endTim fmt.Println("============test佣金数=================") 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 { zhios_condition_statistics_logx.Error(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) fmt.Println("============test订单数=================") 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) return total + total1 + total2, nil