附近小店
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_card.go 687 B

2 months ago
12345678910111213141516171819202122232425262728
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetCard(eg *xorm.Engine, arg map[string]string) *[]model.CommunityTeamCard {
  8. var data []model.CommunityTeamCard
  9. sess := eg.Where("1=1")
  10. limit := utils.StrToInt(arg["size"])
  11. start := (utils.StrToInt(arg["p"]) - 1) * limit
  12. err := sess.OrderBy("sort desc,id desc").Limit(limit, start).Find(&data)
  13. if err != nil {
  14. return nil
  15. }
  16. return &data
  17. }
  18. func GetCardDetail(eg *xorm.Engine, arg map[string]string) *model.CommunityTeamCard {
  19. var data model.CommunityTeamCard
  20. sess := eg.Where("id=?", arg["id"])
  21. get, err := sess.Get(&data)
  22. if err != nil || get == false {
  23. return nil
  24. }
  25. return &data
  26. }