dengbiao 4 месяцев назад
Родитель
Сommit
077c30e9df
5 измененных файлов: 21 добавлений и 21 удалений
  1. +1
    -2
      consume/init.go
  2. +4
    -4
      consume/md/consume_key.go
  3. +3
    -3
      consume/one_circles_sign_in_consume.go
  4. +12
    -11
      consume/one_circles_sign_in_copy_consume.go
  5. +1
    -1
      go.mod

+ 1
- 2
consume/init.go Просмотреть файл

@@ -93,8 +93,7 @@ func initConsumes() {
jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume
jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume
jobs[consumeMd.OneCirclesAddPublicPlatoonUserRelationCommissionFunName] = OneCirclesAddPublicPlatoonUserRelationCommissionConsume

//jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume
//jobs[consumeMd.OneCirclesSignInUpdateRecordsGreenEnergyFunName] = OneCirclesSignInUpdateRecordsGreenEnergyConsume

//////////////////////////////////////// withdraw /////////////////////////////////////////////////////
//jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume


+ 4
- 4
consume/md/consume_key.go Просмотреть файл

@@ -562,12 +562,12 @@ var RabbitMqQueueKeyList = []*MqQueue{
},
{
ExchangeName: "one.circles",
Name: "one_circles_sign_in_green_energy_copy",
Name: "one_circles_sign_in_update_records",
Type: TopicQueueType,
IsPersistent: false,
RoutKey: "sign_in_copy",
RoutKey: "sign_in_update_records",
BindKey: "",
ConsumeFunName: "OneCirclesSignInCopyGreenEnergyConsume",
ConsumeFunName: "OneCirclesSignInUpdateRecordsGreenEnergyConsume",
},
{
ExchangeName: "zhios.app.user.withdraw.apply.exchange",
@@ -661,8 +661,8 @@ const (
MallAddSupplyGoodsFunName = "MallAddSupplyGoodsConsume"
CanalUserVirtualCcoinFlowFunName = "CanalUserVirtualCoinFlowConsume"
OneCirclesSignInGreenEnergyFunName = "OneCirclesSignInGreenEnergyConsume"
OneCirclesSignInUpdateRecordsGreenEnergyFunName = "OneCirclesSignInUpdateRecordsGreenEnergyConsume"
OneCirclesStartLevelDividendFunName = "OneCirclesStartLevelDividendConsume"
OneCirclesSignInCopyGreenEnergyFunName = "OneCirclesSignInCopyGreenEnergyConsume"
OneCirclesActivityCoinAutoExchangeGreenEnergyFunName = "OneCirclesActivityCoinAutoExchangeGreenEnergyConsume"
OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName = "OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume"
OneCirclesSettlementPublicGiveActivityCoinFunName = "OneCirclesSettlementPublicGiveActivityCoinConsume"


+ 3
- 3
consume/one_circles_sign_in_consume.go Просмотреть файл

@@ -35,7 +35,7 @@ func OneCirclesSignInGreenEnergyConsume(queue md.MqQueue) {
for {
res, ok = <-delivery
if ok == true {
err = handleOneCirclesSignInGreenEnergy(res.Body)
err = handleOneCirclesSignInGreenEnergy(ch, res.Body)
if err != nil {
fmt.Println("err ::: ", err)
utils.FilePutContents("OneCirclesSignInGreenEnergyConsume_ERR", "[err]:"+err.Error())
@@ -55,7 +55,7 @@ func OneCirclesSignInGreenEnergyConsume(queue md.MqQueue) {
fmt.Println("get msg done")
}

func handleOneCirclesSignInGreenEnergy(msgData []byte) error {
func handleOneCirclesSignInGreenEnergy(ch *rabbit.Channel, msgData []byte) error {
//1、解析mq中queue的数据结构体
var msg *md.OneCirclesStructForSignIn
err := json.Unmarshal(msgData, &msg)
@@ -64,7 +64,7 @@ func handleOneCirclesSignInGreenEnergy(msgData []byte) error {
}

engine := db.DBs[msg.MasterId]
err = one_circles.HandleSettlementSignInGreenEnergy(engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime)
err = one_circles.HandleSettlementSignInGreenEnergy(ch, engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime)
fmt.Println("err::::", err)
if err != nil {
return err


+ 12
- 11
consume/one_circles_sign_in_copy_consume.go Просмотреть файл

@@ -6,6 +6,8 @@ import (
"applet/app/utils/logx"
"applet/consume/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model"
md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles"
"encoding/json"
"errors"
@@ -13,8 +15,8 @@ import (
"github.com/streadway/amqp"
)

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

one_circles.Init(cfg.RedisAddr)
@@ -34,9 +36,9 @@ func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) {
for {
res, ok = <-delivery
if ok == true {
err = handleOneCirclesSignInCopyGreenEnergy(res.Body)
err = handleOneCirclesSignInUpdateRecordsGreenEnergyConsume(res.Body)
if err != nil {
fmt.Println("OneCirclesSignInCopyGreenEnergyConsume_ERR:::::", err.Error())
fmt.Println("OneCirclesSignInUpdateRecordsGreenEnergyConsume_ERR:::::", err.Error())
}
//_ = res.Reject(false)
err = res.Ack(true)
@@ -48,18 +50,17 @@ func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) {
fmt.Println("get msg done")
}

func handleOneCirclesSignInCopyGreenEnergy(msgData []byte) error {
func handleOneCirclesSignInUpdateRecordsGreenEnergyConsume(msgData []byte) error {
//1、解析mq中queue的数据结构体
var msg *md.OneCirclesStructForSignIn
var msg *md2.UpdateOneCirclesStructForSignInRecords
err := json.Unmarshal(msgData, &msg)
if err != nil {
return err
}

engine := db.DBs[msg.MasterId]
err = one_circles.HandleSettlementSignInGreenEnergy(engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime)
fmt.Println("err::::", err)
engine := db.DBs["31585332"]
_, err = engine.Where("id =?", msg.Id).Update(&model.OneCirclesGreenEnergySignIn{IsCompleted: 1})
if err != nil {
fmt.Println("err::::", err)
return err
}
return nil


+ 1
- 1
go.mod Просмотреть файл

@@ -9,7 +9,7 @@ require (
code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240607091816-3df1433a2f0d
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.0
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240726103606-777f072274b9
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240726111757-07ae15a5b8fc
code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git v1.6.2-0.20231116085701-9ba6e19f877b
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240725031213-6f248783bdec
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240726093338-fed880ca12ce


Загрузка…
Отмена
Сохранить