14 lines
399 B
Go
14 lines
399 B
Go
// 示例:插件接口
|
|
type Plugin interface {
|
|
OnArticleCreate(article *models.Article) // 文章创建钩子
|
|
RegisterRoutes(r *gin.Engine) // 添加新路由
|
|
}
|
|
|
|
// 主题ZIP上传示例
|
|
func handleThemeUpload(c *gin.Context) {
|
|
file, _ := c.FormFile("theme")
|
|
if !strings.HasSuffix(file.Filename, ".zip") {
|
|
c.AbortWithStatus(400)
|
|
}
|
|
// 解压到临时目录并校验文件结构
|
|
} |