golang 的 rabbitmq 消费项目
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.

init.go 6.5 KiB

il y a 7 mois
il y a 4 mois
il y a 4 mois
il y a 8 mois
il y a 11 mois
il y a 11 mois
il y a 11 mois
il y a 10 mois
il y a 9 mois
il y a 4 mois
il y a 4 mois
il y a 9 mois
il y a 7 mois
il y a 4 mois
il y a 8 mois
il y a 5 mois
il y a 8 mois
il y a 7 mois
il y a 5 mois
il y a 4 mois
il y a 5 mois
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package consume
  2. import (
  3. "applet/app/utils/logx"
  4. consumeMd "applet/consume/md"
  5. "time"
  6. )
  7. var (
  8. jobs = map[string]func(consumeMd.MqQueue){}
  9. )
  10. func Init() {
  11. // 初始化任务列表
  12. initConsumes()
  13. }
  14. // 增加消费任务队列
  15. func initConsumes() {
  16. //jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder
  17. //jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge
  18. //jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv
  19. //jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume
  20. //jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree
  21. //jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal
  22. //jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond
  23. //
  24. //jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal
  25. //jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy
  26. //jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle
  27. //
  28. //jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder
  29. //
  30. //jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation
  31. //jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser
  32. //
  33. //jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition
  34. //
  35. //jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial
  36. //jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter
  37. //jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender
  38. //jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans
  39. //jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv
  40. //
  41. //jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay
  42. //jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess
  43. //jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund
  44. //jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond
  45. //
  46. //jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore
  47. //
  48. //jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail
  49. //
  50. //jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume
  51. //jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate
  52. //jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate
  53. //
  54. //jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal
  55. //jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail
  56. //jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward
  57. //jobs[consumeMd.ZhiosTaskTotal] = ZhiosTaskTotal
  58. //jobs[consumeMd.ZhiosAutoUnFreeze] = ZhiosAutoUnFreeze
  59. ////jobs[consumeMd.ZhiosUserProfileInviteCode] = ZhiosUserProfileInviteCode
  60. //
  61. ////////////////////////////////////// V1 /////////////////////////////////////////////////////
  62. //jobs[consumeMd.CloudIssuanceMsgCallBackFunName] = CloudIssuanceMsgCallBackConsume
  63. //////////////////////////////////////// V2 /////////////////////////////////////////////////////
  64. //jobs[consumeMd.SupplyCloudChainFenxiaoNewChangeFunName] = SupplyCloudChainFenxiaoNewChangeConsume
  65. //////////////////////////////////////// V3 /////////////////////////////////////////////////////
  66. //jobs[consumeMd.MallAddSupplyGoodsFunName] = MallAddSupplyGoodsConsume
  67. //////////////////////////////////////// bigData /////////////////////////////////////////////////////
  68. jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume
  69. jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume
  70. jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume
  71. jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume
  72. jobs[consumeMd.CanalGuideOrderForNumericalStatementConsumeFunName] = CanalGuideOrderForNumericalStatementConsume
  73. //////////////////////////////////////// oneCircles /////////////////////////////////////////////////////
  74. //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume
  75. //jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume
  76. //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume
  77. //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume
  78. //jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume
  79. //jobs[consumeMd.OneCirclesAddPublicPlatoonUserRelationCommissionFunName] = OneCirclesAddPublicPlatoonUserRelationCommissionConsume
  80. //jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume
  81. //////////////////////////////////////// withdraw /////////////////////////////////////////////////////
  82. //jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume
  83. //jobs[consumeMd.FlexibleEmploymentWithdrawForGongMaoConsumeFunName] = FlexibleEmploymentWithdrawForGongMaoConsume
  84. //jobs[consumeMd.FlexibleEmploymentWithdrawForPupiaoConsumeFunName] = FlexibleEmploymentWithdrawForPupiaoConsume
  85. //jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分
  86. //jobs[consumeMd.ZhiosOneCirclesCoinConsumeFunName] = ZhiosOneCirclesCoinConsume //一个圈圈虚拟币变化
  87. //////////////////////////////////////// autoRepaid /////////////////////////////////////////////////////
  88. //jobs[consumeMd.InstallmentPaymentAutoRepaidConsumeFunName] = InstallmentPaymentAutoRepaidConsume //分期付 - 自动扣款
  89. ////////////////////////////////////// SuperCloudIssuance /////////////////////////////////////////////////////
  90. //jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume
  91. //jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume
  92. }
  93. func Run() {
  94. for _, v := range consumeMd.RabbitMqQueueKeyList {
  95. if _, ok := jobs[v.ConsumeFunName]; ok {
  96. go doConsume(v.ConsumeFunName, *v)()
  97. }
  98. }
  99. }
  100. func doConsume(fnName string, queue consumeMd.MqQueue) func() {
  101. return func() {
  102. begin := time.Now().Local()
  103. jobs[fnName](queue)
  104. end := time.Now().Local()
  105. logx.Infof(
  106. "[%s] AutoConsume started at <%s>, ended at <%s> duration <%s>",
  107. fnName,
  108. begin.Format("2006-01-02 15:04:05.000"),
  109. end.Format("2006-01-02 15:04:05.000"),
  110. time.Duration(end.UnixNano()-begin.UnixNano()).String(),
  111. )
  112. }
  113. }