finish tribally report logic
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"nova_task/internal/pkg/aptos"
|
||||
"nova_task/internal/pkg/errs"
|
||||
"nova_task/internal/pkg/tribally"
|
||||
"nova_task/internal/pkg/utils"
|
||||
"nova_task/internal/svc"
|
||||
"nova_task/internal/types"
|
||||
"time"
|
||||
@@ -32,7 +33,15 @@ func NewVerifyTaskResultLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
||||
}
|
||||
|
||||
func (l *VerifyTaskResultLogic) VerifyTaskResult(req *types.VerifyTaskResultReq) (*types.VerifyTaskResultResp, error) {
|
||||
uid := cast.ToStringMapInt(l.ctx.Value("data"))["id"]
|
||||
uid := utils.GetUid(l.ctx)
|
||||
u, err := l.svcCtx.UserModel.FindOne(l.ctx, uint(uid))
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errs.New(errs.ErrUserNotFound, "user not found")
|
||||
}
|
||||
l.Errorw("find user error", logx.Field("err", err), logx.Field("uid", uid))
|
||||
return nil, errs.New(errs.ErrDatabaseOperate, err)
|
||||
}
|
||||
task, err := l.svcCtx.TaskModel.FindOne(l.ctx, req.ID)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
@@ -103,6 +112,7 @@ func (l *VerifyTaskResultLogic) VerifyTaskResult(req *types.VerifyTaskResultReq)
|
||||
// TriballyUser表中不存在此用户,插入
|
||||
_, err = l.svcCtx.TriballyUserModel.Insert(l.ctx, &model.NhTriballyUser{
|
||||
Uid: uint(uid),
|
||||
Email: u.Email,
|
||||
Chapter: -1,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user