|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package consume
-
- import (
- "applet/app/utils/logx"
- consumeMd "applet/consume/md"
- "time"
- )
-
- var (
- jobs = map[string]func(consumeMd.MqQueue){}
- )
-
- func Init() {
- // 初始化任务列表
- initConsumes()
- }
-
- // 增加消费任务队列
- func initConsumes() {
- //
- //jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge
- //jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv
- //jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume
- //jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree
- //jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal
- //jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond
- ////
- //jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal
- //jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy
- //jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle
- ////
- //jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder
- //jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder
- //
- //jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation
- //jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser
- //
- //jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition
- //
- //jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial
- //jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter
- //jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender
- //jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans
- //jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv
- //
- //jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay
- //jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess
- //jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund
- //jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond
- //
- //jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore
- //
- //jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail
- //
- //jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume
- //jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate
- //jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate
- //
- //jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal
- //jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail
- //jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward
-
- //
-
- ////////////////////////////////////// V1 /////////////////////////////////////////////////////
- //jobs[consumeMd.CloudIssuanceMsgCallBackFunName] = CloudIssuanceMsgCallBackConsume
-
- //////////////////////////////////////// V2 /////////////////////////////////////////////////////
- //jobs[consumeMd.SupplyCloudChainFenxiaoNewChangeFunName] = SupplyCloudChainFenxiaoNewChangeConsume
-
- //////////////////////////////////////// V3 /////////////////////////////////////////////////////
- //jobs[consumeMd.MallAddSupplyGoodsFunName] = MallAddSupplyGoodsConsume
-
- //////////////////////////////////////// bigData /////////////////////////////////////////////////////
- //jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume
- //jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume
- //jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume
- //jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume
-
- //////////////////////////////////////// oneCircles /////////////////////////////////////////////////////
- //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume
- //jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume
- //jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume
-
- //////////////////////////////////////// withdraw /////////////////////////////////////////////////////
- //jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume
-
- //jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分
-
- //一个橘子
- jobs[consumeMd.CancalUserMoneyConsumeFunName] = CancalUserMoneyConsume //余额
- jobs[consumeMd.CancalUserRelateConsumeFunName] = CancalUserRelateConsume //推荐人数
- jobs[consumeMd.CancalUserIntegralExchangeConsumeFunName] = CancalUserIntegralExchange //兑换
- jobs[consumeMd.ZhiosTaskRewardConsumeFunName] = ZhiosTaskRewardExchange //兑换
- jobs[consumeMd.CanalOneOrengeUserVirtualCcoinFlowFunName] = CanalOneOrengeUserVirtualCoinFlowConsume
- jobs[consumeMd.ZhiosTaskVideoRewardConsumeFunName] = ZhiosTaskVideoRewardExchange //视频分佣
- jobs[consumeMd.ZhiosNewVideoRewardConsumeFunName] = ZhiosNewVideoRewardExchange //短视频奖励
-
- jobs[consumeMd.ZhiosRelateRewardConsumeFunName] = ZhiosRelateRewardExchange //分佣结算
-
- }
-
- func Run() {
- for _, v := range consumeMd.RabbitMqQueueKeyList {
- if _, ok := jobs[v.ConsumeFunName]; ok {
- go doConsume(v.ConsumeFunName, *v)()
- }
- }
- }
-
- func doConsume(fnName string, queue consumeMd.MqQueue) func() {
- return func() {
- begin := time.Now().Local()
- jobs[fnName](queue)
- end := time.Now().Local()
- logx.Infof(
- "[%s] AutoConsume started at <%s>, ended at <%s> duration <%s>",
- fnName,
- begin.Format("2006-01-02 15:04:05.000"),
- end.Format("2006-01-02 15:04:05.000"),
- time.Duration(end.UnixNano()-begin.UnixNano()).String(),
- )
- }
- }
|