carv api logic

This commit is contained in:
lianghuanjie
2025-01-08 17:53:43 +08:00
parent 5c4862fd70
commit 5d2a0a8b5d
14 changed files with 252 additions and 62 deletions

View File

@@ -39,6 +39,7 @@ type ServiceContext struct {
StakePropertyModel model.NhNftStakePropertyModel
EmailRewardModel model.NhEmailRewardModel
AmbassadorModel model.NhTaskAmbassadorModel
GameReportModel model.NhGameReportModel
ApiKeyCheck rest.Middleware
AdminSecretCheck rest.Middleware
@@ -74,6 +75,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
StakePropertyModel: model.NewNhNftStakePropertyModel(dbConn),
EmailRewardModel: model.NewNhEmailRewardModel(dbConn),
AmbassadorModel: model.NewNhTaskAmbassadorModel(dbConn),
GameReportModel: model.NewNhGameReportModel(dbConn),
ApiKeyCheck: middleware.NewApiKeyCheckMiddleware(configModel).Handle,
AdminSecretCheck: middleware.NewAdminSecretCheckMiddleware(configModel).Handle,
@@ -121,7 +123,7 @@ func (s *ServiceContext) HasBindTwitter(ctx context.Context, uid uint) bool {
return tw.TwitterId != ""
}
func (s *ServiceContext) FindUserByEmail(ctx context.Context, email string) (uint, *types.CarvResult) {
func (s *ServiceContext) GetUidByEmail(ctx context.Context, email string) (uint, *types.CarvResult) {
u, err := s.UserModel.FindOneByEmail(ctx, email)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {