附近小店
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

75 lignes
1.9 KiB

  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "strings"
  6. "xorm.io/xorm"
  7. )
  8. func GetStoreWithdraw(eg *xorm.Engine, arg map[string]string) (*[]model.CommunityTeamStoreWithdrawApply, int64) {
  9. var data []model.CommunityTeamStoreWithdrawApply
  10. sess := CommWhere(eg, arg)
  11. limit := utils.StrToInt(arg["size"])
  12. start := (utils.StrToInt(arg["p"]) - 1) * limit
  13. if limit > 0 {
  14. sess.Limit(limit, start)
  15. }
  16. count, err := sess.Desc("id").FindAndCount(&data)
  17. if err != nil {
  18. return nil, count
  19. }
  20. return &data, count
  21. }
  22. func CommWhere(eg *xorm.Engine, arg map[string]string) *xorm.Session {
  23. sess := eg.Where("1=1")
  24. if arg["store_uid"] != "" {
  25. sess.And("uid=?", arg["store_uid"])
  26. }
  27. if arg["parent_uid"] != "" {
  28. sess.And("parent_uid=?", arg["parent_uid"])
  29. }
  30. if arg["state"] != "" {
  31. sess.And("state=?", arg["state"])
  32. }
  33. if arg["ids"] != "" {
  34. sess.In("id", strings.Split(arg["ids"], ","))
  35. }
  36. if arg["alipay_account"] != "" {
  37. sess.And("withdraw_account like ?", "%"+arg["alipay_account"]+"%")
  38. }
  39. if arg["alipay_name"] != "" {
  40. sess.And("withdraw_name like ?", "%"+arg["alipay_name"]+"%")
  41. }
  42. if arg["store_name"] != "" {
  43. var data1 []model.CommunityTeamStore
  44. eg.Where("name like ?", "%"+arg["store_name"]+"%").Find(&data1)
  45. uid := []int{-1}
  46. for _, v := range data1 {
  47. uid = append(uid, v.Uid)
  48. }
  49. sess.In("uid", uid)
  50. }
  51. if arg["start_time"] != "" {
  52. sess.And("create_at>=?", arg["start_time"])
  53. }
  54. if arg["end_time"] != "" {
  55. sess.And("create_at<=?", arg["end_time"])
  56. }
  57. if arg["payment_start_time"] != "" {
  58. sess.And("payment_date>=?", arg["payment_start_time"])
  59. }
  60. if arg["payment_end_time"] != "" {
  61. sess.And("payment_date<=?", arg["payment_end_time"])
  62. }
  63. return sess
  64. }
  65. func GetStoreWithdrawById(sess *xorm.Session, id string) *model.CommunityTeamStoreWithdrawApply {
  66. var data model.CommunityTeamStoreWithdrawApply
  67. get, err := sess.Where("id=?", id).Get(&data)
  68. if get == false || err != nil {
  69. return nil
  70. }
  71. return &data
  72. }