huangjiajun před 1 rokem
rodič
revize
6918740400
3 změnil soubory, kde provedl 73 přidání a 11 odebrání
  1. +6
    -1
      db/db_mall_order.go
  2. +1
    -0
      db/model/user_level_upgrade_task.go
  3. +66
    -10
      hdl/hdl_upgrade.go

+ 6
- 1
db/db_mall_order.go Zobrazit soubor

@@ -65,7 +65,12 @@ 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 confirm_time > ? AND confirm_time < ?", uid, state, stime, etime)
sess := Db.Where("uid = ? AND state in (?) ", uid, state)
if state == "1,2,3" {
sess = sess.And(" create_time > ? AND create_time < ?", uid, state, stime, etime)
} else {
sess = sess.And(" confirm_time > ? AND confirm_time < ?", uid, state, stime, etime)
}
if zhios_condition_statistics_utils.AnyToInt64(buyType) > 0 {
sess.And("order_type", buyType)
}


+ 1
- 0
db/model/user_level_upgrade_task.go Zobrazit soubor

@@ -10,6 +10,7 @@ type UserLevelUpgradeTask struct {
SchemeId int `json:"scheme_id" xorm:"not null default 0 comment('区域代理方案id') INT(11)"`
IsMustTask int `json:"is_must_task" xorm:"not null default 0 comment('是否必做(0,1)') TINYINT(1)"`
TaskTypePvd int `json:"task_type_pvd" xorm:"not null default 0 comment('task_type=15时生效,表示店铺渠道 0 o2o+b2c 1 o2o 3b2c') INT(10)"`
OrdState int `json:"ord_state" xorm:"not null default 0 comment('task_type=15时生效,表示店铺渠道 0 o2o+b2c 1 o2o 3b2c') INT(10)"`
TaskTypeCount int `json:"task_type_count" xorm:"not null default 0 comment('task_type=15时生效,表示店铺的数量') INT(10)"`
TaskTypeSecondCount int `json:"task_type_second_count" xorm:"not null default 0 comment('task_type=17时生效,表示每条链的数量') INT(10)"`
TaskType int `json:"task_type" xorm:"not null default 0 comment('1:累计自购订单总数,2:累计到账佣金,3:累计直推粉丝数量,4:累计团队有效直推人数,5:累计团队符合相应等级的人数,6:付费任务') TINYINT(2)"`


+ 66
- 10
hdl/hdl_upgrade.go Zobrazit soubor

@@ -386,7 +386,14 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
var err error
if task.WithinDays <= 0 {
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "1"}) {
total, err = db.OrderListPaidPriceByUIDByOrderType(engine, uid, 0, []string{"3", "5"})
state := []string{"3", "5"}
if task.OrdState == 1 { //已付款
state = []string{"0", "1", "2", "3", "5"}
}
if task.OrdState == 2 { //已完成
state = []string{"1", "2", "3", "5"}
}
total, err = db.OrderListPaidPriceByUIDByOrderType(engine, uid, 0, state)
if err != nil {
return "", hasPay, payOrdId
}
@@ -396,29 +403,50 @@ 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"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
mallTotal, err := db.MallOrd(engine, uid, orderType, []string{"3"})
mallTotal, err := db.MallOrd(engine, uid, orderType, state)
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
total += mallTotal
}
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "3"}) {
state := "3"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
o2oTotal, err := db.O2oOrd(engine, uid, 0, []string{"3"})
o2oTotal, err := db.O2oOrd(engine, uid, 0, state)
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
total += o2oTotal
o2oTotal1, err := db.O2oOrdPayToMerchant(engine, uid, 0, []string{"1", "4"})
o2oTotal1, err := db.O2oOrdPayToMerchant(engine, uid, 0, "1,4")
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
total += o2oTotal1
}
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "4"}) {
state := "3"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
b2cTotal, err := db.B2cOrd(engine, uid, 0, []string{"3"})
b2cTotal, err := db.B2cOrd(engine, uid, 0, state)
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
@@ -428,7 +456,14 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
if zhios_condition_statistics_utils.InArr(zhios_condition_statistics_utils.IntToStr(task.TaskTypePvd), []string{"0", "1"}) {
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Unix()
etime := t.Unix()
total, err = db.OrderListPaidPriceByUIDByOrderTypeByTime(engine, uid, 0, []string{"3", "5"}, stime, etime)
state := []string{"3", "5"}
if task.OrdState == 1 { //已付款
state = []string{"0", "1", "2", "3", "5"}
}
if task.OrdState == 2 { //已完成
state = []string{"1", "2", "3", "5"}
}
total, err = db.OrderListPaidPriceByUIDByOrderTypeByTime(engine, uid, 0, state, stime, etime)
if err != nil {
return "", hasPay, payOrdId
}
@@ -440,8 +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"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
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"))
mallTotal, err := db.MallOrdByTime(engine, uid, orderType, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
@@ -450,13 +492,20 @@ 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"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
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"))
o2oTotal, err := db.O2oOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
total += o2oTotal
o2oTotal1, err := db.O2oOrdPayToMerchantByTime(engine, uid, 0, []string{"1", "4"}, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
o2oTotal1, err := db.O2oOrdPayToMerchantByTime(engine, uid, 0, "1,4", mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}
@@ -465,8 +514,15 @@ 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"
if task.OrdState == 1 { //已付款
state = "1,2,3"
}
if task.OrdState == 2 { //已完成
state = "3"
}
//确认收货的才算
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"))
b2cTotal, err := db.B2cOrdByTime(engine, uid, 0, state, mallStime.Format("2006-01-02 15:04:05"), mallEtime.Format("2006-01-02 15:04:05"))
if err != nil {
return zhios_condition_statistics_utils.Float64ToStr(total), hasPay, payOrdId
}


Načítá se…
Zrušit
Uložit