优化: 前后端字段对齐、AI分析JSON解析修复、AutoMigrate
- 修复登录参数 username→account - 修复前后端字段名不匹配 (ticketno/contactname/createtime等) - 修复AI分析GLM返回markdown包裹和priority类型问题 - 添加AutoMigrate自动建表 - 统一API路由为 /api/auth/ 前缀 - 添加config.example.yaml,.gitignore排除config.yaml
This commit is contained in:
@@ -14,20 +14,20 @@ type TicketListResult struct {
|
||||
Rows []model.TicketInfo `json:"rows"`
|
||||
}
|
||||
|
||||
func ListTickets(db *gorm.DB, status int16, category string, priority int16, keyword string, page, pageSize int) (*TicketListResult, error) {
|
||||
func ListTickets(db *gorm.DB, status *int16, category string, priority *int16, keyword string, page, pageSize int) (*TicketListResult, error) {
|
||||
var total int64
|
||||
var tickets []model.TicketInfo
|
||||
|
||||
query := db.Model(&model.TicketInfo{})
|
||||
|
||||
if status >= 0 {
|
||||
query = query.Where("status = ?", status)
|
||||
if status != nil {
|
||||
query = query.Where("status = ?", *status)
|
||||
}
|
||||
if category != "" {
|
||||
query = query.Where("category = ?", category)
|
||||
}
|
||||
if priority >= 0 {
|
||||
query = query.Where("priority = ?", priority)
|
||||
if priority != nil {
|
||||
query = query.Where("priority = ?", *priority)
|
||||
}
|
||||
if keyword != "" {
|
||||
query = query.Where("title LIKE ? OR content LIKE ?", "%"+keyword+"%", "%"+keyword+"%")
|
||||
|
||||
Reference in New Issue
Block a user