refactor: reorganize modules and add Linux build tooling
This commit is contained in:
48
module/base/feedback/internal/logic/method/ref.go
Normal file
48
module/base/feedback/internal/logic/method/ref.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// Package method 业务逻辑方法包,实现反馈相关的业务操作
|
||||
package method
|
||||
|
||||
import (
|
||||
"bsm/full/module/base/feedback/internal/models"
|
||||
pb "bsm/full/module/base/feedback/pb"
|
||||
"git.apinb.com/bsm-sdk/core/vars"
|
||||
)
|
||||
|
||||
// convert 将数据库模型转换为protobuf响应格式
|
||||
// item: 数据库中的反馈记录模型
|
||||
// 返回: protobuf格式的反馈记录指针
|
||||
func convert(item models.FeedbackItem) *pb.FeedbackItem {
|
||||
reply := &pb.FeedbackItem{
|
||||
Identity: item.Identity, // 记录唯一标识
|
||||
UserName: item.UserName, // 用户名
|
||||
Email: item.Email, // 邮箱
|
||||
Phone: item.Phone, // 手机号
|
||||
Status: item.Status, // 状态
|
||||
Title: item.Title, // 标题
|
||||
Content: item.Content, // 内容
|
||||
Remark: item.Remark, // 备注
|
||||
Category: item.Category, // 分类
|
||||
CreatedAt: item.CreatedAt.Format(vars.YYYY_MM_DD_HH_MM_SS), // 创建时间
|
||||
UpdatedAt: item.UpdatedAt.Format(vars.YYYY_MM_DD_HH_MM_SS), // 更新时间
|
||||
}
|
||||
|
||||
// 转换图片信息
|
||||
for _, image := range item.Images {
|
||||
reply.Images = append(reply.Images, &pb.FeedbackImage{
|
||||
Identity: image.Identity, // 图片唯一标识
|
||||
ItemIdentity: image.ItemIdentity, // 关联的反馈记录ID
|
||||
Url: image.URL, // 图片URL
|
||||
})
|
||||
}
|
||||
|
||||
// 转换附件信息
|
||||
for _, accessory := range item.Accessories {
|
||||
reply.Accessories = append(reply.Accessories, &pb.FeedbackAccessory{
|
||||
Identity: accessory.Identity, // 附件唯一标识
|
||||
ItemIdentity: accessory.ItemIdentity, // 关联的反馈记录ID
|
||||
Title: accessory.Title, // 附件标题
|
||||
FilePath: accessory.FilePath, // 附件文件路径
|
||||
})
|
||||
}
|
||||
|
||||
return reply
|
||||
}
|
||||
Reference in New Issue
Block a user