添加计划类型
parent
63d45eabcc
commit
9d30483171
|
@ -98,7 +98,6 @@ func (m *ReqDate) TableName() string {
|
|||
}
|
||||
|
||||
func (this *PlanController) PlanDay(c *gin.Context) {
|
||||
|
||||
var req ReqDate
|
||||
resp := RespBase{
|
||||
Msg: "ERROR",
|
||||
|
@ -123,3 +122,20 @@ func (this *PlanController) PlanDay(c *gin.Context) {
|
|||
resp.Msg = "OK"
|
||||
resp.Status = 0
|
||||
}
|
||||
|
||||
func (this *PlanController) Types(c *gin.Context) {
|
||||
resp := RespBase{
|
||||
Msg: "ERROR",
|
||||
Status: 23,
|
||||
}
|
||||
defer c.JSON(200, &resp)
|
||||
rets := []model.PlanType{}
|
||||
e := db.GetOrm().Model(&model.PlanType{}).Find(&rets).Error
|
||||
if nil != e {
|
||||
log.Print(e.Error())
|
||||
return
|
||||
}
|
||||
resp.Data = rets
|
||||
resp.Msg = "OK"
|
||||
resp.Status = 0
|
||||
}
|
||||
|
|
1
main.go
1
main.go
|
@ -180,6 +180,7 @@ func main() {
|
|||
api.PUT("/plan", planController.AddPlan) // 添加计划
|
||||
api.DELETE("/plan", planController.DelPlan) // 删除计划
|
||||
api.POST("/plan_days", planController.PlanDay) // 获取本月有计划天数
|
||||
api.GET("/plan_types",planController.Types)
|
||||
api.GET("planDays")
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,18 @@ type Plan struct {
|
|||
EndTime utils.OrmTime `gorm:"column:end_time" json:"end_time"`
|
||||
Date string `gorm:"column:date" json:"date"`
|
||||
Content string `gorm:"column:content" json:"content"`
|
||||
Type uint32 `gorm:"column:type" json:"type"`
|
||||
}
|
||||
|
||||
|
||||
type PlanType struct {
|
||||
ID uint32 `gorm:"column:id;primary_key" json:"id"`
|
||||
TypeName string `gorm:"column:type_name;" json:"type_name"`
|
||||
}
|
||||
|
||||
func (m *PlanType) TableName() string {
|
||||
return "plan_type"
|
||||
}
|
||||
func (m *Plan) TableName() string {
|
||||
return "plan"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue