附近小店
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

db_store_withdraw.go 1.8 KiB

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