34 lines
1.9 KiB
Go
34 lines
1.9 KiB
Go
package entity
|
||
|
||
import "github.com/gogf/gf/v2/os/gtime"
|
||
|
||
// MemberOrders 订单(一笔微信虚拟支付道具直购)。
|
||
// 发货、对账一律以 WxOrderId(平台单号)为准,OutTradeNo 只是商家侧业务单号。
|
||
//
|
||
// 同一张表承载两类商品,靠 OrderType 区分:
|
||
// - OrderTypeMember(1):会员套餐。发货 = 延长 users.level_expire_at(用到 LevelKey/DurationDays)
|
||
// - OrderTypeQuota(2) :次数包。 发货 = 增加 user_tool_quota 余额(用到 ToolKey/Times/DurationDays 作为有效期天数)
|
||
type MemberOrders struct {
|
||
Id int64 `json:"id"`
|
||
OutTradeNo string `json:"out_trade_no"` // 业务单号,唯一,8-32 位且不能以下划线开头
|
||
WxOrderId string `json:"wx_order_id"` // 平台单号,发货幂等去重以此为准
|
||
UserId int64 `json:"user_id"`
|
||
Openid string `json:"openid"` // 支付时使用的 openid,查单需要
|
||
OrderType int `json:"order_type"`
|
||
PlanKey string `json:"plan_key"`
|
||
PackKey string `json:"pack_key"` // 次数包档位(OrderType=2)
|
||
ToolKey string `json:"tool_key"` // 次数包绑定的工具(OrderType=2)
|
||
Times int `json:"times"` // 次数包的次数(OrderType=2)
|
||
ProductId string `json:"product_id"`
|
||
PriceCents int64 `json:"price_cents"`
|
||
LevelKey string `json:"level_key"` // 下单时套餐对应的等级(快照)
|
||
DurationDays int `json:"duration_days"` // 下单时套餐天数 / 次数包有效期天数(快照)
|
||
Status int `json:"status"`
|
||
PayChannel string `json:"pay_channel"`
|
||
Attach string `json:"attach"` // 透传数据,发货时原样回传
|
||
PaidAt *gtime.Time `json:"paid_at"`
|
||
DeliveredAt *gtime.Time `json:"delivered_at"`
|
||
CreatedAt *gtime.Time `json:"created_at"`
|
||
UpdatedAt *gtime.Time `json:"updated_at"`
|
||
}
|