add: 新增ci diamanté
This commit is contained in:
@@ -72,6 +72,7 @@ type customUserLogicModel interface {
|
||||
BatchDeleteUser(ctx context.Context, ids []int64, tx ...*gorm.DB) error
|
||||
InsertSubscribe(ctx context.Context, data *Subscribe, tx ...*gorm.DB) error
|
||||
FindOneSubscribeByToken(ctx context.Context, token string) (*Subscribe, error)
|
||||
FindSingleModeAnchorSubscribe(ctx context.Context, userId int64) (*Subscribe, error)
|
||||
FindOneSubscribeByOrderId(ctx context.Context, orderId int64) (*Subscribe, error)
|
||||
FindOneSubscribe(ctx context.Context, id int64) (*Subscribe, error)
|
||||
UpdateSubscribe(ctx context.Context, data *Subscribe, tx ...*gorm.DB) error
|
||||
|
||||
@@ -49,6 +49,20 @@ func (m *defaultUserModel) FindOneSubscribeByOrderId(ctx context.Context, orderI
|
||||
return &data, err
|
||||
}
|
||||
|
||||
// FindSingleModeAnchorSubscribe finds the latest paid subscription for single subscribe mode routing.
|
||||
func (m *defaultUserModel) FindSingleModeAnchorSubscribe(ctx context.Context, userId int64) (*Subscribe, error) {
|
||||
var data Subscribe
|
||||
err := m.QueryNoCacheCtx(ctx, &data, func(conn *gorm.DB, _ interface{}) error {
|
||||
return conn.Model(&Subscribe{}).
|
||||
Where("user_id = ? AND order_id > 0 AND token != '' AND `status` IN ?", userId, []int64{0, 1, 2, 3, 5}).
|
||||
Order("expire_time DESC").
|
||||
Order("updated_at DESC").
|
||||
Order("id DESC").
|
||||
First(&data).Error
|
||||
})
|
||||
return &data, err
|
||||
}
|
||||
|
||||
func (m *defaultUserModel) FindOneSubscribe(ctx context.Context, id int64) (*Subscribe, error) {
|
||||
var data Subscribe
|
||||
key := fmt.Sprintf("%s%d", cacheUserSubscribeIdPrefix, id)
|
||||
|
||||
Reference in New Issue
Block a user