feed_back.go 887 B

123456789101112131415161718192021222324252627282930313233
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type FeedBack struct {
  7. Id int ` description:"ID"`
  8. UserId string `description:"用户ID"`
  9. Mobile string `description:"手机号"`
  10. Message string `description:"反馈"`
  11. CreatedTime time.Time `description:"创建时间"`
  12. }
  13. type FeedBackView struct {
  14. Mobile string `json:"Mobile"`
  15. Message string `json:"Message"`
  16. CreatedTime string `json:"CreatedTime"`
  17. }
  18. func GetFeedBackCount() (count int, err error) {
  19. o := orm.NewOrm()
  20. sql := `SELECT COUNT(*) AS count FROM feed_backs`
  21. err = o.Raw(sql).QueryRow(&count)
  22. return
  23. }
  24. func GetFeedBackList(startSize, pageSize int) (item []*FeedBack, err error) {
  25. o := orm.NewOrm()
  26. sql := `SELECT * FROM feed_backs ORDER BY created_time desc LIMIT ?,?`
  27. _, err = o.Raw(sql, startSize, pageSize).QueryRows(&item)
  28. return
  29. }