Browse Source

抖音团长商品

three
huangjiajun 1 year ago
parent
commit
a33466ae3e
3 changed files with 43 additions and 0 deletions
  1. +1
    -0
      consume/init.go
  2. +10
    -0
      consume/md/consume_key.go
  3. +32
    -0
      consume/zhios_tikTok_goods_update.go

+ 1
- 0
consume/init.go View File

@@ -37,6 +37,7 @@ func initConsumes() {


jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume
jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate
jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate


} }




+ 10
- 0
consume/md/consume_key.go View File

@@ -156,6 +156,15 @@ var RabbitMqQueueKeyList = []*MqQueue{
BindKey: "", BindKey: "",
ConsumeFunName: "ZhiosTikTokUpdate", ConsumeFunName: "ZhiosTikTokUpdate",
}, },
{
ExchangeName: "zhios.tikTok.exchange",
Name: "zhios_tikTok_all_update",
Type: DirectQueueType,
IsPersistent: false,
RoutKey: "all_update",
BindKey: "",
ConsumeFunName: "ZhiosTikTokAllUpdate",
},
} }


const ( const (
@@ -174,5 +183,6 @@ const (
YoumishangExchangeStoreFunName = "YoumishangExchangeStore" YoumishangExchangeStoreFunName = "YoumishangExchangeStore"
ZhiosRechargeOrderFailFunName = "ZhiosRechargeOrderFail" ZhiosRechargeOrderFailFunName = "ZhiosRechargeOrderFail"
ZhiosTikTokUpdateFunName = "ZhiosTikTokUpdate" ZhiosTikTokUpdateFunName = "ZhiosTikTokUpdate"
ZhiosTikTokAllUpdateFunName = "ZhiosTikTokAllUpdate"
CloudIssuanceAsyncMLoginFunName = "CloudIssuanceAsyncMLoginConsume" CloudIssuanceAsyncMLoginFunName = "CloudIssuanceAsyncMLoginConsume"
) )

+ 32
- 0
consume/zhios_tikTok_goods_update.go View File

@@ -46,6 +46,38 @@ func ZhiosTikTokUpdate(queue md.MqQueue) {
} }
fmt.Println("get msg done") fmt.Println("get msg done")
} }
func ZhiosTikTokAllUpdate(queue md.MqQueue) {
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>")
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(15)
delivery := ch.Consume(queue.Name, false)

var res amqp.Delivery
var ok bool
for {
res, ok = <-delivery
if ok == true {
//fmt.Println(string(res.Body))
fmt.Println(">>>>>>>>>>>>>>>>CanalOrderConsume<<<<<<<<<<<<<<<<<<<<<<<<<")
err = handleZhiosTikTokGoodsUpdate(res.Body)
//_ = res.Reject(false)
//if err == nil {
_ = res.Ack(true)
//}
} else {
panic(errors.New("error getting message"))
}
}
fmt.Println("get msg done")
}


func handleZhiosTikTokGoodsUpdate(msg []byte) error { func handleZhiosTikTokGoodsUpdate(msg []byte) error {
//1、解析canal采集至mq中queue的数据结构体 //1、解析canal采集至mq中queue的数据结构体


Loading…
Cancel
Save