|
|
package order
|
|
|
|
|
|
import (
|
|
|
"recook/internal/model/order_preview"
|
|
|
"time"
|
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
"github.com/shopspring/decimal"
|
|
|
)
|
|
|
|
|
|
type Information struct {
|
|
|
ID uint `gorm:"column:id;primary_key" json:"id"`
|
|
|
AncestorID uint `gorm:"column:ancestor_id" json:"-"`
|
|
|
ParentID uint `gorm:"column:parent_id" json:"parentId"` // 分享者id,链接购买则是分享者id。其他方式则是自己上级的id
|
|
|
SharerID uint `gorm:"column:sharer_id" json:"sharerId"`
|
|
|
LiveId uint `gorm:"column:live_id" json:"liveId"`
|
|
|
UserID uint `gorm:"column:user_id" json:"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"` // 品牌优惠券抵扣总金额
|
|
|
UniverseCouponTotalAmount decimal.Decimal `gorm:"column:universe_coupon_total_amount" json:"universeCouponTotalAmount"` // 购物券抵扣总金额
|
|
|
CoinTotalAmount decimal.Decimal `gorm:"column:coin_total_amount" json:"coinTotalAmount"` // 瑞币抵扣总金额
|
|
|
ExpressTotalFee decimal.Decimal `gorm:"column:express_total_fee" json:"expressTotalFee"` // 总快递费
|
|
|
GoodsTotalAmount decimal.Decimal `gorm:"column:goods_total_amount" json:"goodsTotalAmount"` // 商品总金额,
|
|
|
GoodsTotalCommission decimal.Decimal `gorm:"column:goods_total_commission" json:"goodsTotalCommission"` // 商品总返还金额
|
|
|
ActualTotalAmount decimal.Decimal `gorm:"column:actual_total_amount" json:"actualTotalAmount"` // 实际支付的金额
|
|
|
Channel uint `gorm:"column:channel" json:"-"` // 下单渠道:0详情页直接购买 1购物车结算购买
|
|
|
ShippingMethod uint `gorm:"column:shipping_method" json:"shippingMethod"` // 0快递 1自提
|
|
|
StoreID uint `gorm:"column:store_id" json:"-"` // 门店id
|
|
|
BuyerMessage string `gorm:"column:buyer_message" json:"buyerMessage"` // 买家留言
|
|
|
Status uint `gorm:"column:status" json:"status"` // 0未付款 1支付成功 2订单取消 3订单过期 4交易成功 5订单关闭
|
|
|
ExpressStatus uint `gorm:"column:express_status" json:"expressStatus"` // 快递状态 0 没有发货 1部分发货 2全部发货
|
|
|
InvoiceStatus uint `gorm:"column:invoice_status" json:"invoiceStatus"` // 开票状态 0 未申请, 1已申请 2已开票
|
|
|
EvaluatedAt formatime.Second `gorm:"column:evaluated_at" json:"evaluatedAt"` // 评价时间
|
|
|
CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt"` // 创建时间
|
|
|
ExpireTime formatime.Second `gorm:"column:expire_time" json:"expireTime"` // 订单过期时间
|
|
|
PayIP string `gorm:"column:pay_ip" json:"payIp"` // 支付时的ip
|
|
|
TradeNo string `gorm:"column:trade_no" json:"tradeNo"` // 传递给第三方支付的id凭证
|
|
|
PayTime formatime.Second `gorm:"column:pay_time" json:"payTime"` // 支付时间
|
|
|
PayMethod uint `gorm:"column:pay_method" json:"payMethod"` // 支付方式: 0:recookpay 1:微信 2:支付宝 3:零支付 4:小程序支付' 5:alipay-h5
|
|
|
CompletedAt formatime.Second `gorm:"column:completed_at" json:"completedAt"` // 交易完成时间
|
|
|
RbacId int `gorm:"column:rbac_id" json:"rbacId"`
|
|
|
IsFirst int `gorm:"column:is_first" json:"isFirst"` // 是否为第一笔订单 1 否,2 是 3 提交订单的时候检查是否是第一次提交订单
|
|
|
VirtualID uint `gorm:"column:virtual_id"`
|
|
|
Kind int `gorm:"column:kind"`
|
|
|
JCookOrderID uint `gorm:"column:jcook_order_id"`
|
|
|
ApplyStatus int `gorm:"column:apply_status"`
|
|
|
DealStatus int `gorm:"column:deal_status"`
|
|
|
IsSplit bool `gorm:"column:is_split"`
|
|
|
JCookRootID uint `gorm:"column:jcook_root_id" json:"jcook_root_id"`
|
|
|
JCookParentID uint `gorm:"column:jcook_parent_id" json:"jcook_parent_id"`
|
|
|
Cost decimal.Decimal `json:"cost"`
|
|
|
JCookStatus int `gorm:"column:jcook_status" json:"jcook_status"`
|
|
|
ShaMaOrderID uint `gorm:"column:shama_order_id" json:"-"`
|
|
|
OrderType uint `gorm:"column:order_type" json:"-"`
|
|
|
CanPay bool `gorm:"column:can_pay" json:"-"`
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
RecookPayForOrderInfo = 0
|
|
|
WechatPayForOrderInfo = 1
|
|
|
AlipayForOrderInfo = 2
|
|
|
WechatMiniPayForOrderInfo = 4
|
|
|
AlipayH5ForOrderInfo = 5
|
|
|
WechatH5PayForOrderInfo = 6
|
|
|
WechatH5InnerForOrderInfo = 7
|
|
|
UnionPay = 8
|
|
|
)
|
|
|
|
|
|
// TableName sets the insert table name for this struct type
|
|
|
func (r *Information) TableName() string {
|
|
|
return "recook_order_info"
|
|
|
}
|
|
|
|
|
|
func (*Information) Reflect(r *order_preview.Information) *Information {
|
|
|
n := formatime.NewSecondNow()
|
|
|
afterTime, _ := time.ParseDuration("20m")
|
|
|
expireTime := n.Time.Add(afterTime)
|
|
|
|
|
|
return &Information{
|
|
|
AncestorID: r.AncestorID,
|
|
|
ParentID: r.ParentID,
|
|
|
SharerID: r.SharerID,
|
|
|
LiveId: r.LiveId,
|
|
|
UserID: r.UserID,
|
|
|
UserRole: r.UserRole,
|
|
|
Title: r.Title,
|
|
|
BrandCouponTotalAmount: r.BrandCouponTotalAmount,
|
|
|
UniverseCouponTotalAmount: r.UniverseCouponTotalAmount,
|
|
|
CoinTotalAmount: r.CoinTotalAmount,
|
|
|
ExpressTotalFee: r.ExpressTotalFee,
|
|
|
GoodsTotalAmount: r.GoodsTotalAmount,
|
|
|
GoodsTotalCommission: r.GoodsTotalCommission,
|
|
|
ActualTotalAmount: r.ActualTotalAmount,
|
|
|
Channel: r.Channel,
|
|
|
ShippingMethod: r.ShippingMethod,
|
|
|
StoreID: r.StoreID,
|
|
|
BuyerMessage: r.BuyerMessage,
|
|
|
CreatedAt: n,
|
|
|
ExpireTime: formatime.NewSecondFrom(expireTime),
|
|
|
Cost: r.Cost,
|
|
|
OrderType: r.OrderType,
|
|
|
IsSplit: r.IsVirtual,
|
|
|
|
|
|
}
|
|
|
}
|