This commit is contained in:
laodaming
2023-06-02 12:12:51 +08:00
parent 4df573bbc7
commit efd0f28d51
3 changed files with 28 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import (
"fusenapi/model"
"fusenapi/product/internal/svc"
"fusenapi/product/internal/types"
"fusenapi/utils/auth"
"fusenapi/utils/image"
"github.com/zeromicro/go-zero/core/logx"
@@ -26,14 +27,21 @@ func NewGetProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
}
// 获取产品列表
func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, uid int64) (resp *types.Response, err error) {
func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, loginInfo auth.UserInfo) (resp *types.Response, err error) {
//校验前台登录情况
if loginInfo.UserId == 0 {
return &types.Response{
Code: 401,
Message: "please sign in",
}, nil
}
//获取合适尺寸
if req.Size > 0 {
req.Size = image.GetCurrentSize(req.Size)
}
//获取是否存在千人千面
userModel := model.NewFsUserModel(l.svcCtx.MysqlConn)
userInfo, err := userModel.FindOne(l.ctx, uid)
userInfo, err := userModel.FindOne(l.ctx, loginInfo.UserId)
if err != nil {
return nil, err
}