1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package models
- import "rdluck_tools/orm"
- 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
- }
|