feat: payment pay
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package dao
|
||||
|
||||
const (
|
||||
PayStatusOk uint8 = 1 // 已支付
|
||||
PayStatusWait uint8 = 2 // 未支付
|
||||
PayStatusIn uint8 = 3 // 支付中
|
||||
PayStatusFail uint8 = 4 // 支付失败
|
||||
PayStatusLose uint8 = 5 // 已失效
|
||||
|
||||
PayTypeWechat uint8 = 1
|
||||
PayTypeAlipay uint8 = 2
|
||||
PayTypeBank uint8 = 4
|
||||
|
||||
CredentialTypeOpenid = "openid"
|
||||
CredentialEnabled = 1
|
||||
)
|
||||
|
||||
type OrderPayRow struct {
|
||||
Id int64 `gorm:"column:id" json:"id"`
|
||||
OrderSn string `gorm:"column:order_sn" json:"order_sn"`
|
||||
UserId int64 `gorm:"column:user_id" json:"user_id"`
|
||||
PayPrice float64 `gorm:"column:pay_price" json:"pay_price"`
|
||||
PayType uint8 `gorm:"column:pay_type" json:"pay_type"`
|
||||
Status uint8 `gorm:"column:status" json:"status"`
|
||||
OutTradeNo string `gorm:"column:out_trade_no" json:"out_trade_no"`
|
||||
}
|
||||
|
||||
type UserCredential struct {
|
||||
Id int64 `gorm:"column:id" json:"id"`
|
||||
UserId int64 `gorm:"column:user_id" json:"user_id"`
|
||||
CredentialType string `gorm:"column:credential_type" json:"credential_type"`
|
||||
Identifier string `gorm:"column:identifier" json:"identifier"`
|
||||
Status uint8 `gorm:"column:status" json:"status"`
|
||||
}
|
||||
|
||||
func ChannelToPayType(channel string) uint8 {
|
||||
switch channel {
|
||||
case "wechat":
|
||||
return PayTypeWechat
|
||||
case "alipay":
|
||||
return PayTypeAlipay
|
||||
case "bank":
|
||||
return PayTypeBank
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user