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

44 lines
1.1 KiB

  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetStoreQrcode(eg *xorm.Engine, args map[string]string) (*[]model.CommunityTeamStoreQrcode, int64) {
  8. var data []model.CommunityTeamStoreQrcode
  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 GetStoreQrcodeById(eg *xorm.Engine, id string) *model.CommunityTeamStoreQrcode {
  19. var data model.CommunityTeamStoreQrcode
  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) *model.CommunityTeamStorePayQrcode {
  27. var data model.CommunityTeamStorePayQrcode
  28. get, err := eg.Where("uid=?", uid).Get(&data)
  29. if get == false {
  30. data = model.CommunityTeamStorePayQrcode{
  31. Uid: uid,
  32. IsUse: 1,
  33. Name: "收款码",
  34. }
  35. eg.Insert(&data)
  36. }
  37. if err != nil {
  38. return nil
  39. }
  40. return &data
  41. }