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

94 lines
2.7 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. var applies []md.WithdrawApplyInfo
  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{"alipay_user_info", "alipay"}, "usera.id = alipay.uid").
  11. Join("LEFT OUTER", []string{"wx_user_info", "wx"}, "usera.id = wx.uid")
  12. if req.Uid != "0" && req.Uid != "" {
  13. session = session.Where("usera.id = ?", req.Uid)
  14. }
  15. if req.Nickname != "" {
  16. session = session.Where("usera.nickname = ?", req.Nickname)
  17. }
  18. if req.Phone != "" {
  19. session = session.Where("usera.phone = ?", req.Phone)
  20. }
  21. if req.ParentID != "0" && req.ParentID != "" {
  22. session = session.Where("usera.parent_uid = ?", req.ParentID)
  23. }
  24. switch req.IsFirst {
  25. case "1":
  26. // 首次提现
  27. session = session.Where("apply.is_first = ?", req.IsFirst)
  28. case "0":
  29. session = session.Where("apply.is_first = ?", req.IsFirst)
  30. }
  31. if req.WithdrawType != "" {
  32. session = session.Where("apply.withdraw_kind = ?", req.WithdrawType)
  33. }
  34. if req.WithdrawAccount != "" {
  35. session = session.Where("apply.withdraw_account = ?", req.WithdrawAccount)
  36. }
  37. if req.WithdrawName != "" {
  38. session = session.Where("apply.withdraw_name = ?", req.WithdrawName)
  39. }
  40. if req.PaymentType != "" {
  41. session = session.Where("apply.type = ?", req.PaymentType)
  42. }
  43. if req.State != "" {
  44. session = session.Where("apply.state = ?", req.State)
  45. }
  46. if req.ApplyStartAt != "" {
  47. session = session.Where("apply.create_at > ?", req.ApplyStartAt)
  48. }
  49. if req.ApplyEndAt != "" {
  50. session = session.Where("apply.create_at < ?", req.ApplyEndAt)
  51. }
  52. if req.ExamineStartAt != "" {
  53. session = session.Where("apply.update_at > ?", req.ExamineStartAt)
  54. }
  55. if req.ExamineEndAt != "" {
  56. session = session.Where("apply.update_at < ?", req.ExamineEndAt)
  57. }
  58. if req.AmountBegin != "" {
  59. session = session.Where("apply.amount > ?", req.AmountBegin)
  60. }
  61. if req.AmountEnd != "" {
  62. session = session.Where("apply.amount < ?", req.AmountEnd)
  63. }
  64. if req.Level != "" {
  65. session = session.Where("usera.level = ?", req.Level)
  66. }
  67. total, err := session.Select("apply.*, alipay.open_id as alipay_open_id, alipay.user_name as alipay_user_name,"+
  68. " wx.user_id as wx_user_id, wx.user_name as wx_user_name,"+
  69. " usera.system_invite_code as system_invite_code, usera.custom_invite_code as custom_invite_code").
  70. Limit(req.Limit, (req.Page-1)*req.Limit).Asc("apply.id").FindAndCount(&applies)
  71. if err != nil {
  72. return nil, 0, err
  73. }
  74. return &applies, total, nil
  75. }