MCPcopy
hub / github.com/QuantumNous/new-api / CountUserSubscriptionsByPlan

Function CountUserSubscriptionsByPlan

model/subscription.go:403–414  ·  view source on GitHub ↗
(userId int, planId int)

Source from the content-addressed store, hash-verified

401}
402
403func CountUserSubscriptionsByPlan(userId int, planId int) (int64, error) {
404 if userId <= 0 || planId <= 0 {
405 return 0, errors.New("invalid userId or planId")
406 }
407 var count int64
408 if err := DB.Model(&UserSubscription{}).
409 Where("user_id = ? AND plan_id = ?", userId, planId).
410 Count(&count).Error; err != nil {
411 return 0, err
412 }
413 return count, nil
414}
415
416func getUserGroupByIdTx(tx *gorm.DB, userId int) (string, error) {
417 if userId <= 0 {

Calls

no outgoing calls

Tested by

no test coverage detected