fix version 1
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"bsm/full/module/base/feedback/internal/models"
|
||||
pb "bsm/full/module/base/feedback/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -17,6 +18,12 @@ import (
|
||||
// in: 查询请求参数,包含记录ID
|
||||
// 返回: 反馈记录详情
|
||||
func Get(ctx context.Context, in *pb.GetRequest) (reply *pb.GetReply, err error) {
|
||||
// 解析用户认证信息
|
||||
auth, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 验证请求参数
|
||||
if in.GetIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
@@ -34,8 +41,14 @@ func Get(ctx context.Context, in *pb.GetRequest) (reply *pb.GetReply, err error)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 归属校验:仅本人或管理端可查看
|
||||
allowed := canAccess(auth, record.PassportIdentity)
|
||||
if !allowed {
|
||||
return nil, errcode.ErrPermissionDenied
|
||||
}
|
||||
|
||||
// 转换为响应格式
|
||||
item := convert(*record)
|
||||
item := convert(*record, !allowed)
|
||||
out.Record = item
|
||||
out.Exists = true
|
||||
return out, nil
|
||||
|
||||
Reference in New Issue
Block a user