fix: value type
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"nova_task/internal/logic/admin"
|
||||
"nova_task/internal/svc"
|
||||
"nova_task/internal/types"
|
||||
)
|
||||
|
||||
// 每日钱包签到任务
|
||||
func AddEmialRewardHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.EmailReward
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := admin.NewAddEmialRewardLogic(r.Context(), svcCtx)
|
||||
err := l.AddEmialReward(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func (m *customNhTaskNftStakeModel) StakeNft(ctx context.Context, uid uint, role
|
||||
Operate: 1,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorw("insert stake log failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("tokenId", token), logx.Field("role", roleId))
|
||||
logx.Errorw("insert stake log failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("tokenId", tokenId), logx.Field("role", roleId))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user