msg.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package model
  2. import (
  3. "fmt"
  4. )
  5. // MSGType .
  6. type MSGType uint8
  7. // const .
  8. const (
  9. // McnSignApplyPass MCN申请MCN管理入口申请成功
  10. McnSignApplyPass = iota + 1
  11. // McnSignNoApplyPass MCN申请MCN管理入口申请未通过
  12. McnSignNoApplyPass
  13. // McnUpBindAuthApply MCN申请和up主绑定申请授权
  14. McnUpBindAuthApply
  15. // McnUpBindAuthReview MCN申请和up主绑定up主同意等待运营审核中
  16. McnUpBindAuthReview
  17. // McnUpBindAuthApplyPass MCN申请和up主绑定up主同意且运营通过
  18. McnUpBindAuthApplyPass
  19. // UpMcnBindAuthApplyPass up主申请和MCN绑定up主同意且运营通过
  20. UpMcnBindAuthApplyPass
  21. // McnUpBindAuthApplyNoPass MCN申请和up主绑定up主同意但运营未通过
  22. McnUpBindAuthApplyNoPass
  23. // UpMcnBindAuthApplyNoPass up主申请和MCN绑定up主同意但运营未通过
  24. UpMcnBindAuthApplyNoPass
  25. // McnUpBindAuthApplyRefuse MCN申请和up主绑定被up主拒绝
  26. McnUpBindAuthApplyRefuse
  27. // UpMcnRelationFreeze MCN和up主纠纷处理 - Up主和MCN关系冻结
  28. UpMcnRelationFreeze
  29. // McnUpRelationFreeze MCN和up主纠纷处理 - MCN和Up主关系冻结
  30. McnUpRelationFreeze
  31. // UpMcnRelationRelease MCN和up主纠纷处理 - Up主和MCN提前解约
  32. UpMcnRelationRelease
  33. // McnUpRelationRelease MCN和up主纠纷处理 - MCN和Up主提前解约
  34. McnUpRelationRelease
  35. // McnBackstageBlock MCN违规账号封禁
  36. McnBackstageBlock
  37. // McnBackstageClose MCN违规账号清退
  38. McnBackstageClose
  39. // McnRenewcontract 续约合同
  40. McnRenewcontract
  41. // McnAccountRestore MCN账号恢复
  42. McnAccountRestore
  43. // McnPermissionOpen MCN新开权限
  44. McnPermissionOpen
  45. // McnPermissionClosed MCN权限关闭
  46. McnPermissionClosed
  47. // McnUpNotAgreeChangePermit UP主不同意授权变更
  48. McnUpNotAgreeChangePermit
  49. // McnOperNotAgreeChangePermit 运营不同意授权变更
  50. McnOperNotAgreeChangePermit
  51. // McnOperAgreeChangePermit 运营同意授权变更
  52. McnOperAgreeChangePermit
  53. // McnApplyUpChangePermit MCN申请和up主的权限修改
  54. McnApplyUpChangePermit
  55. )
  56. // MSG .
  57. type MSG struct {
  58. MSGType MSGType
  59. Code string
  60. Title string
  61. Content string
  62. }
  63. // ArgMsg .
  64. type ArgMsg struct {
  65. MSGType MSGType
  66. MIDs []int64
  67. McnName string
  68. UpName string
  69. McnMid int64
  70. UpMid int64
  71. CompanyName string
  72. Reason string
  73. SignUpID int64
  74. Permission string
  75. }
  76. // MsgInfo .
  77. func (arg *ArgMsg) MsgInfo(msg *MSG) (mids []int64, title, content, code string) {
  78. switch arg.MSGType {
  79. case McnSignApplyPass:
  80. return arg.MIDs, msg.Title, msg.Content, msg.Code
  81. case McnSignNoApplyPass:
  82. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.Reason), msg.Code
  83. case McnUpBindAuthApply:
  84. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.McnName, arg.McnMid, arg.CompanyName, arg.SignUpID), msg.Code
  85. case McnUpBindAuthReview:
  86. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
  87. case McnUpBindAuthApplyPass:
  88. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
  89. case UpMcnBindAuthApplyPass:
  90. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
  91. case McnUpBindAuthApplyNoPass:
  92. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid, arg.Reason), msg.Code
  93. case UpMcnBindAuthApplyNoPass:
  94. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid, arg.Reason), msg.Code
  95. case McnUpBindAuthApplyRefuse:
  96. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
  97. case UpMcnRelationFreeze:
  98. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
  99. case McnUpRelationFreeze:
  100. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
  101. case UpMcnRelationRelease:
  102. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
  103. case McnUpRelationRelease:
  104. return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
  105. case McnBackstageBlock:
  106. return arg.MIDs, msg.Title, msg.Content, msg.Code
  107. case McnBackstageClose:
  108. return arg.MIDs, msg.Title, msg.Content, msg.Code
  109. case McnRenewcontract:
  110. return arg.MIDs, msg.Title, msg.Content, msg.Code
  111. case McnAccountRestore:
  112. return arg.MIDs, msg.Title, msg.Content, msg.Code
  113. case McnPermissionOpen:
  114. return arg.MIDs, fmt.Sprintf(msg.Title, arg.Permission), fmt.Sprintf(msg.Content, arg.Permission), msg.Code
  115. case McnPermissionClosed:
  116. return arg.MIDs, fmt.Sprintf(msg.Title, arg.Permission), fmt.Sprintf(msg.Content, arg.Permission), msg.Code
  117. case McnUpNotAgreeChangePermit:
  118. return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName), msg.Code
  119. case McnOperNotAgreeChangePermit:
  120. return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName, arg.Reason), msg.Code
  121. case McnOperAgreeChangePermit:
  122. return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName, arg.Permission), msg.Code
  123. case McnApplyUpChangePermit:
  124. return arg.MIDs, fmt.Sprintf(msg.Title, arg.McnName), fmt.Sprintf(msg.Content, arg.McnName, arg.Permission, arg.SignUpID), msg.Code
  125. }
  126. return nil, "", "", ""
  127. }