From d10bd788e883db49b3f148fe2567a8d374a4c94b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 7 Jun 2024 14:31:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_order_relate.go | 28 ++++++++++++++++++++-------- hdl/hdl_upgrade.go | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/db/db_order_relate.go b/db/db_order_relate.go index 80bd588..2e59491 100644 --- a/db/db_order_relate.go +++ b/db/db_order_relate.go @@ -9,7 +9,10 @@ import ( ) func OrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { - timeStr := "" + timeStr := " and olr.level=0 " + if task.TaskType == 25 { + timeStr = " and olr.level>=0 " + } t := time.Now() stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) etime := t @@ -62,7 +65,7 @@ FROM ord_list_relate olr LEFT JOIN duoyou_ord_list dol ON olr.oid =dol.oid LEFT JOIN recharge_order ro ON olr.oid =ro.oid LEFT JOIN playlet_sale_order pso ON olr.oid =pso.custom_oid -WHERE olr.uid = ? and olr.level=0 %s AND (ol.state in(%s) or pco.state=1 or dol.id>0 or ro.status<>'已退款' or pso.status<>'订单退款'); +WHERE olr.uid = ? %s AND (ol.state in(%s) or pco.state=1 or dol.id>0 or ro.status<>'已退款' or pso.status<>'订单退款'); ` sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) todayResult, err := QueryNativeString(Db, sqlTpl, uid) @@ -74,7 +77,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND (ol.state in(%s) or pco.state=1 or dol. } func MallOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { - timeStr := "" + timeStr := " and olr.level=0 " + if task.TaskType == 25 { + timeStr = " and olr.level>=0 " + } t := time.Now() stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) etime := t @@ -105,7 +111,7 @@ func MallOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task sqlTpl := `SELECT cast(SUM(olr.amount) as decimal(50,6)) AS amount FROM mall_ord_list_relate olr LEFT JOIN mall_ord ol ON olr.oid = ol.ord_id -WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); +WHERE olr.uid = ? %s AND ol.state IN (%s); ` sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) todayResult, err := QueryNativeString(Db, sqlTpl, uid) @@ -116,7 +122,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); return sum, nil } func O2oOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { - timeStr := "" + timeStr := " and olr.level=0 " + if task.TaskType == 25 { + timeStr = " and olr.level>=0 " + } t := time.Now() stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) etime := t @@ -157,7 +166,7 @@ func O2oOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task * FROM mall_ord_list_relate olr LEFT JOIN o2o_ord ol ON olr.oid = ol.ord_id LEFT JOIN o2o_pay_to_merchant optm ON optm.pay_id = olr.oid -WHERE olr.uid = ? and olr.level=0 %s AND (ol.state IN (%s) or optm.state>=1); +WHERE olr.uid = ? %s AND (ol.state IN (%s) or optm.state>=1); ` sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) todayResult, err := QueryNativeString(Db, sqlTpl, uid) @@ -168,7 +177,10 @@ WHERE olr.uid = ? and olr.level=0 %s AND (ol.state IN (%s) or optm.state>=1); return sum, nil } func B2cOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask) (float64, error) { - timeStr := "" + timeStr := " and olr.level=0 " + if task.TaskType == 25 { + timeStr = " and olr.level>=0 " + } t := time.Now() stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()) etime := t @@ -199,7 +211,7 @@ func B2cOrderRelateListByTimeByStateNew(Db *xorm.Engine, uid interface{}, task * sqlTpl := `SELECT cast(SUM(olr.amount) as decimal(50,6)) AS amount FROM mall_ord_list_relate olr LEFT JOIN b2c_ord ol ON olr.oid = ol.ord_id -WHERE olr.uid = ? and olr.level=0 %s AND ol.state IN (%s); +WHERE olr.uid = ? %s AND ol.state IN (%s); ` sqlTpl = fmt.Sprintf(sqlTpl, timeStr, state) todayResult, err := QueryNativeString(Db, sqlTpl, uid) diff --git a/hdl/hdl_upgrade.go b/hdl/hdl_upgrade.go index 3c88be3..3a75aca 100644 --- a/hdl/hdl_upgrade.go +++ b/hdl/hdl_upgrade.go @@ -487,7 +487,7 @@ func GetFinishCount(params map[string]string, blockStarChain string, engine *xor return zhios_condition_statistics_utils.Float64ToStr(zhios_condition_statistics_utils.FloatFormat(total, 2)), hasPay, payOrdId - case 2: + case 2, 25: // 累计自购佣金 sum, err := db.OrderRelateListByTimeByStateNew(engine, uid, task) if err != nil {