feat(apple支付): 添加按平台查询支付方式和恢复交易逻辑优化
Build docker and publish / build (20.15.1) (push) Successful in 6m52s
Build docker and publish / build (20.15.1) (push) Successful in 6m52s
添加FindListByPlatform方法用于按平台查询支付方式 优化apple支付恢复交易逻辑,支持直接使用交易ID查询 添加API配置处理逻辑和错误回退机制
This commit is contained in:
@@ -12,6 +12,7 @@ type customPaymentLogicModel interface {
|
||||
FindAll(ctx context.Context) ([]*Payment, error)
|
||||
FindListByPage(ctx context.Context, page, size int, req *Filter) (int64, []*Payment, error)
|
||||
FindAvailableMethods(ctx context.Context) ([]*Payment, error)
|
||||
FindListByPlatform(ctx context.Context, platform string) ([]*Payment, error)
|
||||
}
|
||||
|
||||
// NewModel returns a model for the database table.
|
||||
@@ -21,6 +22,14 @@ func NewModel(conn *gorm.DB, c *redis.Client) Model {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *customPaymentModel) FindListByPlatform(ctx context.Context, platform string) ([]*Payment, error) {
|
||||
var resp []*Payment
|
||||
err := m.QueryNoCacheCtx(ctx, &resp, func(conn *gorm.DB, v interface{}) error {
|
||||
return conn.Model(&Payment{}).Where("platform = ?", platform).Find(v).Error
|
||||
})
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (m *customPaymentModel) FindOneByPaymentToken(ctx context.Context, token string) (*Payment, error) {
|
||||
var resp *Payment
|
||||
key := cachePaymentTokenPrefix + token
|
||||
|
||||
Reference in New Issue
Block a user