18 lines
404 B
Go
18 lines
404 B
Go
package order
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/perfect-panel/server/internal/model/user"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func paidSubscriptionQuery(ctx context.Context, db *gorm.DB, userID int64) *gorm.DB {
|
|
return db.WithContext(ctx).
|
|
Model(&user.Subscribe{}).
|
|
Where("user_id = ? AND (order_id > 0 OR token LIKE 'iap:%')", userID).
|
|
Order("expire_time DESC").
|
|
Order("updated_at DESC").
|
|
Order("id DESC")
|
|
}
|