From 316e408d3a3eb6128f292a3c045b28839036be4f Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 4 Aug 2022 11:59:37 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v1.0.6=20=E6=9D=83=E7=9B=8A?= =?UTF-8?q?=E5=8D=A1=E8=AE=A2=E5=8D=95=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_order.go | 7 +++++-- db/model/privilege_card_ord.go | 31 +++++++++++++++++++++++++++++++ hdl/hdl_condition.go | 1 + 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 db/model/privilege_card_ord.go diff --git a/db/db_order.go b/db/db_order.go index 4f0c721..4ea3918 100644 --- a/db/db_order.go +++ b/db/db_order.go @@ -16,9 +16,11 @@ func OrderListCountByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, state, fmt.Println(str) total, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at=0", uid, stime, etime).In("state", state).Count(&model.OrdList{}) total1, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at>0", uid, stime, etime).Count(&model.OrdList{}) + total2, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and state=?", uid, stime, etime, 1).Count(&model.PrivilegeCardOrd{}) + fmt.Println(total) - return total + total1, nil + return total + total1 + total2, nil } // 查询用户某时间段内某状态的佣金(ord_id => amount) @@ -73,7 +75,8 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta fmt.Println(str) total, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at=0", uid, stime, etime).In("state", state).Sum(&model.OrdList{}, "paid_price") total1, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and settle_at>0", uid, stime, etime).Sum(&model.OrdList{}, "paid_price") + total2, _ := Db.Where("uid = ? AND create_at > ? AND create_at < ? and state=?", uid, stime, etime, 1).Sum(&model.PrivilegeCardOrd{}, "paid_price") fmt.Println(total) - return total + total1, nil + return total + total1 + total2, nil } diff --git a/db/model/privilege_card_ord.go b/db/model/privilege_card_ord.go new file mode 100644 index 0000000..73394e4 --- /dev/null +++ b/db/model/privilege_card_ord.go @@ -0,0 +1,31 @@ +package model + +type PrivilegeCardOrd struct { + Id int64 `json:"id" xorm:"pk autoincr comment('订单ID') BIGINT(20)"` + OrdId int64 `json:"ord_id" xorm:"not null comment('订单号') index BIGINT(20)"` + Uid int `json:"uid" xorm:"not null comment('用户id') index INT(10)"` + GoodsId int `json:"goods_id" xorm:"not null default 0 comment('商品ID') INT(11)"` + BrandId int `json:"brand_id" xorm:"not null default 0 comment('品牌ID') INT(11)"` + GoodsNum int `json:"goods_num" xorm:"not null default 1 comment('商品数量') INT(11)"` + GoodsPrice string `json:"goods_price" xorm:"not null default 0.00 comment('商品单价') DECIMAL(10,2)"` + PaidPrice string `json:"paid_price" xorm:"not null default 0.00 comment('付款金额') DECIMAL(10,2)"` + Profit string `json:"profit" xorm:"not null default 0.00 comment('利润') DECIMAL(10,2)"` + Coupon string `json:"coupon" xorm:"not null default 0.00 comment('优惠') DECIMAL(10,2)"` + PayMethod int `json:"pay_method" xorm:"not null default 1 comment('1余额2支付宝3微信') TINYINT(1)"` + State int `json:"state" xorm:"not null default 0 comment('0未支付,1已支付,2已退款,3失效') TINYINT(1)"` + Account string `json:"account" xorm:"not null default '' comment('充值账号--直冲') VARCHAR(255)"` + KeySecret string `json:"key_secret" xorm:"not null comment('兑换用json--卡券') TEXT"` + CreatedAt int `json:"created_at" xorm:"created not null default 0 comment('创建时间') INT(10)"` + UpdatedAt int `json:"updated_at" xorm:"updated not null default 0 comment('更新时间') INT(10)"` + DeletedAt int `json:"deleted_at" xorm:"not null default 0 comment('删除时间') INT(10)"` + ExpiredAt int `json:"expired_at" xorm:"not null default 0 comment('到期时间') INT(10)"` + SettleAt int `json:"settle_at" xorm:"not null default 0 comment('结算时间') INT(10)"` + Data string `json:"data" xorm:"not null comment('拓展用') LONGTEXT"` + BrandData string `json:"brand_data" xorm:"not null comment('拓展用') LONGTEXT"` + GoodsType string `json:"goods_type" xorm:"not null default 'offical' comment('商品类型') VARCHAR(50)"` + IdNum string `json:"id_num" xorm:"not null default '' comment('身份证后6位') VARCHAR(100)"` + IsCheckSuccess int `json:"is_check_success" xorm:"not null default 0 comment('是否核销') TINYINT(1)"` + RechargeStatus int `json:"recharge_status" xorm:"not null default 0 comment('0无 1充值中 2充值成功 3充值失败') INT(1)"` + ReturnMoneySettleAt int `xorm:"not null default 0 INT(10)" json:"return_money_settle_at"` + IsSetReduce int `xorm:"not null default 0 INT(1)" json:"is_set_reduce"` +} diff --git a/hdl/hdl_condition.go b/hdl/hdl_condition.go index 14c41ea..0b117ea 100644 --- a/hdl/hdl_condition.go +++ b/hdl/hdl_condition.go @@ -166,6 +166,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t zhios_condition_statistics_logx.Warn(err) return "" } + } if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "2", "8", "9"}) { mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location())