rabbitmq.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. package initialize
  2. import (
  3. "encoding/base64"
  4. "fmt"
  5. "mtp20access/global"
  6. rsp "mtp20access/model/mq/response"
  7. "mtp20access/packet"
  8. "mtp20access/res/pb"
  9. "mtp20access/utils"
  10. "github.com/golang/protobuf/proto"
  11. "github.com/streadway/amqp"
  12. "go.uber.org/zap"
  13. "google.golang.org/protobuf/encoding/protojson"
  14. )
  15. func RabbitMQ() *global.RabbitMQ {
  16. url := global.M2A_CONFIG.Rabbitmq.Url
  17. connection, err := amqp.Dial(url)
  18. if err != nil {
  19. global.M2A_LOG.Error("rabbitmq connect failed, err:", zap.Error(err))
  20. return nil
  21. }
  22. channel, err := connection.Channel()
  23. if err != nil {
  24. global.M2A_LOG.Error("rabbitmq open channel failed, err:", zap.Error(err))
  25. return nil
  26. }
  27. global.M2A_LOG.Info("rabbitmq connect successed.")
  28. return &global.RabbitMQ{
  29. Connection: connection,
  30. Channel: channel,
  31. }
  32. }
  33. // MQProc 消息处理对象
  34. type MQProc struct{}
  35. // process 消息处理接口
  36. func (t *MQProc) Process(topic, queuename string, msg *[]byte) {
  37. // info := fmt.Sprintf("rabbitmq receive message from: topic[%s] queue[%s] contentLen[%d]",
  38. // topic,
  39. // queuename,
  40. // len(string(*msg)))
  41. // global.M2A_LOG.Info(info)
  42. if funcode, sessionId, bytes, serialNumber, err := t.getRspProtobuf(msg); err == nil && bytes != nil {
  43. // 尝试获取对应异步任务
  44. if client, exists := global.M2A_Clients[int(sessionId)]; exists {
  45. key := fmt.Sprintf("%v_%v_%v", sessionId, funcode, serialNumber)
  46. // 银行服务相关的回复流水号是错误的,所以需要特殊处理
  47. if int(funcode) == global.T2bBankSignRsp ||
  48. int(funcode) == global.T2bBankCancelSignRsp ||
  49. int(funcode) == global.T2bBankWithdrawRsp ||
  50. int(funcode) == global.T2bBankDepositRsp {
  51. key = fmt.Sprintf("%v_%v", sessionId, funcode)
  52. }
  53. asyncTask := client.GetAsyncTask(key)
  54. if asyncTask != nil {
  55. rspData := string(*bytes)
  56. // 判断是否要加密
  57. if asyncTask.IsEncrypted {
  58. if b, err := packet.Encrypt(*bytes, packet.AESKey, true); err != nil {
  59. global.M2A_LOG.Error("总线回复数据加密失败", zap.Error(err))
  60. return
  61. } else {
  62. rspData = base64.StdEncoding.EncodeToString(b)
  63. }
  64. }
  65. // 给客户端回调
  66. global.M2A_LOG.Info("[S->C]", zap.Any("rsp", funcode), zap.Any("data", string(rspData)))
  67. r := rsp.MQBodyRsp{
  68. FunCode: funcode,
  69. IsEncrypted: asyncTask.IsEncrypted,
  70. Data: rspData,
  71. }
  72. asyncTask.Rsp <- r
  73. }
  74. }
  75. }
  76. }
  77. // getRspProtobuf 将总线回复的数据反序列化为Protobuf
  78. func (t *MQProc) getRspProtobuf(msg *[]byte) (funcode uint32, sessionId uint32, bytes *[]byte, serialNumber uint32, err error) {
  79. // 分解总线包信息
  80. funcode = utils.BytesToUint32((*msg)[0:4])
  81. sessionId = utils.BytesToUint32((*msg)[4:8])
  82. b := (*msg)[8:]
  83. global.M2A_LOG.Info("收到总线订阅消息", zap.Any("funcode", funcode), zap.Any("sessionId", sessionId), zap.Any("len", len(b)))
  84. switch int(funcode) {
  85. case global.ModifyPwdRsp: // 修改账户密码应答
  86. var p pb.ModifyPwdRsp
  87. if err = proto.Unmarshal(b, &p); err != nil {
  88. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  89. return
  90. }
  91. if bs, e := protojson.Marshal(&p); e != nil {
  92. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  93. return
  94. } else {
  95. bytes = &bs
  96. serialNumber = p.GetHeader().GetRequestID()
  97. }
  98. case global.UserReceiveInfoRsp: // 新增修改收货地址请求响应
  99. var p pb.UserReceiveInfoRsp
  100. if err = proto.Unmarshal(b, &p); err != nil {
  101. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  102. return
  103. }
  104. if bs, e := protojson.Marshal(&p); e != nil {
  105. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  106. return
  107. } else {
  108. bytes = &bs
  109. serialNumber = p.GetHeader().GetRequestID()
  110. }
  111. case global.DelUserReceiveInfoRsp: // 删除收货地址请求响应
  112. var p pb.DelUserReceiveInfoRsp
  113. if err = proto.Unmarshal(b, &p); err != nil {
  114. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  115. return
  116. }
  117. if bs, e := protojson.Marshal(&p); e != nil {
  118. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  119. return
  120. } else {
  121. bytes = &bs
  122. serialNumber = p.GetHeader().GetRequestID()
  123. }
  124. case global.UserReceiptInfoRsp: // 新增修改用户发票信息请求响应
  125. var p pb.UserReceiptInfoRsp
  126. if err = proto.Unmarshal(b, &p); err != nil {
  127. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  128. return
  129. }
  130. if bs, e := protojson.Marshal(&p); e != nil {
  131. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  132. return
  133. } else {
  134. bytes = &bs
  135. serialNumber = p.GetHeader().GetRequestID()
  136. }
  137. case global.DelUserReceiptInfoRsp: // 删除用户发票信息请求响应
  138. var p pb.DelUserReceiptInfoRsp
  139. if err = proto.Unmarshal(b, &p); err != nil {
  140. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  141. return
  142. }
  143. if bs, e := protojson.Marshal(&p); e != nil {
  144. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  145. return
  146. } else {
  147. bytes = &bs
  148. serialNumber = p.GetHeader().GetRequestID()
  149. }
  150. case global.T2bBankSignRsp: // 签约应答
  151. var p pb.T2BBankSignRsp
  152. if err = proto.Unmarshal(b, &p); err != nil {
  153. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  154. return
  155. }
  156. if bs, e := protojson.Marshal(&p); e != nil {
  157. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  158. return
  159. } else {
  160. bytes = &bs
  161. serialNumber = p.GetHeader().GetRequestID()
  162. }
  163. case global.T2bBankCancelSignRsp: // 解约应答
  164. var p pb.T2BBankCancelSignRsp
  165. if err = proto.Unmarshal(b, &p); err != nil {
  166. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  167. return
  168. }
  169. if bs, e := protojson.Marshal(&p); e != nil {
  170. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  171. return
  172. } else {
  173. bytes = &bs
  174. serialNumber = p.GetHeader().GetRequestID()
  175. }
  176. case global.T2bBankWithdrawRsp: // 出金应答
  177. var p pb.T2BBankWithdrawRsp
  178. if err = proto.Unmarshal(b, &p); err != nil {
  179. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  180. return
  181. }
  182. if bs, e := protojson.Marshal(&p); e != nil {
  183. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  184. return
  185. } else {
  186. bytes = &bs
  187. serialNumber = p.GetHeader().GetRequestID()
  188. }
  189. case global.T2bBankDepositRsp: // 入金应答
  190. var p pb.T2BBankDepositRsp
  191. if err = proto.Unmarshal(b, &p); err != nil {
  192. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  193. return
  194. }
  195. if bs, e := protojson.Marshal(&p); e != nil {
  196. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  197. return
  198. } else {
  199. bytes = &bs
  200. serialNumber = p.GetHeader().GetRequestID()
  201. }
  202. case global.WarehouseApplyRsp: // 仓库申请应答
  203. var p pb.WarehouseApplyRsp
  204. if err = proto.Unmarshal(b, &p); err != nil {
  205. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  206. return
  207. }
  208. if bs, e := protojson.Marshal(&p); e != nil {
  209. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  210. return
  211. } else {
  212. bytes = &bs
  213. serialNumber = p.GetHeader().GetRequestID()
  214. }
  215. case global.PerformanceContractedApplyRsp: // 违约申请应答
  216. var p pb.PerformanceContractedApplyRsp
  217. if err = proto.Unmarshal(b, &p); err != nil {
  218. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  219. return
  220. }
  221. if bs, e := protojson.Marshal(&p); e != nil {
  222. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  223. return
  224. } else {
  225. bytes = &bs
  226. serialNumber = p.GetHeader().GetRequestID()
  227. }
  228. case global.PerformanceDelayApplyRsp: // 延期申请应答
  229. var p pb.PerformanceDelayApplyRsp
  230. if err = proto.Unmarshal(b, &p); err != nil {
  231. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  232. return
  233. }
  234. if bs, e := protojson.Marshal(&p); e != nil {
  235. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  236. return
  237. } else {
  238. bytes = &bs
  239. serialNumber = p.GetHeader().GetRequestID()
  240. }
  241. case global.PerformanceManualConfirmRsp: // 履约手动确认应答
  242. var p pb.PerformanceManualConfirmRsp
  243. if err = proto.Unmarshal(b, &p); err != nil {
  244. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  245. return
  246. }
  247. if bs, e := protojson.Marshal(&p); e != nil {
  248. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  249. return
  250. } else {
  251. bytes = &bs
  252. serialNumber = p.GetHeader().GetRequestID()
  253. }
  254. case global.PerformanceModifyContactRsp: // 履约修改联络信息回应
  255. var p pb.PerformanceModifyContactRsp
  256. if err = proto.Unmarshal(b, &p); err != nil {
  257. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  258. return
  259. }
  260. if bs, e := protojson.Marshal(&p); e != nil {
  261. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  262. return
  263. } else {
  264. bytes = &bs
  265. serialNumber = p.GetHeader().GetRequestID()
  266. }
  267. case global.GoodsFavoriteOperateRsp: // 商品收藏操作接口应答
  268. var p pb.GoodsFavoriteOperateRsp
  269. if err = proto.Unmarshal(b, &p); err != nil {
  270. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  271. return
  272. }
  273. if bs, e := protojson.Marshal(&p); e != nil {
  274. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  275. return
  276. } else {
  277. bytes = &bs
  278. serialNumber = p.GetHeader().GetRequestID()
  279. }
  280. case global.ZSBuyOrderListingRsp: // 钻石买挂牌接口应答
  281. var p pb.ZSBuyOrderListingRsp
  282. if err = proto.Unmarshal(b, &p); err != nil {
  283. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  284. return
  285. }
  286. if bs, e := protojson.Marshal(&p); e != nil {
  287. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  288. return
  289. } else {
  290. bytes = &bs
  291. serialNumber = p.GetHeader().GetRequestID()
  292. }
  293. case global.ZSSellOrderListingRsp: // 钻石卖挂牌接口响应
  294. var p pb.ZSSellOrderListingRsp
  295. if err = proto.Unmarshal(b, &p); err != nil {
  296. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  297. return
  298. }
  299. if bs, e := protojson.Marshal(&p); e != nil {
  300. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  301. return
  302. } else {
  303. bytes = &bs
  304. serialNumber = p.GetHeader().GetRequestID()
  305. }
  306. case global.ZSBuyOrderDestingRsp: // 钻石卖摘牌申请接口响应
  307. var p pb.ZSBuyOrderDestingRsp
  308. if err = proto.Unmarshal(b, &p); err != nil {
  309. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  310. return
  311. }
  312. if bs, e := protojson.Marshal(&p); e != nil {
  313. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  314. return
  315. } else {
  316. bytes = &bs
  317. serialNumber = p.GetHeader().GetRequestID()
  318. }
  319. case global.ZSSellOrderDestingApplyOperateRsp: // 钻石卖摘牌申请操作接口应答
  320. var p pb.ZSSellOrderDestingApplyOperateRsp
  321. if err = proto.Unmarshal(b, &p); err != nil {
  322. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  323. return
  324. }
  325. if bs, e := protojson.Marshal(&p); e != nil {
  326. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  327. return
  328. } else {
  329. bytes = &bs
  330. serialNumber = p.GetHeader().GetRequestID()
  331. }
  332. case global.ZSBuyOrderDestingNegPriceRsp: // 买摘牌询价接口应答
  333. var p pb.ZSBuyOrderDestingNegPriceRsp
  334. if err = proto.Unmarshal(b, &p); err != nil {
  335. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  336. return
  337. }
  338. if bs, e := protojson.Marshal(&p); e != nil {
  339. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  340. return
  341. } else {
  342. bytes = &bs
  343. serialNumber = p.GetHeader().GetRequestID()
  344. }
  345. case global.ZSBuyOrderDestingNegPriceOperateRsp: // 买摘牌询价操作接口应答
  346. var p pb.ZSBuyOrderDestingNegPriceOperateRsp
  347. if err = proto.Unmarshal(b, &p); err != nil {
  348. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  349. return
  350. }
  351. if bs, e := protojson.Marshal(&p); e != nil {
  352. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  353. return
  354. } else {
  355. bytes = &bs
  356. serialNumber = p.GetHeader().GetRequestID()
  357. }
  358. case global.WRListingCancelOrderRsp: // 挂牌撤单应答
  359. var p pb.WRListingCancelOrderRsp
  360. if err = proto.Unmarshal(b, &p); err != nil {
  361. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  362. return
  363. }
  364. if bs, e := protojson.Marshal(&p); e != nil {
  365. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  366. return
  367. } else {
  368. bytes = &bs
  369. serialNumber = p.GetHeader().GetRequestID()
  370. }
  371. case global.ReceiptZSOutApplyRsp: // 钻石出库申请接口响应
  372. var p pb.ReceiptZSOutApplyRsp
  373. if err = proto.Unmarshal(b, &p); err != nil {
  374. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  375. return
  376. }
  377. if bs, e := protojson.Marshal(&p); e != nil {
  378. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  379. return
  380. } else {
  381. bytes = &bs
  382. serialNumber = p.GetHeader().GetRequestID()
  383. }
  384. case global.SpotPresaleListingOrderRsp: // 铁合金现货预售挂牌接口应答
  385. var p pb.SpotPresaleListingOrderRsp
  386. if err = proto.Unmarshal(b, &p); err != nil {
  387. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  388. return
  389. }
  390. if bs, e := protojson.Marshal(&p); e != nil {
  391. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  392. return
  393. } else {
  394. bytes = &bs
  395. serialNumber = p.GetHeader().GetRequestID()
  396. }
  397. case global.CJJCMemberOperateRsp: // 出境检测会员操作响应
  398. var p pb.CJJCMemberOperateRsp
  399. if err = proto.Unmarshal(b, &p); err != nil {
  400. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  401. return
  402. }
  403. if bs, e := protojson.Marshal(&p); e != nil {
  404. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  405. return
  406. } else {
  407. bytes = &bs
  408. serialNumber = p.GetHeader().GetRequestID()
  409. }
  410. case global.BSFWMemberOperateRsp: // 保税服务会员操作响应
  411. var p pb.BSFWMemberOperateRsp
  412. if err = proto.Unmarshal(b, &p); err != nil {
  413. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  414. return
  415. }
  416. if bs, e := protojson.Marshal(&p); e != nil {
  417. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  418. return
  419. } else {
  420. bytes = &bs
  421. serialNumber = p.GetHeader().GetRequestID()
  422. }
  423. case global.AccountFundInfoRsp: // 账户资金信息响应
  424. var p pb.AccountFundInfoRsp
  425. if err = proto.Unmarshal(b, &p); err != nil {
  426. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  427. return
  428. }
  429. if bs, e := protojson.Marshal(&p); e != nil {
  430. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  431. return
  432. } else {
  433. bytes = &bs
  434. serialNumber = p.GetHeader().GetRequestID()
  435. }
  436. }
  437. return
  438. }
  439. // RabbitMQSubscribeTopic 订阅主题
  440. func RabbitMQSubscribeTopic() (err error) {
  441. // 订阅需要的总线响应主题
  442. if err = global.SubscribeTopic(global.TOPIC_RSP_QKERNEL); err != nil {
  443. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  444. return
  445. }
  446. if err = global.SubscribeTopic(global.TOPIC_MANAGE_RSP); err != nil {
  447. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  448. return
  449. }
  450. if err = global.SubscribeTopic(global.TOPIC_RSP_BANK); err != nil {
  451. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  452. return
  453. }
  454. if err = global.SubscribeTopic(global.TOPIC_RSP_MONEY); err != nil {
  455. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  456. return
  457. }
  458. if err = global.SubscribeTopic(global.TOPIC_PERFORMANCE_RSP); err != nil {
  459. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  460. return
  461. }
  462. if err = global.SubscribeTopic(global.TOPIC_WAREHOUSE_RECIEPT_RSP); err != nil {
  463. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  464. return
  465. }
  466. if err = global.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_TRADE); err != nil {
  467. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  468. return
  469. }
  470. if err = global.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_TRADE_GZ); err != nil {
  471. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  472. return
  473. }
  474. if err = global.SubscribeTopic(global.TOPIC_RSP_CJBS_TRADE_GZ); err != nil {
  475. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  476. return
  477. }
  478. // 铁合金
  479. if err = global.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_PRESALE_THJ); err != nil {
  480. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  481. return
  482. }
  483. if err = global.SubscribeTopic(global.TOPIC_MANAGER_THJ_NTF); err != nil {
  484. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  485. return
  486. }
  487. global.M2A_LOG.Info("rabbitmq subscribe topic successed.")
  488. return
  489. }
  490. // StartRabbitMQReceive 开始接收总线消息
  491. func StartRabbitMQReceive() {
  492. t := &MQProc{}
  493. go func() {
  494. for _, subinfo := range global.SubInfos {
  495. global.Receive(subinfo.Topic, subinfo.QueueName, t)
  496. }
  497. }()
  498. }
  499. // InitFuncodeTopic 初始化功能码主题MAP
  500. func InitFuncodeTopic() {
  501. if global.M2A_FuncodeTopic == nil {
  502. global.M2A_FuncodeTopic = make(map[string][]int)
  503. }
  504. global.M2A_FuncodeTopic[global.TOPIC_REQ_QKERNEL] = []int{
  505. global.ModifyPwdReq,
  506. }
  507. global.M2A_FuncodeTopic[global.TOPIC_MANAGE_REQ] = []int{
  508. global.UserReceiveInfoReq,
  509. global.DelUserReceiveInfoReq,
  510. global.UserReceiveIsDefaultReq,
  511. global.UserReceiptInfoReq,
  512. global.DelUserReceiptInfoReq,
  513. global.WarehouseApplyReq,
  514. }
  515. global.M2A_FuncodeTopic[global.TOPIC_REQ_BANK] = []int{
  516. global.T2bBankSignReq,
  517. global.T2bBankCancelSignReq,
  518. global.T2bBankWithdrawReq,
  519. global.T2bBankDepositReq,
  520. }
  521. global.M2A_FuncodeTopic[global.TOPIC_REQ_MONEY] = []int{
  522. global.AccountFundInfoReq,
  523. }
  524. global.M2A_FuncodeTopic[global.TOPIC_PERFORMANCE_REQ] = []int{
  525. global.PerformanceContractedApplyReq,
  526. global.PerformanceDelayApplyReq,
  527. global.PerformanceManualConfirmReq,
  528. global.PerformanceModifyContactReq,
  529. }
  530. global.M2A_FuncodeTopic[global.TOPIC_WAREHOUSE_RECIEPT] = []int{
  531. global.ReceiptZSOutApplyReq,
  532. }
  533. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_TRADE] = []int{
  534. global.WRListingCancelOrderReq,
  535. }
  536. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_TRADE_GZ] = []int{
  537. global.GoodsFavoriteOperateReq,
  538. global.ZSBuyOrderListingReq,
  539. global.ZSSellOrderListingReq,
  540. global.ZSBuyOrderDestingReq,
  541. global.ZSSellOrderDestingApplyReq,
  542. global.ZSSellOrderDestingApplyOperateReq,
  543. global.ZSBuyOrderDestingNegPriceReq,
  544. global.ZSBuyOrderDestingNegPriceOperateReq,
  545. }
  546. global.M2A_FuncodeTopic[global.TOPIC_REQ_CJBS_TRADE_GZ] = []int{
  547. global.CJJCMemberOperateReq,
  548. global.BSFWMemberOperateReq,
  549. }
  550. // 铁合金
  551. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_PRESALE_THJ] = []int{
  552. global.SpotPresaleListingOrderReq,
  553. }
  554. }