优化页面、修复BUG

This commit is contained in:
李琦
2026-06-24 17:06:22 +08:00
parent 3f653bc336
commit d5ff40e4d3
38 changed files with 1507 additions and 354 deletions

View File

@@ -12,6 +12,7 @@ type Snippet struct {
Title string `json:"title" gorm:"column:title"`
Code string `json:"code" gorm:"column:code;type:text"`
Type string `json:"type" gorm:"column:type"`
CodeTypeID uint `json:"codeTypeId" gorm:"column:code_type_id"`
Description string `json:"description" gorm:"column:description;type:text"`
ViewCount uint `json:"viewCount" gorm:"column:view_count;default:0"`
CreatedAt int64 `json:"createdAt" gorm:"column:created_at"`
@@ -47,8 +48,12 @@ func (s *Snippet) BeforeUpdate(tx *gorm.DB) error {
// SnippetResponse 代码片段响应模型
type SnippetResponse struct {
ID string `json:"id"`
Title string `json:"title"`
Code string `json:"code"`
Type string `json:"type"`
ID string `json:"id"`
Title string `json:"title"`
Code string `json:"code"`
Type string `json:"type"`
CodeTypeID uint `json:"codeTypeId,omitempty"`
CodeType *CodeTypeResponse `json:"codeType,omitempty"`
Description string `json:"description,omitempty"`
ViewCount uint `json:"viewCount,omitempty"`
}