From 7336c7801736c629f9bfb2e5664c840f068c2c64 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 22 Mar 2024 11:32:43 +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_b2c_ord.go | 9 +++++++++ hdl/hdl_condition.go | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/db/db_b2c_ord.go b/db/db_b2c_ord.go index cc328a8..9b08f72 100644 --- a/db/db_b2c_ord.go +++ b/db/db_b2c_ord.go @@ -29,6 +29,15 @@ func B2cOrdByTime(Db *xorm.Engine, uid, buyType, state, stime, etime interface{} return total, nil } +func B2cOrdByTimeWithCount(Db *xorm.Engine, uid, buyType, state, stime, etime interface{}) (int64, error) { + total, err := Db.Where("uid = ? AND confirm_time > ? AND confirm_time < ?", uid, stime, etime).In("state", state).Count(&model.B2cOrd{}) + fmt.Println(err) + fmt.Println(total) + if err != nil { + return 0, zhios_condition_statistics_logx.Error(err) + } + return total, nil +} func B2cOrd(Db *xorm.Engine, uid, buyType, state interface{}, isSettle int) (float64, error) { sess := Db.Where("uid = ? ", uid) diff --git a/hdl/hdl_condition.go b/hdl/hdl_condition.go index 070f533..63b87fe 100644 --- a/hdl/hdl_condition.go +++ b/hdl/hdl_condition.go @@ -30,6 +30,13 @@ func OwnBuyTotal(engine *xorm.Engine, uid interface{}, task map[string]string, t return zhios_condition_statistics_utils.Int64ToStr(total) } total += mallTotal + //确认收货的才算 + b2cTotal, err := db.MallOrdByTimeWithCount(engine, uid, 0, []string{"3", "4"}, 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) + } + total += b2cTotal return zhios_condition_statistics_utils.Int64ToStr(total) }