@@ -8,7 +8,7 @@ import ( | |||||
) | ) | ||||
func B2cOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { | func B2cOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { | ||||
total, err := Db.Where("uid = ? AND state in (?) AND create_time > ? AND create_time < ?", uid, state, stime, etime).Sum(&model.B2cOrd{}, "cost_price") | |||||
total, err := Db.Where("uid = ? AND create_time > ? AND create_time < ?", uid, state, stime, etime).In("state", state).Sum(&model.B2cOrd{}, "cost_price") | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -18,7 +18,7 @@ func B2cOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{} | |||||
} | } | ||||
func B2cOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | func B2cOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | ||||
total, err := Db.Where("uid = ? AND state in (?) ", uid, state).Sum(&model.B2cOrd{}, "cost_price") | |||||
total, err := Db.Where("uid = ? ", uid).In("state", state).Sum(&model.B2cOrd{}, "cost_price") | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -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 confirm_time > ? AND confirm_time < ?", uid, state, stime, etime).Count(&model.MallOrd{}) | |||||
total, err := Db.Where("uid = ? AND confirm_time > ? AND confirm_time < ?", uid, stime, etime).In("state", state).Count(&model.MallOrd{}) | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -64,9 +64,9 @@ func MallOrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, en | |||||
return &idAmountMap, sum, nil | return &idAmountMap, sum, nil | ||||
} | } | ||||
func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { | |||||
sess := Db.Where("uid = ? AND state in (?) ", uid, state) | |||||
if state == "1,2,3" { | |||||
func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}, newState string) (float64, error) { | |||||
sess := Db.Where("uid = ? ", uid).In("state", state) | |||||
if newState == "1" { | |||||
sess = sess.And(" create_time > ? AND create_time < ?", stime, etime) | sess = sess.And(" create_time > ? AND create_time < ?", stime, etime) | ||||
} else { | } else { | ||||
sess = sess.And(" confirm_time > ? AND confirm_time < ?", stime, etime) | sess = sess.And(" confirm_time > ? AND confirm_time < ?", stime, etime) | ||||
@@ -84,7 +84,7 @@ func MallOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{ | |||||
} | } | ||||
func MallOrdWithCount(Db *xorm.Engine, uid, buyType, state interface{}) (int64, error) { | func MallOrdWithCount(Db *xorm.Engine, uid, buyType, state interface{}) (int64, error) { | ||||
total, err := Db.Where("uid = ? AND state in (?) ", uid, state).Count(&model.MallOrd{}) | |||||
total, err := Db.Where("uid = ? ", uid).In("state", state).Count(&model.MallOrd{}) | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -140,7 +140,7 @@ func MallOrderRelateListByState(Db *xorm.Engine, uid, state interface{}) (*map[i | |||||
} | } | ||||
func MallOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | func MallOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | ||||
sess := Db.Where("uid = ? AND state in (?) ", uid, state) | |||||
sess := Db.Where("uid = ? ", uid).In("state", state) | |||||
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) | ||||
} | } | ||||
@@ -8,7 +8,7 @@ import ( | |||||
) | ) | ||||
func O2oOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { | func O2oOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (float64, error) { | ||||
total, err := Db.Where("uid = ? AND state in (?) AND create_time > ? AND create_time < ?", uid, state, stime, etime).Sum(&model.O2oOrd{}, "cost_price") | |||||
total, err := Db.Where("uid = ? AND create_time > ? AND create_time < ?", uid, stime, etime).In("state", state).Sum(&model.O2oOrd{}, "cost_price") | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -27,7 +27,7 @@ func O2oOrdPayToMerchantByTime(Db *xorm.Engine, uid, buyType, state, stime, etim | |||||
} | } | ||||
func O2oOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | func O2oOrd(Db *xorm.Engine, uid, buyType, state interface{}) (float64, error) { | ||||
total, err := Db.Where("uid = ? AND state in (?) ", uid, state).Sum(&model.O2oOrd{}, "cost_price") | |||||
total, err := Db.Where("uid = ? ", uid).In("state", state).Sum(&model.O2oOrd{}, "cost_price") | |||||
fmt.Println(err) | fmt.Println(err) | ||||
fmt.Println(total) | fmt.Println(total) | ||||
if err != nil { | if err != nil { | ||||
@@ -24,7 +24,7 @@ func OwnBuyTotal(engine *xorm.Engine, uid interface{}, task map[string]string, t | |||||
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 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, []string{"3"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
if err != nil { | if err != nil { | ||||
zhios_condition_statistics_logx.Warn(err) | zhios_condition_statistics_logx.Warn(err) | ||||
return zhios_condition_statistics_utils.Int64ToStr(total) | return zhios_condition_statistics_utils.Int64ToStr(total) | ||||
@@ -176,7 +176,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t | |||||
orderType = zhios_condition_statistics_utils.StrToInt(task["task_type_pvd"]) | orderType = zhios_condition_statistics_utils.StrToInt(task["task_type_pvd"]) | ||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
mallTotal, err := db.MallOrdByTime(engine, uid, orderType, "3", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
mallTotal, err := db.MallOrdByTime(engine, uid, orderType, []string{"3"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"), "") | |||||
if err != nil { | if err != nil { | ||||
zhios_condition_statistics_logx.Warn(err) | zhios_condition_statistics_logx.Warn(err) | ||||
return zhios_condition_statistics_utils.Float64ToStr(total) | return zhios_condition_statistics_utils.Float64ToStr(total) | ||||
@@ -187,7 +187,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t | |||||
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 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, []string{"3"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
if err != nil { | if err != nil { | ||||
zhios_condition_statistics_logx.Warn(err) | zhios_condition_statistics_logx.Warn(err) | ||||
return zhios_condition_statistics_utils.Float64ToStr(total) | return zhios_condition_statistics_utils.Float64ToStr(total) | ||||
@@ -204,7 +204,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t | |||||
mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 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, []string{"3"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
if err != nil { | if err != nil { | ||||
zhios_condition_statistics_logx.Warn(err) | zhios_condition_statistics_logx.Warn(err) | ||||
return zhios_condition_statistics_utils.Float64ToStr(total) | return zhios_condition_statistics_utils.Float64ToStr(total) | ||||
@@ -356,23 +356,23 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
var err error | var err error | ||||
//联盟结算后的 | //联盟结算后的 | ||||
if task.WithinDays <= 0 { | if task.WithinDays <= 0 { | ||||
total, err = db.OrderListCountByUIDByOrderType(engine, uid, 0, "3,5") | |||||
total, err = db.OrderListCountByUIDByOrderType(engine, uid, 0, []string{"3", "5"}) | |||||
if err != nil { | if err != nil { | ||||
return "", hasPay, payOrdId | return "", hasPay, payOrdId | ||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
mallTotal, err := db.MallOrdWithCount(engine, uid, 0, "3") | |||||
mallTotal, err := db.MallOrdWithCount(engine, uid, 0, []string{"3"}) | |||||
if err != nil { | if err != nil { | ||||
return zhios_condition_statistics_utils.Int64ToStr(total), hasPay, payOrdId | return zhios_condition_statistics_utils.Int64ToStr(total), hasPay, payOrdId | ||||
} | } | ||||
total += mallTotal | total += mallTotal | ||||
} else { | } else { | ||||
total, err = db.OrderListCountByUIDByOrderTypeByTime(engine, uid, 0, "3,5", stime, etime) | |||||
total, err = db.OrderListCountByUIDByOrderTypeByTime(engine, uid, 0, []string{"3", "5"}, stime, etime) | |||||
if err != nil { | if err != nil { | ||||
return "", hasPay, payOrdId | return "", hasPay, payOrdId | ||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
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, []string{"3"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
if err != nil { | if err != nil { | ||||
return zhios_condition_statistics_utils.Int64ToStr(total), hasPay, payOrdId | return zhios_condition_statistics_utils.Int64ToStr(total), hasPay, payOrdId | ||||
} | } | ||||
@@ -403,12 +403,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"8", "9"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"8", "9"}) { | ||||
orderType = task.TaskTypePvd | orderType = task.TaskTypePvd | ||||
} | } | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
mallTotal, err := db.MallOrd(engine, uid, orderType, state) | mallTotal, err := db.MallOrd(engine, uid, orderType, state) | ||||
@@ -418,12 +418,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
total += mallTotal | total += mallTotal | ||||
} | } | ||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "3"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "3"}) { | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
o2oTotal, err := db.O2oOrd(engine, uid, 0, state) | o2oTotal, err := db.O2oOrd(engine, uid, 0, state) | ||||
@@ -438,12 +438,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
total += o2oTotal1 | total += o2oTotal1 | ||||
} | } | ||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "4"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "4"}) { | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
b2cTotal, err := db.B2cOrd(engine, uid, 0, state) | b2cTotal, err := db.B2cOrd(engine, uid, 0, state) | ||||
@@ -475,15 +475,15 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"8", "9"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"8", "9"}) { | ||||
orderType = task.TaskTypePvd | orderType = task.TaskTypePvd | ||||
} | } | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
mallTotal, err := db.MallOrdByTime(engine, uid, orderType, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | |||||
mallTotal, err := db.MallOrdByTime(engine, uid, orderType, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"), zhios_condition_statistics_utils.IntToStr(task.OrdState)) | |||||
if err != nil { | if err != nil { | ||||
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId | return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId | ||||
} | } | ||||
@@ -492,12 +492,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "3"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "3"}) { | ||||
mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) | mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) | ||||
mallEtime := t | mallEtime := t | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
o2oTotal, err := db.O2oOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | o2oTotal, err := db.O2oOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | ||||
@@ -514,12 +514,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "4"}) { | if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "4"}) { | ||||
mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) | mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) | ||||
mallEtime := t | mallEtime := t | ||||
state := "3" | |||||
state := []string{"3"} | |||||
if task.OrdState == 1 { //已付款 | if task.OrdState == 1 { //已付款 | ||||
state = "1,2,3" | |||||
state = []string{"1", "2", "3"} | |||||
} | } | ||||
if task.OrdState == 2 { //已完成 | if task.OrdState == 2 { //已完成 | ||||
state = "3" | |||||
state = []string{"3"} | |||||
} | } | ||||
//确认收货的才算 | //确认收货的才算 | ||||
b2cTotal, err := db.B2cOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | b2cTotal, err := db.B2cOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05")) | ||||