修改查询数据

master
kanade 3 years ago
parent 7d687103d8
commit 6bd700d8e8

@ -2,6 +2,7 @@ package order
import (
"recook/internal/model/order_preview"
"recook/internal/model/user"
"time"
"github.com/golangkit/formatime"
@ -15,6 +16,7 @@ type Information struct {
SharerID uint `gorm:"column:sharer_id" json:"sharerId"`
LiveId uint `gorm:"column:live_id" json:"liveId"`
UserID uint `gorm:"column:user_id" json:"userId"` // 下单者
User user.Information `json:"-" gorm:"foreignKey:userId"`
UserRole uint `gorm:"column:user_role" json:"userRole"`
Title string `gorm:"column:title" json:"title"` // 订单简要标题
BrandCouponTotalAmount decimal.Decimal `gorm:"column:brand_coupon_total_amount" json:"brandCouponTotalAmount"` // 品牌优惠券抵扣总金额

@ -233,9 +233,10 @@ func (i *incomeLogic) ProfitCard(args EntryDate) (res []Entry) {
return
}
next := now.AddDate(0, 1, 0)
mysql.Db.Preload("Address").Preload("OrderSku.Sku").
mysql.Db.Preload("User").Preload("OrderSku.Sku").
Where("created_at between ? and ?", now, next).
Where("is_split = 1").
Where("status in ?", []uint{1, 4}).
Where("jcook_order_id = 0 or shama_order_id = 0").
Find(&od, "sharer_id = ? AND sharer_id != user_id", args.UserID)
for _, v := range od {
@ -249,8 +250,8 @@ func (i *incomeLogic) ProfitCard(args EntryDate) (res []Entry) {
s = "年卡"
}
res = append(res, Entry{
Name: v.Address.ReceiverName,
Mobile: v.Address.Mobile,
Name: v.User.Nickname,
Mobile: v.User.Mobile,
TypeStr: s,
Amount: v.ActualTotalAmount,
})

Loading…
Cancel
Save