|
|
@@ -5,6 +5,7 @@ import ( |
|
|
|
zhios_condition_statistics_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/utils" |
|
|
|
zhios_condition_statistics_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git/utils/logx" |
|
|
|
"fmt" |
|
|
|
"time" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -25,10 +26,11 @@ func OrderListCountByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, state, |
|
|
|
total1, _ := Db.Where("uid = ? AND confirm_at > ? AND confirm_at < ? and settle_at>0", uid, stime, etime).Count(&model.OrdList{}) |
|
|
|
total3, _ := Db.Where("uid = ? AND settle_at > ? AND settle_at < ? and confirm_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{}) |
|
|
|
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"), "已付款").Count(&model.RechargeOrder{}) |
|
|
|
|
|
|
|
fmt.Println(total) |
|
|
|
|
|
|
|
return total + total1 + total2 + total3, nil |
|
|
|
return total + total1 + total2 + total3 + total4, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 查询用户某时间段内某状态的佣金(ord_id => amount) |
|
|
@@ -84,9 +86,11 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta |
|
|
|
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 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") |
|
|
|
|
|
|
|
fmt.Println(total) |
|
|
|
|
|
|
|
return total + total1 + total2, nil |
|
|
|
return total + total1 + total2 + total4, nil |
|
|
|
} |
|
|
|
|
|
|
|
// OrderListCountByUIDByOrderTypeByTime is 查询订单 by uid by time ,获取规定时间内的订单类型的订单数 |
|
|
@@ -104,10 +108,11 @@ func OrderListCountByUIDByOrderType(Db *xorm.Engine, uid, buyType, state interfa |
|
|
|
total1, _ := Db.Where("uid = ? and settle_at>0", uid).Count(&model.OrdList{}) |
|
|
|
total3, _ := Db.Where("uid = ? and confirm_at=0", uid).Count(&model.OrdList{}) |
|
|
|
total2, _ := Db.Where("uid = ? and state=?", uid, 1).Count(&model.PrivilegeCardOrd{}) |
|
|
|
total4, _ := Db.Where("uid = ? and status=?", uid, "已付款").Count(&model.RechargeOrder{}) |
|
|
|
|
|
|
|
fmt.Println(total) |
|
|
|
|
|
|
|
return total + total1 + total2 + total3, nil |
|
|
|
return total + total1 + total2 + total3 + total4, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 查询用户某时间段内某状态的佣金(ord_id => amount) |
|
|
@@ -163,7 +168,9 @@ func OrderListPaidPriceByUIDByOrderType(Db *xorm.Engine, uid, buyType, state int |
|
|
|
total, _ := Db.Where("uid = ? and settle_at=0", uid).In("state", state).Sum(&model.OrdList{}, "paid_price") |
|
|
|
total1, _ := Db.Where("uid = ? and settle_at>0", uid).Sum(&model.OrdList{}, "paid_price") |
|
|
|
total2, _ := Db.Where("uid = ? and state=?", uid, 1).Sum(&model.PrivilegeCardOrd{}, "paid_price") |
|
|
|
total4, _ := Db.Where("uid = ? and status=?", uid, "已付款").Sum(&model.RechargeOrder{}, "amount") |
|
|
|
|
|
|
|
fmt.Println(total) |
|
|
|
|
|
|
|
return total + total1 + total2, nil |
|
|
|
return total + total1 + total2 + total4, nil |
|
|
|
} |