From e8cfa46cf8a3bdc6c3902cd52aaf3eadff0712df Mon Sep 17 00:00:00 2001 From: "DESKTOP-4RNDQIC\\29019" <290198252@qq.com> Date: Mon, 8 Mar 2021 23:59:50 +0800 Subject: [PATCH] no message --- main.go | 6 +++--- model/model.go | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 336ebff..4ef6e5b 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,7 @@ func CORSMiddleware(c *gin.Context) { c.Writer.Header().Set("Access-Control-Allow-Origin", "https://testingcloud.club") } else { - c.Writer.Header().Set("Access-Control-Allow-Origin", "*") + c.Writer.Header().Set("Access-Control-Allow-Origin", "http://localhost:8080") } c.Writer.Header().Set("Access-Control-Max-Age", "86400") c.Writer.Header().Set("Access-Control-Allow-Headers", @@ -98,7 +98,6 @@ func main() { InitLogs() InitRedisConfig() InitMysql() - // InitElasticSearch() r := gin.Default() store := sessions.NewCookieStore([]byte("secret123")) @@ -182,7 +181,8 @@ func main() { api.DELETE("/plan", planController.DelPlan) // 删除计划 api.POST("/plan_days", planController.PlanDay) // 获取本月有计划天数 api.GET("/plan_types", planController.Types) - api.GET("planDays") + + api.PUT("/undo",planController.CreateUndo) } openapi := r.Group("openapi") diff --git a/model/model.go b/model/model.go index 29cc5a0..be43857 100644 --- a/model/model.go +++ b/model/model.go @@ -32,6 +32,9 @@ type PlanType struct { TypeName string `gorm:"column:type_name;" json:"type_name"` } +func (m *Undo) TableName() string { + return "undo" +} func (m *PlanType) TableName() string { return "plan_type" }