@@ -16,9 +16,11 @@ func OrderListCountByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, state, | |||||
fmt.Println(str) | 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{}) | 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{}) | 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) | fmt.Println(total) | ||||
return total + total1, nil | |||||
return total + total1 + total2, nil | |||||
} | } | ||||
// 查询用户某时间段内某状态的佣金(ord_id => amount) | // 查询用户某时间段内某状态的佣金(ord_id => amount) | ||||
@@ -73,7 +75,8 @@ func OrderListPaidPriceByUIDByOrderTypeByTime(Db *xorm.Engine, uid, buyType, sta | |||||
fmt.Println(str) | 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") | 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") | 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) | fmt.Println(total) | ||||
return total + total1, nil | |||||
return total + total1 + total2, nil | |||||
} | } |
@@ -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"` | |||||
} |
@@ -166,6 +166,7 @@ func OwnbuySum(engine *xorm.Engine, uid interface{}, task map[string]string, t t | |||||
zhios_condition_statistics_logx.Warn(err) | zhios_condition_statistics_logx.Warn(err) | ||||
return "" | return "" | ||||
} | } | ||||
} | } | ||||
if zhios_condition_statistics_utils.InArr(task["task_type_pvd"], []string{"0", "2", "8", "9"}) { | 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()) | mallStime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()) | ||||