Files
jx-callback/business/model/order.go
苏尹岚 5088d49c0c wxpay
2020-11-23 10:12:52 +08:00

117 lines
4.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import "time"
const (
PayTypeWX = 1 // 微信支付
PayTypeTL = 2 // 通联宝支付
PayStatusNo = 0
PayStatusYes = 1
PayStatusFailed = 2
PayStatusCanceled = 3
PayStatusRefund = 4
RefundStatusNo = 0
RefundStatusYes = 1
RefundStatusFailed = 2
VendorPayTypeCompanyPay = "companyPay" //企业付款
VendorPayTypeTransferAccount = "transferAccount" //手动转账
)
const (
OrderTypeAddressErr = -1 //地址异常订单
OrderTypeNormal = 0 //普通订单
OrderTypeMatter = 1 //物料订单
OrderTypeSupplyGoods = 2 //进货订单
OrderTypeDefendPrice = 3 //守价订单
OrderTypePay = 1 //支付
OrderTypeCash = 2 //提现
)
var (
PayStatusName = map[int]string{
PayStatusNo: "待支付",
PayStatusYes: "已支付",
PayStatusFailed: "支付失败",
PayStatusCanceled: "支付取消",
PayStatusRefund: "已退款",
}
RefundStatusName = map[int]string{
RefundStatusNo: "待退款",
RefundStatusYes: "已退款",
RefundStatusFailed: "退款失败",
}
)
type Order struct {
ModelIDCUL
OrderID string `orm:"column(order_id)" json:"orderID"` //订单号
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
Type int `json:"type"` //订单类型
Way string `json:"way"` //weixinapp ,weixinmini
Status int `json:"status"` //订单状态,待支付2已支付5支付成功110支付失败115
PayPrice int `json:"payPrice"` //支付金额
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后支付方生成的事务ID
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"`
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后支付前支付方生成的事务ID
OriginalData string `orm:"type(text)" json:"-"`
Comment string `orm:"size(255)" json:"comment"` //备注
Lng float64 `json:"lng"`
Lat float64 `json:"lat"`
CityCode int `orm:"default(0)" json:"cityCode"` //提交订单时用户所在城市
DistrictCode int `orm:"default(0)" json:"districtCode"`
Address string `orm:"size(255)" json:"address"`
}
func (v *Order) TableUnique() [][]string {
return [][]string{
[]string{"OrderID"},
}
}
func (v *Order) TableIndex() [][]string {
return [][]string{
[]string{"CreatedAt"},
[]string{"UserID"},
}
}
type DeliveryOrder struct {
ModelIDCUL
VendorWaybillID string `orm:"column(vendor_waybill_id)" json:"vendorWaybillID"` //运单号
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
DeliverySendID int `orm:"column(delivery_send_id)" json:"deliverySendID"` //寄件人地址ID
DeliveryReceiveID int `orm:"column(delivery_receive_id)" json:"deliveryReceiveID"` //取件人地址ID收货人
Status int `json:"status"` //运单状态
PayPrice int `json:"payPrice"` //支付金额
OrderFinishedAt time.Time `json:"orderFinishedAt"` //订单完成时间
Weight float64 `json:"weight"` //订单重量,单位kg
Vloumn float64 `json:"vloumn"` //订单体积单位立方cm
Description string `json:"description"` //订单商品描述
PickUpStartTime time.Time `json:"pickUpStartTime"` //预约取件开始时间
PickUpEndTime time.Time `json:"pickUpEndTime"` //预约取件结束时间
PackageCount int `json:"packageCount"` //包裹数
ActualWeight float64 `json:"actualWeight"` //实际重量
IsWeight int `json:"isWeight"` //0代表未验重1代表验重通过2代表不通过
Comment string `orm:"size(255)" json:"comment"` //备注
}
func (v *DeliveryOrder) TableUnique() [][]string {
return [][]string{
[]string{"VendorWaybillID"},
}
}
func (v *DeliveryOrder) TableIndex() [][]string {
return [][]string{
[]string{"CreatedAt"},
[]string{"UserID"},
}
}