蛋蛋星球 后台端
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.
 
 
 
 

92 lines
2.5 KiB

  1. package financial_center
  2. import (
  3. md "applet/app/md/financial_center"
  4. "xorm.io/xorm"
  5. )
  6. func WithDrawManagementGetApply(engine *xorm.Engine, req *md.GetWithdrawApplyListReq) (*[]md.WithdrawApplyInfo, int64, error) {
  7. applies := make([]md.WithdrawApplyInfo, 0)
  8. session := engine.Table("fin_withdraw_apply").Alias("apply").
  9. Join("LEFT OUTER", []string{"user", "usera"}, "usera.id = apply.uid").
  10. Join("LEFT OUTER", []string{"user", "userb"}, "userb.id = usera.parent_uid").
  11. Join("LEFT OUTER", []string{"user_tag_records", "tag"}, "tag.uid = apply.id").
  12. Join("LEFT OUTER", []string{"user_wallet_flow", "wallet_flow"}, "wallet_flow.ord_id = apply.id")
  13. if req.Uid != "0" && req.Uid != "" {
  14. session = session.Where("usera.uid = ?", req.Uid)
  15. }
  16. if req.Nickname != "" {
  17. session = session.Where("usera.nickname = ?", req.Nickname)
  18. }
  19. if req.Phone != "" {
  20. session = session.Where("usera.phone = ?", req.Phone)
  21. }
  22. if req.ParentID != "0" && req.ParentID != "" {
  23. session = session.Where("userb.parent_id = ?", req.ParentID)
  24. }
  25. switch req.IsFirst {
  26. case "1":
  27. // 首次提现
  28. session = session.Where("apply.is_first", req.IsFirst)
  29. case "0":
  30. session = session.Where("apply.is_first", req.IsFirst)
  31. }
  32. if req.WithdrawType != "0" {
  33. session = session.Where("apply.withdraw_kind = ?", req.WithdrawType)
  34. }
  35. if req.WithdrawAccount != "" {
  36. session = session.Where("apply.withdraw_account = ?", req.WithdrawAccount)
  37. }
  38. if req.WithdrawName != "" {
  39. session = session.Where("apply.withdraw_name = ?", req.WithdrawName)
  40. }
  41. if req.PaymentType != "" {
  42. session = session.Where("apply.type = ?", req.PaymentType)
  43. }
  44. if req.State != "" {
  45. session = session.Where("apply.state = ?", req.State)
  46. }
  47. if req.ApplyStartAt != "" {
  48. session = session.Where("apply.create_at > ?", req.ApplyStartAt)
  49. }
  50. if req.ApplyEndAt != "" {
  51. session = session.Where("apply.create_at < ?", req.ApplyEndAt)
  52. }
  53. if req.ExamineStartAt != "" {
  54. session = session.Where("apply.update_at > ?", req.ExamineStartAt)
  55. }
  56. if req.ExamineEndAt != "" {
  57. session = session.Where("apply.update_at < ?", req.ExamineEndAt)
  58. }
  59. if req.AmountBegin != "" {
  60. session = session.Where("apply.amount > ?", req.AmountBegin)
  61. }
  62. if req.AmountEnd != "" {
  63. session = session.Where("apply.amount < ?", req.AmountEnd)
  64. }
  65. if req.Level != "" {
  66. session = session.Where("usera.level = ?", req.Level)
  67. }
  68. total, err := session.Limit(req.Limit, (req.Page-1)*req.Limit).Asc("apply.id").FindAndCount(&applies)
  69. if err != nil {
  70. return nil, 0, err
  71. }
  72. return &applies, total, nil
  73. }