添加代办事项相关接口

master
zcy 2021-03-05 10:18:59 +08:00
parent 88b9cd5a9d
commit e2ca2baa65
3 changed files with 132 additions and 25 deletions

View File

@ -2,6 +2,7 @@ package controller
import (
"background/db"
"background/logs"
"background/model"
"fmt"
"log"
@ -139,3 +140,100 @@ func (this *PlanController) Types(c *gin.Context) {
resp.Msg = "OK"
resp.Status = 0
}
func (this *PlanController) CreateUndo(c *gin.Context) {
resp := RespBase{}
defer func() {
c.JSON(200, resp)
}()
var req model.Undo
e := c.BindJSON(&req)
if nil != e {
logs.Error(e.Error())
resp.Msg = "wrong input"
return
}
e = db.GetOrm().Model(&model.Undo{}).Create(&req).Error
if nil != e {
log.Print(e.Error())
return
}
resp.Data = nil
resp.Msg = "OK"
resp.Status = 0
}
func (this *PlanController) UpdateUndo(c *gin.Context) {
resp := RespBase{}
defer func() {
c.JSON(200, resp)
}()
var req model.Book
e := c.BindJSON(&req)
if nil != e {
resp.Msg = "wrong input"
return
}
e = db.GetOrm().Model(&model.Book{}).Update(&req).Error
if nil != e {
logs.Error(e.Error())
return
}
resp.Data = nil
resp.Msg = "OK"
resp.Status = 0
}
func (this *PlanController) GetUndo(c *gin.Context) {
type ReqGetUndo struct {
}
var req ReqGetUndo
resp := RespBase{}
defer func() {
c.JSON(200, resp)
}()
e := c.BindJSON(&req)
if nil != e {
logs.Error(e.Error())
return
}
}
func (this *PlanController) GetPageUndo(c *gin.Context) {
type ReqGetPageUndo struct {
}
var req ReqGetPageUndo
resp := RespBase{}
// limit := c.Query("limit")
// offset := c.Query("offset")
// iLmit, e := strconv.Atoi(limit)
// if nil != e {
// return
// }
// iOffset, e := strconv.Atoi(offset)
// if nil != e {
// return
// }
defer func() {
c.JSON(200, resp)
}()
e := c.BindJSON(&req)
if nil != e {
logs.Error(e.Error())
return
}
}
func DeleteUndo(c *gin.Context) {
resp := RespBase{}
defer func() {
c.JSON(200, resp)
}()
type ReqDeleteUndo struct {
}
}

View File

@ -4,8 +4,9 @@ import (
"background/db"
"background/logs"
"fmt"
"qiniupkg.com/x/log.v7"
"strings"
"qiniupkg.com/x/log.v7"
)
type Memo struct {

View File

@ -18,6 +18,14 @@ type Plan struct {
Type uint32 `gorm:"column:type" json:"type"`
}
type Undo struct {
ID int32 `json:"id" gorm:"column:id" sql:"id"`
Content string `json:"content" gorm:"column:content" sql:"content"`
SpendTime int32 `json:"spend_time" gorm:"column:spend_time" sql:"spend_time"`
Child int32 `json:"child" gorm:"column:child" sql:"child"`
Level int32 `json:"level" gorm:"column:level" sql:"level"`
Type int32 `json:"type" gorm:"column:type" sql:"type"`
}
type PlanType struct {
ID uint32 `gorm:"column:id;primary_key" json:"id"`