You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
4.2 KiB
76 lines
4.2 KiB
package order
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/towgo/towgo/dao/basedboperat"
|
|
"log"
|
|
"src/module/cart"
|
|
)
|
|
|
|
func (Order) TableName() string {
|
|
return "order"
|
|
|
|
}
|
|
|
|
// Order 表示订单信息
|
|
type Order struct {
|
|
ID int64 `json:"id"` // 订单ID
|
|
Type string `json:"type"` // 订单类型
|
|
OrderSN string `json:"order_sn"` // 订单编号
|
|
UserID int64 `json:"user_id"` // 用户ID
|
|
ActivityType string `json:"activity_type"` // 活动类型
|
|
GoodsAmount string `json:"goods_amount"` // 商品金额
|
|
DispatchAmount string `json:"dispatch_amount"` // 配送费用
|
|
Phone string `json:"phone"` // 联系电话
|
|
Consignee string `json:"consignee"` // 收货人
|
|
ProvinceName string `json:"province_name"` // 省份名称
|
|
CityName string `json:"city_name"` // 城市名称
|
|
AreaName string `json:"area_name"` // 区域名称
|
|
Address string `json:"address"` // 收货地址
|
|
ProvinceID int64 `json:"province_id"` // 省份ID
|
|
CityID int64 `json:"city_id"` // 城市ID
|
|
AreaID int64 `json:"area_id"` // 区域ID
|
|
Status int64 `json:"status"` // 订单状态
|
|
InvoiceStatus string `json:"invoice_status"` // 发票状态
|
|
Memo string `json:"memo"` // 备注
|
|
Remark string `json:"remark"` // 备注
|
|
TotalAmount string `json:"total_amount"` // 订单总金额
|
|
ScoreAmount int64 `json:"score_amount"` // 积分金额
|
|
TotalFee string `json:"total_fee"` // 总费用
|
|
LastTotalFee string `json:"last_total_fee"` // 最终总费用
|
|
DiscountFee string `json:"discount_fee"` // 折扣金额
|
|
CouponFee string `json:"coupon_fee"` // 优惠券金额
|
|
ActivityDiscountMoney string `json:"activity_discount_money"` // 活动折扣金额
|
|
DispatchDiscountMoney string `json:"dispatch_discount_money"` // 配送折扣金额
|
|
PayFee string `json:"pay_fee"` // 支付费用
|
|
ScoreFee int64 `json:"score_fee"` // 积分费用
|
|
GoodsOriginalAmount string `json:"goods_original_amount"` // 商品原始金额
|
|
CouponsID int64 `json:"coupons_id"` // 优惠券ID
|
|
TransactionID string `json:"transaction_id"` // 交易ID
|
|
PaymentJSON string `json:"payment_json"` // 支付信息JSON
|
|
PayType string `json:"pay_type"` // 支付类型
|
|
Paytime int64 `json:"paytime"` // 支付时间
|
|
Ext string `json:"ext"` // 扩展信息
|
|
Platform string `json:"platform"` // 平台
|
|
Createtime int64 `json:"createtime"` // 创建时间
|
|
Item []cart.Cart `json:"item" ` // 订单项列表
|
|
StatusCode string `json:"status_code"` // 状态编码
|
|
StatusName string `json:"status_name"` // 状态名称
|
|
StatusDesc string `json:"status_desc"` // 状态描述
|
|
Btns []string `json:"btns"` // 按钮列表
|
|
ExtArr ExtArr `json:"ext_arr" xorm:"-"` // 扩展信息数组
|
|
}
|
|
type ExtArr struct {
|
|
BuyType string `json:"buy_type"`
|
|
GrouponId int64 `json:"groupon_id"`
|
|
ExpiredTime int64 `json:"expired_time" `
|
|
}
|
|
|
|
func (o *Order) AfterQuery(session basedboperat.DbTransactionSession) {
|
|
err := json.Unmarshal([]byte(o.Ext), &o.ExtArr)
|
|
if err != nil {
|
|
log.Println(err.Error())
|
|
return
|
|
}
|
|
}
|