@@ -13,15 +13,15 @@ import (
// 累计自购数
// 累计自购数
func OwnBuyTotal(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func OwnBuyTotal(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location()).Unix()
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location()).Unix()
etime := t.Unix()
etime := t.Unix()
//联盟结算后的
//联盟结算后的
total, err := db.OrderListCountByUIDByOrderTypeByTime(engine, uid, 0, "1,2,3,5", stime, etime)
total, err := db.OrderListCountByUIDByOrderTypeByTime(engine, uid, 0, []string{ "1" , " 2" , " 3" , " 5"} , stime, etime)
if err != nil {
if err != nil {
zhios_condition_statistics_logx.Warn(err)
zhios_condition_statistics_logx.Warn(err)
return ""
return ""
}
}
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location())
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location())
mallEtime := t
mallEtime := t
//确认收货的才算
//确认收货的才算
mallTotal, err := db.MallOrdByTimeWithCount(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
mallTotal, err := db.MallOrdByTimeWithCount(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
@@ -36,10 +36,10 @@ func OwnBuyTotal(engine *xorm.Engine, uid interface{}, task map[string]string, t
// 累计已结算佣金
// 累计已结算佣金
func SettleOrderSum(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func SettleOrderSum(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location()).Unix()
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location()).Unix()
etime := t.Unix()
etime := t.Unix()
// 用户分佣的订单
// 用户分佣的订单
idAmountMap, err := db.OrderRelateListByTimeByState(engine, uid, "1,2,3,5", stime, etime)
idAmountMap, err := db.OrderRelateListByTimeByState(engine, uid, []string{ "1" , " 2" , " 3" , " 5"} , stime, etime)
if err != nil {
if err != nil {
zhios_condition_statistics_logx.Warn(err)
zhios_condition_statistics_logx.Warn(err)
return ""
return ""
@@ -48,7 +48,7 @@ func SettleOrderSum(engine *xorm.Engine, uid interface{}, task map[string]string
for _, item := range *idAmountMap {
for _, item := range *idAmountMap {
sum += item
sum += item
}
}
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location())
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location())
mallEtime := t
mallEtime := t
_, mallSum, err := db.MallOrderRelateListByTimeByState(engine, uid, 3, mallStime, mallEtime)
_, mallSum, err := db.MallOrderRelateListByTimeByState(engine, uid, 3, mallStime, mallEtime)
if err != nil {
if err != nil {
@@ -62,8 +62,8 @@ func SettleOrderSum(engine *xorm.Engine, uid interface{}, task map[string]string
func ExtendCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func ExtendCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
// 累计直推人数
// 累计直推人数
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0, 0, 0, 0, t.Location()).Format("2006-0 1-02 15:04:05")
etime := t.Format("2006-0 1-02 15:04:05")
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006- 1-02 15:04:05")
etime := t.Format("2006-1-02 15:04:05")
sqlTpl := `SELECT count(*) as count
sqlTpl := `SELECT count(*) as count
FROM user_profile as up
FROM user_profile as up
LEFT JOIN user as u ON u.uid=up.uid
LEFT JOIN user as u ON u.uid=up.uid
@@ -84,8 +84,8 @@ func ExtendCount(engine *xorm.Engine, uid interface{}, task map[string]string, t
func TeamCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func TeamCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
// 累计团队有效直推人数
// 累计团队有效直推人数
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0, 0, 0, 0, t.Location()).Format("2006-0 1-02 15:04:05")
etime := t.Format("2006-0 1-02 15:04:05")
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006- 1-02 15:04:05")
etime := t.Format("2006-1-02 15:04:05")
sqlTpl := `SELECT count(*) as count
sqlTpl := `SELECT count(*) as count
FROM user_profile as up
FROM user_profile as up
LEFT JOIN user as u ON u.uid=up.uid
LEFT JOIN user as u ON u.uid=up.uid
@@ -108,8 +108,8 @@ func TeamCount(engine *xorm.Engine, uid interface{}, task map[string]string, t t
func TeamByLvCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func TeamByLvCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0, 0, 0, 0, t.Location()).Format("2006-0 1-02 15:04:05")
etime := t.Format("2006-0 1-02 15:04:05")
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006- 1-02 15:04:05")
etime := t.Format("2006-1-02 15:04:05")
sqlTpl := `SELECT count(*) as count
sqlTpl := `SELECT count(*) as count
FROM user_relate as ur
FROM user_relate as ur
LEFT JOIN user as u ON u.uid=ur.uid
LEFT JOIN user as u ON u.uid=ur.uid
@@ -132,8 +132,8 @@ func TeamByLvCount(engine *xorm.Engine, uid interface{}, task map[string]string,
func ExtendByLvCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
func ExtendByLvCount(engine *xorm.Engine, uid interface{}, task map[string]string, t time.Time) string {
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0, 0, 0, 0, t.Location()).Format("2006-0 1-02 15:04:05")
etime := t.Format("2006-0 1-02 15:04:05")
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006- 1-02 15:04:05")
etime := t.Format("2006-1-02 15:04:05")
sqlTpl := `SELECT count(*) as count
sqlTpl := `SELECT count(*) as count
FROM user_relate as ur
FROM user_relate as ur
@@ -159,16 +159,16 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t
var total float64 = 0
var total float64 = 0
var err error
var err error
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "1"}) {
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "1"}) {
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location()).Unix()
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location()).Unix()
etime := t.Unix()
etime := t.Unix()
total, err = db.OrderListPaidPriceByUIDByOrderTypeByTime(engine, uid, 0, "1,2,3,5", stime, etime)
total, err = db.OrderListPaidPriceByUIDByOrderTypeByTime(engine, uid, 0, []string{ "1" , " 2" , " 3" , " 5"} , stime, etime)
if err != nil {
if err != nil {
zhios_condition_statistics_logx.Warn(err)
zhios_condition_statistics_logx.Warn(err)
return ""
return ""
}
}
}
}
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "2", "8", "9"}) {
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "2", "8", "9"}) {
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location())
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location())
mallEtime := t
mallEtime := t
orderType := 0
orderType := 0
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"8", "9"}) {
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"8", "9"}) {
@@ -183,7 +183,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t
total += mallTotal
total += mallTotal
}
}
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "3"}) {
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "3"}) {
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location())
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location())
mallEtime := t
mallEtime := t
//确认收货的才算
//确认收货的才算
o2oTotal, err := db.O2oOrdByTime(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
o2oTotal, err := db.O2oOrdByTime(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
@@ -200,7 +200,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t
total += o2oTotal1
total += o2oTotal1
}
}
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "4"}) {
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "4"}) {
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), 0 , 0, 0, 0, t.Location())
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour() , 0, 0, 0, t.Location())
mallEtime := t
mallEtime := t
//确认收货的才算
//确认收货的才算
b2cTotal, err := db.B2cOrdByTime(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
b2cTotal, err := db.B2cOrdByTime(engine, uid, 0, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))