This commit is contained in:
laodaming 2023-08-07 11:49:17 +08:00
parent 00bbe2b4e9
commit 31eb49efa3
3 changed files with 8 additions and 7 deletions

View File

@ -32,12 +32,12 @@ func main() {
defer server.Stop() defer server.Stop()
ctx := svc.NewServiceContext(c) ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
//消费渲染前组装数据队列 //消费渲染前组装数据队列
ctx1 := context.Background() ctx1 := context.Background()
ctx2, cancel := context.WithCancel(ctx1) ctx2, cancel := context.WithCancel(ctx1)
defer cancel() defer cancel()
go ctx.RabbitMq.Consume(ctx2, constants.RABBIT_MQ_ASSEMBLE_RENDER_DATA, &consumer.MqConsumerRenderAssemble{}) go ctx.RabbitMq.Consume(ctx2, constants.RABBIT_MQ_ASSEMBLE_RENDER_DATA, &consumer.MqConsumerRenderAssemble{})
handler.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start() server.Start()
} }

View File

@ -22,11 +22,6 @@ type renderImageControlChanItem struct {
} }
// 渲染发送到组装数据组装数据 // 渲染发送到组装数据组装数据
type assembleRenderData struct {
TaskId string `json:"task_id"`
RenderData interface{} `json:"render_data"`
}
func (w *wsConnectItem) assembleRenderData(data []byte) { func (w *wsConnectItem) assembleRenderData(data []byte) {
var renderImageData websocket_data.RenderImageReqMsg var renderImageData websocket_data.RenderImageReqMsg
if err := json.Unmarshal(data, &renderImageData); err != nil { if err := json.Unmarshal(data, &renderImageData); err != nil {
@ -42,7 +37,7 @@ func (w *wsConnectItem) assembleRenderData(data []byte) {
TaskId: taskId, TaskId: taskId,
RenderId: renderImageData.RenderId, RenderId: renderImageData.RenderId,
} }
tmpData := assembleRenderData{ tmpData := websocket_data.AssembleRenderData{
TaskId: taskId, TaskId: taskId,
RenderData: renderImageData.RenderData, RenderData: renderImageData.RenderData,
} }

View File

@ -19,3 +19,9 @@ type ThirdPartyLoginRspMsg struct {
//websocket三方登录的通知数据 //websocket三方登录的通知数据
Token string `json:"token"` Token string `json:"token"`
} }
// 发送到渲染组装的mq数据
type AssembleRenderData struct {
TaskId string `json:"task_id"`
RenderData interface{} `json:"render_data"`
}