fix: value type
This commit is contained in:
@@ -3,10 +3,12 @@ package task
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"nova_task/internal/model"
|
||||
"nova_task/internal/pkg/errs"
|
||||
"nova_task/internal/pkg/utils"
|
||||
"time"
|
||||
|
||||
"nova_task/internal/svc"
|
||||
@@ -31,7 +33,8 @@ func NewGetTaskRewardLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||
}
|
||||
|
||||
func (l *GetTaskRewardLogic) GetTaskReward(req *types.TaskIdPath) (*types.GetTaskRewardResp, error) {
|
||||
uid := cast.ToStringMapInt(l.ctx.Value("data"))["id"]
|
||||
//uid := cast.ToStringMapInt(l.ctx.Value("data"))["id"]
|
||||
uid := utils.GetUid(l.ctx)
|
||||
task, err := l.svcCtx.TaskModel.FindOne(l.ctx, req.ID)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
@@ -67,7 +70,7 @@ func (l *GetTaskRewardLogic) GetTaskReward(req *types.TaskIdPath) (*types.GetTas
|
||||
return err
|
||||
}
|
||||
// 给予用户奖励
|
||||
err = l.svcCtx.TaskAssetModel.WithSession(session).AddPoint(l.ctx, uid, task.Points)
|
||||
err = l.svcCtx.TaskAssetModel.WithSession(session).AddPoint(l.ctx, uint(uid), decimal.NewFromInt(int64(task.Points)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user