Parcourir la source

Merge remote-tracking branch 'origin/master'

master
huangjiajun il y a 2 semaines
Parent
révision
89332bbc35
7 fichiers modifiés avec 97 ajouts et 14 suppressions
  1. +1
    -1
      consume/egg_energy_deal_user_virtual_coin_consume.go
  2. +0
    -0
      consume/egg_energy_platform_revenue_data_consume.go
  3. +1
    -1
      consume/egg_energy_settlement_public_give_activity_coin_consume.go
  4. +72
    -0
      consume/egg_new_user_register_consume.go
  5. +11
    -10
      consume/init.go
  6. +10
    -0
      consume/md/consume_key.go
  7. +2
    -2
      go.mod

+ 1
- 1
consume/egg_energy_deal_user_virtual_coin_consume.go Voir le fichier

@@ -78,5 +78,5 @@ func handleEggEnergyDealUserVirtualCoinDataConsume(msgData []byte) error {
return err
}

return nil
return session.Commit()
}

consume/egg_energy_platform_revenue_data.go → consume/egg_energy_platform_revenue_data_consume.go Voir le fichier


consume/egg_energy_settlement_public_give_activity_coin.go → consume/egg_energy_settlement_public_give_activity_coin_consume.go Voir le fichier

@@ -77,5 +77,5 @@ func handleEggEnergySettlementPublicGiveActivityCoinConsume(msgData []byte) erro
session.Rollback()
return err
}
return session.Begin()
return session.Commit()
}

+ 72
- 0
consume/egg_new_user_register_consume.go Voir le fichier

@@ -0,0 +1,72 @@
package consume

import (
"applet/app/cfg"
utils2 "applet/app/utils"
"applet/app/utils/logx"
"applet/consume/md"
"code.fnuoos.com/EggPlanet/egg_system_rules.git"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"encoding/json"
"errors"
"fmt"
"github.com/streadway/amqp"
"time"
)

func EggEnergyNewUserRegisterDataConsume(queue md.MqQueue) {
fmt.Println(">>>>>>>>>>>>EggEnergyNewUserRegisterDataConsume>>>>>>>>>>>>")
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
logx.Error(err)
return
}
defer ch.Release()
//1、将自己绑定到交换机上
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey)
//2、取出数据进行消费
ch.Qos(1)
delivery := ch.Consume(queue.Name, false)

egg_system_rules.Init(cfg.RedisAddr)
var res amqp.Delivery
var ok bool
for {
res, ok = <-delivery
if ok == true {
err = handleEggEnergyNewUserRegisterDataConsume(res.Body)
if err != nil {
fmt.Println("EggEnergyNewUserRegisterDataConsume_ERR:::::", err.Error())
utils2.FilePutContents("EggEnergyNewUserRegisterDataConsume_ERR", utils2.SerializeStr(map[string]interface{}{
"body": res.Body,
"err": err.Error(),
}))
}
//_ = res.Reject(false)
err = res.Ack(true)
fmt.Println("err ::: ", err)
} else {
panic(errors.New("error getting message"))
}
}
}

func handleEggEnergyNewUserRegisterDataConsume(msgData []byte) error {
time.Sleep(time.Duration(100) * time.Millisecond) //休眠100毫秒
// 1.解析mq中queue的数据结构体
var msg *md2.EggNewUserRegisterData
err := json.Unmarshal(msgData, &msg)
if err != nil {
return err
}

// 2.为新注册的用户新增蛋蛋分记录
err = egg_energy.ExistOrDefaultUserEggScore(msg.Uid)
if err != nil {
return err
}

return nil
}

+ 11
- 10
consume/init.go Voir le fichier

