软质押任务修改

This commit is contained in:
lianghuanjie
2025-01-08 16:02:11 +08:00
parent 6dea53e53c
commit 29abba438c
11 changed files with 187 additions and 38 deletions

View File

@@ -2,7 +2,9 @@ package carv
import (
"context"
"errors"
"nova_task/internal/model"
"nova_task/internal/pkg/errs"
"nova_task/internal/svc"
"nova_task/internal/types"
@@ -24,8 +26,32 @@ func NewDownloadAndBindRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext
}
}
func (l *DownloadAndBindRoleLogic) DownloadAndBindRole(req *types.EmailKey) (resp *types.CarvResult, err error) {
// todo: add your logic here and delete this line
func (l *DownloadAndBindRoleLogic) DownloadAndBindRole(req *types.EmailKey) (*types.CarvResult, error) {
uid, errResult := l.svcCtx.FindUserByEmail(l.ctx, req.Email)
if errResult != nil {
return errResult, nil
}
return
pb, err := l.svcCtx.PromoteBindModel.FindOneByInvitedUid(l.ctx, uid)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return &types.CarvResult{Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
Message: "system error",
}}, nil
}
return &types.CarvResult{Result: &types.Result{
IsValid: false,
}}, nil
}
if pb.IsCreateRole == 0 {
return &types.CarvResult{Result: &types.Result{
IsValid: false,
}}, nil
}
return &types.CarvResult{
Result: &types.Result{IsValid: true},
}, nil
}