12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package models
- import (
- "fmt"
- "hongze/hongze_task/utils"
- "rdluck_tools/orm"
- "time"
- )
- type Report struct {
- Id int
- Content string
- ContentSub string
- }
- func GetReport() (items []*Report, err error) {
- sql := `SELECT * FROM report ORDER BY id ASC `
- o := orm.NewOrm()
- o.Using("rddp")
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- func ModifyReportContentSub(id int, contentSub string) (err error) {
- sql := `UPDATE report SET content_sub=? WHERE id=? `
- o := orm.NewOrm()
- o.Using("rddp")
- _, err = o.Raw(sql, contentSub, id).Exec()
- return
- }
- func GetReportLimit() (items []*Report, err error) {
- sql := `SELECT * FROM report WHERE state=2 ORDER BY id DESC LIMIT 50 `
- o := orm.NewOrm()
- o.Using("rddp")
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- func EditReportContent(reportId int, content, contentSub string) (err error) {
- o := orm.NewOrm()
- o.Using("rddp")
- sql := ` UPDATE report SET content=?,content_sub=?,modify_time=NOW() WHERE id=? `
- _, err = o.Raw(sql, content, contentSub, reportId).Exec()
- return
- }
- //删除报告日志记录-保留3个月
- func DeleteReportSaveLog() {
- startDateTime:=time.Now().AddDate(0,-3,0).Format(utils.FormatDateTime)
- fmt.Println(startDateTime)
- }
|