@@ -18,19 +18,20 @@ func Init() {
// 增加消费任务队列
func initConsumes() {
jobs[consumeMd.EggEnergyStartLevelDividendFunName] = EggEnergyStartLevelDividendConsume
jobs[consumeMd.EggEnergyDealPlatformRevenueDataFunName] = EggEnergyDealPlatformRevenueDataConsume
jobs[consumeMd.EggEnergyDealFundDataFunName] = EggEnergyDealFundDataConsume
jobs[consumeMd.AliyunSmsRecordFunName] = AliyunSmsRecordConsume //阿里云短信
jobs[consumeMd.JpushRecordFunName] = JpushRecordConsume //极光推送
jobs[consumeMd.AdvertisingSmashConsume] = AdvertisingSmashConsume //砸蛋
jobs[consumeMd.AdvertisingSignConsume] = AdvertisingSignConsume //签到
jobs[consumeMd.EggEnergyDealUserVirtualCoinDataFunName] = EggEnergyDealUserVirtualCoinDataConsume
jobs[consumeMd.IMEggEnergyBatchSendMessageDataFunName] = IMEggEnergyBatchSendMessageDataConsume
jobs[consumeMd.IMEggEnergyDelFriendCircleDataFunName] = IMEggEnergyDelFriendCircleDataConsume
jobs[consumeMd.EggFinWithdrawApplyDataConsumeFunName] = EggFinWithdrawApplyDataConsume
jobs[consumeMd.EggEnergyDealPlatformRevenueDataFunName] = EggEnergyDealPlatformRevenueDataConsume // 平台营收
jobs[consumeMd.EggEnergyDealFundDataFunName] = EggEnergyDealFundDataConsume // 资金数据
jobs[consumeMd.AliyunSmsRecordFunName] = AliyunSmsRecordConsume //阿里云短信
jobs[consumeMd.JpushRecordFunName] = JpushRecordConsume //极光推送
jobs[consumeMd.AdvertisingSmashConsume] = AdvertisingSmashConsume //砸蛋
jobs[consumeMd.AdvertisingSignConsume] = AdvertisingSignConsume //签到
jobs[consumeMd.EggEnergyDealUserVirtualCoinDataFunName] = EggEnergyDealUserVirtualCoinDataConsume // 视频奖励给相应团队发放积分
jobs[consumeMd.IMEggEnergyBatchSendMessageDataFunName] = IMEggEnergyBatchSendMessageDataConsume // 批量发送信息
jobs[consumeMd.IMEggEnergyDelFriendCircleDataFunName] = IMEggEnergyDelFriendCircleDataConsume // 删除朋友圈
jobs[consumeMd.EggFinWithdrawApplyDataConsumeFunName] = EggFinWithdrawApplyDataConsume // 支付宝打款
jobs[consumeMd.EggEnergySettlementPublicGiveActivityCoinFunName] = EggEnergySettlementPublicGiveActivityCoinConsume
jobs[consumeMd.EggEnergyStartExchangeGreenEnergyFunName] = EggEnergyStartExchangeGreenEnergyConsume
jobs[consumeMd.EggEnergyAutoExchangeGreenEnergyFunName] = EggEnergyAutoExchangeGreenEnergyConsume
jobs[consumeMd.EggEnergyNewUserRegisterDataFunName] = EggEnergyNewUserRegisterDataConsume // 新用户注册
}

func Run() {


+ 10
- 0
consume/md/consume_key.go Voir le fichier

@@ -137,6 +137,15 @@ var RabbitMqQueueKeyList = []*MqQueue{
BindKey: "",
ConsumeFunName: "AdvertisingSignConsume",
},
{
ExchangeName: "egg.app",
Name: "egg_new_user_register_queue",
Type: DirectQueueType,
IsPersistent: false,
RoutKey: "egg_new_user_register",
BindKey: "",
ConsumeFunName: "EggEnergyNewUserRegisterDataConsume",
},
}

const (
@@ -154,4 +163,5 @@ const (
EggEnergySettlementPublicGiveActivityCoinFunName = "EggEnergySettlementPublicGiveActivityCoinConsume"
EggEnergyStartExchangeGreenEnergyFunName = "EggEnergyStartExchangeGreenEnergyConsume"
EggEnergyAutoExchangeGreenEnergyFunName = "EggEnergyAutoExchangeGreenEnergyConsume"
EggEnergyNewUserRegisterDataFunName = "EggEnergyNewUserRegisterDataConsume"
)

+ 2
- 2
go.mod Voir le fichier

@@ -7,8 +7,8 @@ go 1.19
//replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241204145112-7b4c29691a6d
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205022841-e4ca039b4006
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241205041102-0e106357c399
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205061938-91f42710d6cd
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
github.com/boombuler/barcode v1.0.1


Chargement…
Annuler
Enregistrer