Parcourir la source

更新

master
huangjiajun il y a 1 an
Parent
révision
c4ab4d9615
5 fichiers modifiés avec 37 ajouts et 37 suppressions
  1. +2
    -2
      db/db_b2c_ord.go
  2. +6
    -6
      db/db_mall_order.go
  3. +2
    -2
      db/db_o2o_ord.go
  4. +4
    -4
      hdl/hdl_condition.go
  5. +23
    -23
      hdl/hdl_upgrade.go

+ 2
- 2
db/db_b2c_ord.go Voir le fichier

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

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(total)
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) {
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(total)
if err != nil {


+ 6
- 6
db/db_mall_order.go Voir le fichier

@@ -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 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(total)
if err != nil {
@@ -64,9 +64,9 @@ func MallOrderRelateListByTimeByState(Db *xorm.Engine, uid, state, startTime, en
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)
} else {
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) {
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(total)
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) {
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 {
sess.And("order_type", buyType)
}


+ 2
- 2
db/db_o2o_ord.go Voir le fichier

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

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(total)
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) {
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(total)
if err != nil {


+ 4
- 4
hdl/hdl_condition.go Voir le fichier

@@ -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())
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 {
zhios_condition_statistics_logx.Warn(err)
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"])
}
//确认收货的才算
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 {
zhios_condition_statistics_logx.Warn(err)
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())
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 {
zhios_condition_statistics_logx.Warn(err)
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())
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 {
zhios_condition_statistics_logx.Warn(err)
return zhios_condition_statistics_utils.Float64ToStr(total)


+ 23
- 23
hdl/hdl_upgrade.go Voir le fichier

@@ -356,23 +356,23 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
var err error
//联盟结算后的
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 {
return "", hasPay, payOrdId
}
//确认收货的才算
mallTotal, err := db.MallOrdWithCount(engine, uid, 0, "3")
mallTotal, err := db.MallOrdWithCount(engine, uid, 0, []string{"3"})
if err != nil {
return zhios_condition_statistics_utils.Int64ToStr(total), hasPay, payOrdId
}
total += mallTotal
} 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 {
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 {
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"}) {
orderType = task.TaskTypePvd
}
state := "3"
state := []string{"3"}
if task.OrdState == 1 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
if task.OrdState == 2 { //已完成
state = "3"
state = []string{"3"}
}
//确认收货的才算
mallTotal, err := db.MallOrd(engine, uid, orderType, state)
@@ -418,12 +418,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
total += mallTotal
}
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 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
if task.OrdState == 2 { //已完成
state = "3"
state = []string{"3"}
}
//确认收货的才算
o2oTotal, err := db.O2oOrd(engine, uid, 0, state)
@@ -438,12 +438,12 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
total += o2oTotal1
}
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 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
if task.OrdState == 2 { //已完成
state = "3"
state = []string{"3"}
}
//确认收货的才算
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"}) {
orderType = task.TaskTypePvd
}
state := "3"
state := []string{"3"}
if task.OrdState == 1 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
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 {
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"}) {
mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location())
mallEtime := t
state := "3"
state := []string{"3"}
if task.OrdState == 1 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
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"))
@@ -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"}) {
mallStime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location())
mallEtime := t
state := "3"
state := []string{"3"}
if task.OrdState == 1 { //已付款
state = "1,2,3"
state = []string{"1", "2", "3"}
}
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"))


Chargement…
Annuler
Enregistrer