youtu_ecpm/api/gin/service/app_account.go
2025-01-20 00:14:43 +08:00

23 lines
500 B
Go

package service
import (
"context"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
)
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
}