- Go Gin 后端 (19个源文件): 认证、工单CRUD、GLM AI分析、状态流转、备注、操作日志 - Arco Design Vue 前端: 登录、工单列表/详情/创建、AI分析触发与确认 - MySQL 5表: ticket_user/ticket_info/ticket_ai_analysis/ticket_operation_log/ticket_note - 部署: tk.1216.top HTTPS, Nginx反代
32 lines
707 B
Go
32 lines
707 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/casehub/ticket-workbench/internal/model"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func ListNotes(db *gorm.DB, ticketid int) ([]model.TicketNote, error) {
|
|
var notes []model.TicketNote
|
|
err := db.Where("ticketid = ?", ticketid).Order("createtime ASC").Find(¬es).Error
|
|
return notes, err
|
|
}
|
|
|
|
func AddNote(db *gorm.DB, ticketid, authorid int, content string) (*model.TicketNote, error) {
|
|
note := &model.TicketNote{
|
|
Ticketid: ticketid,
|
|
Authorid: authorid,
|
|
Content: content,
|
|
Createtime: time.Now(),
|
|
}
|
|
|
|
if err := db.Create(note).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
AddOperationLog(db, ticketid, authorid, "note", "添加备注: "+content)
|
|
|
|
return note, nil
|
|
}
|