附近小店
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.
 
 
 

42 lines
1.0 KiB

  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetStorePayQrcode(eg *xorm.Engine, args map[string]string) (*[]model.CommunityTeamStorePayQrcode, int64) {
  8. var data []model.CommunityTeamStorePayQrcode
  9. sess := eg.Where("uid=?", args["uid"])
  10. size := utils.StrToInt(args["size"])
  11. start := (utils.StrToInt(args["p"]) - 1) * size
  12. total, err := sess.Limit(size, start).Desc("id").FindAndCount(&data)
  13. if err != nil {
  14. return nil, total
  15. }
  16. return &data, total
  17. }
  18. func GetStorePayQrcodeById(eg *xorm.Engine, id string) *model.CommunityTeamStorePayQrcode {
  19. var data model.CommunityTeamStorePayQrcode
  20. get, err := eg.Where("id=?", id).Get(&data)
  21. if get == false || err != nil {
  22. return nil
  23. }
  24. return &data
  25. }
  26. func GetStorePayQrcodeByUId(eg *xorm.Engine, uid int) {
  27. var data model.CommunityTeamStorePayQrcode
  28. get, _ := eg.Where("uid=? ", uid).Get(&data)
  29. if get == false {
  30. data = model.CommunityTeamStorePayQrcode{
  31. Id: 0,
  32. Uid: uid,
  33. Type: 0,
  34. IsUse: 1,
  35. Name: "默认",
  36. }
  37. }
  38. return
  39. }