youtu_ecpm/api/gin/service/app_account.go

23 lines
500 B
Go
Raw Permalink Normal View History

2025-01-18 17:56:36 +08:00
package service
import (
"context"
2025-01-20 00:11:11 +08:00
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
2025-01-18 17:56:36 +08:00
)
type AppAccount struct {
q *query.Query
}
func NewAppAccount(q *query.Query) *AppAccount {
return &AppAccount{q: q}
}
func (a *AppAccount) GetAppAccountIdByAppId(ctx context.Context, appId string) (id uint32, err error) {
m, err := a.q.AppAccount.WithContext(ctx).Where(a.q.AppAccount.AppID.Eq(appId)).Select(a.q.AppAccount.ID).Limit(1).First()
if err != nil {
return 0, err
}
return m.ID, nil
}