23 lines
470 B
Go
23 lines
470 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"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
|
||
|
}
|