|
@@ -97,24 +97,54 @@ func (t *MQProc) Process(topic, queuename string, msg *[]byte) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (t *MQProc) onNtf(funcode uint32, bytes *[]byte) {
|
|
func (t *MQProc) onNtf(funcode uint32, bytes *[]byte) {
|
|
|
|
|
+ var clients []*client.Client
|
|
|
|
|
+ var err error
|
|
|
|
|
+
|
|
|
switch int(funcode) {
|
|
switch int(funcode) {
|
|
|
case global.MoneyChangedNtf: // 资金变化通知
|
|
case global.MoneyChangedNtf: // 资金变化通知
|
|
|
var p pb.MoneyChangedNtf
|
|
var p pb.MoneyChangedNtf
|
|
|
- if err := proto.Unmarshal(*bytes, &p); err != nil {
|
|
|
|
|
- global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
|
|
|
|
|
|
|
+ if err = proto.Unmarshal(*bytes, &p); err != nil {
|
|
|
|
|
+ global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 组装待发送给客户端的5.0报文包
|
|
|
|
|
- b, err := packet.BuildPacket(funcode, 0, 0, *bytes, true)
|
|
|
|
|
|
|
+ // 获取目标客户
|
|
|
|
|
+ clients, err = accountSrv.GetClientsByAccountID(*p.AccountID)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
- global.M2A_LOG.Error("组装5.0报文失败", zap.Error(err))
|
|
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ case global.OrderDealedNtf: // 委托单成交通知
|
|
|
|
|
+ var p pb.OrderDealedNtf
|
|
|
|
|
+ if err = proto.Unmarshal(*bytes, &p); err != nil {
|
|
|
|
|
+ global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取目标客户
|
|
|
|
|
+ clients, err = accountSrv.GetClientsByAccountID(*p.AccountID)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ case global.MarketStatusChangeNtf: // 市场状态变更通知
|
|
|
|
|
+ var p pb.MarketStatusChangeNtf
|
|
|
|
|
+ if err = proto.Unmarshal(*bytes, &p); err != nil {
|
|
|
|
|
+ global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取目标客户
|
|
// 获取目标客户
|
|
|
- clients, err := accountSrv.GetClientsByAccountID(*p.AccountID)
|
|
|
|
|
|
|
+ clients = make([]*client.Client, 0)
|
|
|
|
|
+ for i := range client.Clients {
|
|
|
|
|
+ c := client.Clients[i]
|
|
|
|
|
+ clients = append(clients, c)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if err == nil && len(clients) > 0 {
|
|
|
|
|
+ // 组装待发送给客户端的5.0报文包
|
|
|
|
|
+ b, err := packet.BuildPacket(funcode, 0, 0, *bytes, true)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
|
|
+ global.M2A_LOG.Error("组装5.0报文失败", zap.Error(err))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -136,7 +166,7 @@ func (t *MQProc) getRspProtobuf(msg *[]byte) (funcode uint32, sessionId uint32,
|
|
|
global.M2A_LOG.Info("收到总线消息", zap.Any("funcode", funcode), zap.Any("sessionId", sessionId), zap.Any("len", len(b)))
|
|
global.M2A_LOG.Info("收到总线消息", zap.Any("funcode", funcode), zap.Any("sessionId", sessionId), zap.Any("len", len(b)))
|
|
|
|
|
|
|
|
switch int(funcode) {
|
|
switch int(funcode) {
|
|
|
- case global.MoneyChangedNtf: // 资金变化通知
|
|
|
|
|
|
|
+ case global.MoneyChangedNtf, global.OrderDealedNtf, global.MarketStatusChangeNtf: // 资金变化通知等
|
|
|
bytes = &b
|
|
bytes = &b
|
|
|
case global.ModifyPwdRsp: // 修改账户密码应答
|
|
case global.ModifyPwdRsp: // 修改账户密码应答
|
|
|
var p pb.ModifyPwdRsp
|
|
var p pb.ModifyPwdRsp
|