42 lines
868 B
Go
42 lines
868 B
Go
package data
|
|
|
|
import (
|
|
"PaymentCenter/app/models/orderexceptionmodel"
|
|
"PaymentCenter/app/utils/snowflake"
|
|
|
|
"xorm.io/xorm"
|
|
)
|
|
|
|
type OrderExceptionRepo struct {
|
|
repo xorm.Interface
|
|
}
|
|
|
|
func NewOrderExceptionRepo(repo xorm.Interface) *OrderExceptionRepo {
|
|
return &OrderExceptionRepo{
|
|
repo: repo,
|
|
}
|
|
}
|
|
|
|
func (m *OrderExceptionRepo) InsertOne(orderException *orderexceptionmodel.OrderException) (int64, error) {
|
|
orderException.Id = snowflake.GetID()
|
|
return m.repo.InsertOne(orderException)
|
|
}
|
|
|
|
type Exception int
|
|
|
|
const (
|
|
OrderStatusOverButPaySuccess Exception = 1
|
|
)
|
|
|
|
func (e Exception) GetDesc() string {
|
|
return ExceptionOrderStatusOverButPayFailMap[e]
|
|
}
|
|
|
|
func (e Exception) ToInt() int {
|
|
return int(e)
|
|
}
|
|
|
|
var ExceptionOrderStatusOverButPayFailMap = map[Exception]string{
|
|
OrderStatusOverButPaySuccess: "订单状态为终态但是收到支付成功的消息",
|
|
}
|