add: 新增ci diamanté
This commit is contained in:
@@ -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