附近小店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_notice.go 1.1 KiB

1 kuukausi sitten
1 kuukausi sitten
12345678910111213141516171819202122232425262728293031323334353637383940
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetBankNotice(eg *xorm.Engine, args map[string]string) *[]model.CommunityTeamStoreNotice {
  8. var data []model.CommunityTeamStoreNotice
  9. size := utils.StrToInt(args["size"])
  10. start := (utils.StrToInt(args["p"]) - 1) * size
  11. err := eg.Where("uid=?", args["uid"]).Limit(size, start).OrderBy("id desc").Find(&data)
  12. if err != nil {
  13. return nil
  14. }
  15. return &data
  16. }
  17. func GetBankNoticeAll(eg *xorm.Engine, args map[string]string) (*[]model.CommunityTeamStoreNotice, int64) {
  18. var data []model.CommunityTeamStoreNotice
  19. size := utils.StrToInt(args["size"])
  20. start := (utils.StrToInt(args["p"]) - 1) * size
  21. sess := eg.Where("uid=?", args["uid"])
  22. if args["title"] != "" {
  23. sess.And("title like ?", "%"+args["title"]+"%")
  24. }
  25. count, err := sess.Limit(size, start).OrderBy("id desc").FindAndCount(&data)
  26. if err != nil {
  27. return nil, count
  28. }
  29. return &data, count
  30. }
  31. func GetNotice(eg *xorm.Engine, id string) *model.CommunityTeamStoreNotice {
  32. var data model.CommunityTeamStoreNotice
  33. get, err := eg.Where("id=?", id).Get(&data)
  34. if get == false || err != nil {
  35. return nil
  36. }
  37. return &data
  38. }