代码拉取完成,页面将自动刷新
package userlogic
import (
"context"
"gitee.com/lzzandlyx/users/model/history"
"github.com/jinzhu/copier"
"gitee.com/lzzandlyx/users/internal/svc"
"gitee.com/lzzandlyx/users/user"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateHistoryLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateHistoryLogic {
return &CreateHistoryLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *CreateHistoryLogic) CreateHistory(in *user.CreateHistoryRequest) (*user.CreateHistoryResponse, error) {
res, err := l.svcCtx.ModelHistory.CreateHistory(l.ctx, &history.BrowseHistory{
UserId: in.Info.UserId,
GoodsId: in.Info.GoodsId,
Title: in.Info.Title,
Price: in.Info.Price,
Cover: in.Info.Cover,
BrowseDate: in.Info.BrowseDate,
})
var resInfo user.HistoryInfo
err = copier.Copy(&resInfo, res)
if err != nil {
return nil, err
}
return &user.CreateHistoryResponse{
Info: &resInfo,
}, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。