42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
// Package method 业务逻辑方法包,实现反馈相关的业务操作
|
||
package method
|
||
|
||
import (
|
||
"context"
|
||
"time"
|
||
|
||
"bsm/full/module/base/feedback/internal/impl"
|
||
"bsm/full/module/base/feedback/internal/models"
|
||
pb "bsm/full/module/base/feedback/pb"
|
||
"git.apinb.com/bsm-sdk/core/vars"
|
||
"git.apinb.com/bsm-sdk/engine/exception"
|
||
)
|
||
|
||
// Remark 添加或更新反馈记录的备注和状态
|
||
// ctx: 上下文
|
||
// in: 备注请求参数,包含记录ID、备注内容和状态
|
||
// 返回: 操作结果
|
||
func Remark(ctx context.Context, in *pb.RemarkRequest) (reply *pb.StatusReply, err error) {
|
||
// 验证请求参数
|
||
if in.GetIdentity() == "" {
|
||
return nil, exception.ErrInvalidArgument
|
||
}
|
||
|
||
// 构建更新记录
|
||
record := &models.FeedbackItem{
|
||
Remark: in.GetRemark(), // 备注内容
|
||
Status: in.GetStatus(), // 状态
|
||
}
|
||
|
||
// 更新记录的备注和状态
|
||
err = impl.DBService.Where("identity = ?", in.GetIdentity()).Updates(record).Error
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
|
||
return &pb.StatusReply{
|
||
Message: vars.OK,
|
||
Timeseq: time.Now().UnixMilli(),
|
||
}, nil
|
||
}
|