rabbitmq.go 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. package initialize
  2. import (
  3. "encoding/base64"
  4. "fmt"
  5. "mtp20access/client"
  6. "mtp20access/global"
  7. rsp "mtp20access/model/mq/response"
  8. "mtp20access/packet"
  9. "mtp20access/rabbitmq"
  10. "mtp20access/res/pb"
  11. accountSrv "mtp20access/service/account"
  12. "mtp20access/utils"
  13. "strconv"
  14. // "github.com/golang/protobuf/proto"
  15. "github.com/streadway/amqp"
  16. "go.uber.org/zap"
  17. "google.golang.org/protobuf/encoding/protojson"
  18. "google.golang.org/protobuf/proto"
  19. )
  20. func RabbitMQ() *global.RabbitMQ {
  21. url := global.M2A_CONFIG.Rabbitmq.Url
  22. connection, err := amqp.Dial(url)
  23. if err != nil {
  24. global.M2A_LOG.Error("rabbitmq connect failed, err:", zap.Error(err))
  25. return nil
  26. }
  27. channel, err := connection.Channel()
  28. if err != nil {
  29. global.M2A_LOG.Error("rabbitmq open channel failed, err:", zap.Error(err))
  30. return nil
  31. }
  32. global.M2A_LOG.Info("rabbitmq connect successed.")
  33. return &global.RabbitMQ{
  34. Connection: connection,
  35. Channel: channel,
  36. }
  37. }
  38. // MQProc 消息处理对象
  39. type MQProc struct{}
  40. // process 消息处理接口
  41. func (t *MQProc) Process(topic, queuename string, msg *[]byte) {
  42. // info := fmt.Sprintf("rabbitmq receive message from: topic[%s] queue[%s] contentLen[%d]",
  43. // topic,
  44. // queuename,
  45. // len(string(*msg)))
  46. // global.M2A_LOG.Info(info)
  47. if funcode, sessionId, bytes, serialNumber, err := t.getRspProtobuf(msg); err == nil && bytes != nil {
  48. if sessionId == 0 || funcode == uint32(global.LogoutRsp) || funcode == uint32(global.LoginRsp) {
  49. // 通知类 或 特殊处理
  50. t.onNtf(funcode, sessionId, bytes)
  51. } else {
  52. // 请求回复W
  53. // 尝试获取对应异步任务
  54. if client, exists := client.Clients[int(sessionId)]; exists {
  55. key := fmt.Sprintf("%v_%v_%v", sessionId, funcode, serialNumber)
  56. // 银行服务相关的回复流水号是错误的,所以需要特殊处理
  57. if int(funcode) == global.T2bBankSignRsp ||
  58. int(funcode) == global.T2bBankCancelSignRsp ||
  59. int(funcode) == global.T2bBankWithdrawRsp ||
  60. int(funcode) == global.T2bBankDepositRsp {
  61. key = fmt.Sprintf("%v_%v", sessionId, funcode)
  62. }
  63. asyncTask := client.GetAsyncTask(key)
  64. if asyncTask != nil {
  65. rspData := string(*bytes)
  66. // 判断是否要加密
  67. if asyncTask.IsEncrypted {
  68. if b, err := packet.Encrypt(*bytes, packet.AESKey, true); err != nil {
  69. global.M2A_LOG.Error("总线回复数据加密失败", zap.Error(err))
  70. return
  71. } else {
  72. rspData = base64.StdEncoding.EncodeToString(b)
  73. }
  74. }
  75. // 给客户端回调
  76. global.M2A_LOG.Info("[S->C]", zap.Any("rsp", funcode), zap.Any("sessionId", sessionId), zap.Any("data", string(rspData)))
  77. r := rsp.MQBodyRsp{
  78. FunCode: funcode,
  79. IsEncrypted: asyncTask.IsEncrypted,
  80. Data: rspData,
  81. }
  82. asyncTask.Rsp <- r
  83. } else {
  84. global.M2A_LOG.Info("找不到对应KEY的异步任务", zap.Any("key", key), zap.Any("AsyncMap", client.GetAllAsyncTask()))
  85. }
  86. } else {
  87. global.M2A_LOG.Info("找不到对应的client", zap.Any("sessionId", sessionId))
  88. }
  89. }
  90. }
  91. }
  92. func (t *MQProc) onNtf(funcode uint32, sessionId uint32, bytes *[]byte) {
  93. var clients []*client.Client
  94. var err error
  95. var sendBytes *[]byte
  96. switch int(funcode) {
  97. case global.LoginRsp: // 用户登录应答 - 主要记录旧Token
  98. var p pb.LoginRsp
  99. if err = proto.Unmarshal(*bytes, &p); err != nil {
  100. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  101. return
  102. }
  103. // if bs, e := protojson.Marshal(&p); e != nil {
  104. // global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  105. // return
  106. // } else {
  107. // sendBytes = &bs
  108. // }
  109. // 获取目标客户
  110. for i := range client.Clients {
  111. c := client.Clients[i]
  112. if strconv.Itoa(int(p.GetUserID())) == c.UserID &&
  113. strconv.Itoa(int(sessionId)) == c.SessionID {
  114. // 主要记录旧Token
  115. c.OldToken = p.GetToken()
  116. }
  117. }
  118. case global.LogoutRsp: // 用户登出应答 - 主要用于接收管理端踢上线
  119. var p pb.LogoutRsp
  120. if err = proto.Unmarshal(*bytes, &p); err != nil {
  121. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  122. return
  123. }
  124. if bs, e := protojson.Marshal(&p); e != nil {
  125. global.M2A_LOG.Error("总线数据序列化JSON失败", zap.Error(err))
  126. return
  127. } else {
  128. sendBytes = &bs
  129. }
  130. // 获取目标客户
  131. clients = make([]*client.Client, 0)
  132. for i := range client.Clients {
  133. c := client.Clients[i]
  134. if strconv.Itoa(int(p.GetHeader().GetUserID())) == c.UserID {
  135. clients = append(clients, c)
  136. }
  137. }
  138. case global.MoneyChangedNtf: // 资金变化通知
  139. var p pb.MoneyChangedNtf
  140. if err = proto.Unmarshal(*bytes, &p); err != nil {
  141. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  142. return
  143. }
  144. if bs, e := protojson.Marshal(&p); e != nil {
  145. global.M2A_LOG.Error("总线数据序列化JSON失败", zap.Error(err))
  146. return
  147. } else {
  148. sendBytes = &bs
  149. }
  150. // 获取目标客户
  151. clients, err = accountSrv.GetClientsByAccountID(*p.AccountID)
  152. if err != nil {
  153. return
  154. }
  155. case global.OrderDealedNtf: // 委托单成交通知
  156. var p pb.OrderDealedNtf
  157. if err = proto.Unmarshal(*bytes, &p); err != nil {
  158. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  159. return
  160. }
  161. if bs, e := protojson.Marshal(&p); e != nil {
  162. global.M2A_LOG.Error("总线数据序列化JSON失败", zap.Error(err))
  163. return
  164. } else {
  165. sendBytes = &bs
  166. }
  167. // 获取目标客户
  168. clients, err = accountSrv.GetClientsByAccountID(*p.AccountID)
  169. if err != nil {
  170. return
  171. }
  172. case global.MarketStatusChangeNtf: // 市场状态变更通知
  173. var p pb.MarketStatusChangeNtf
  174. if err = proto.Unmarshal(*bytes, &p); err != nil {
  175. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  176. return
  177. }
  178. if bs, e := protojson.Marshal(&p); e != nil {
  179. global.M2A_LOG.Error("总线数据序列化JSON失败", zap.Error(err))
  180. return
  181. } else {
  182. sendBytes = &bs
  183. }
  184. // 获取目标客户
  185. clients = make([]*client.Client, 0)
  186. for i := range client.Clients {
  187. c := client.Clients[i]
  188. clients = append(clients, c)
  189. }
  190. case global.ListingOrderChangeNtf: // 挂牌委托变更广播通知
  191. var p pb.ListingOrderChangeNtf
  192. if err = proto.Unmarshal(*bytes, &p); err != nil {
  193. global.M2A_LOG.Error("总线数据反序列化失败", zap.Error(err))
  194. return
  195. }
  196. if bs, e := protojson.Marshal(&p); e != nil {
  197. global.M2A_LOG.Error("总线数据序列化JSON失败", zap.Error(err))
  198. return
  199. } else {
  200. sendBytes = &bs
  201. }
  202. // 获取目标客户
  203. clients = make([]*client.Client, 0)
  204. for i := range client.Clients {
  205. c := client.Clients[i]
  206. clients = append(clients, c)
  207. }
  208. }
  209. if err == nil && len(clients) > 0 {
  210. // 组装待发送给客户端的5.0报文包
  211. b, err := packet.BuildPacket(funcode, 0, 0, *sendBytes, true)
  212. if err != nil {
  213. global.M2A_LOG.Error("组装5.0报文失败", zap.Error(err))
  214. return
  215. }
  216. // 发送信息
  217. for i := range clients {
  218. c := clients[i]
  219. c.WriteTradeWsBuf(b)
  220. // 给客户端通知
  221. global.M2A_LOG.Info("[S->C]", zap.Any("ntf", funcode), zap.Any("clients", c.LoginID), zap.Any("len", len(b)))
  222. }
  223. }
  224. }
  225. // getRspProtobuf 将总线回复的数据反序列化为Protobuf
  226. func (t *MQProc) getRspProtobuf(msg *[]byte) (funcode uint32, sessionId uint32, bytes *[]byte, serialNumber uint32, err error) {
  227. // 分解总线包信息
  228. funcode = utils.BytesToUint32((*msg)[0:4])
  229. sessionId = utils.BytesToUint32((*msg)[4:8])
  230. b := (*msg)[8:]
  231. global.M2A_LOG.Info("收到总线消息", zap.Any("funcode", funcode), zap.Any("sessionId", sessionId), zap.Any("len", len(b)))
  232. switch int(funcode) {
  233. case global.MoneyChangedNtf,
  234. global.OrderDealedNtf,
  235. global.MarketStatusChangeNtf,
  236. global.LoginRsp,
  237. global.LogoutRsp,
  238. global.ListingOrderChangeNtf: // 资金变化通知等
  239. bytes = &b
  240. case global.ModifyPwdRsp: // 修改账户密码应答
  241. var p pb.ModifyPwdRsp
  242. if err = proto.Unmarshal(b, &p); err != nil {
  243. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  244. return
  245. }
  246. if bs, e := protojson.Marshal(&p); e != nil {
  247. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  248. return
  249. } else {
  250. bytes = &bs
  251. serialNumber = p.GetHeader().GetRequestID()
  252. }
  253. case global.UserReceiveInfoRsp: // 新增修改收货地址请求响应
  254. var p pb.UserReceiveInfoRsp
  255. if err = proto.Unmarshal(b, &p); err != nil {
  256. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  257. return
  258. }
  259. if bs, e := protojson.Marshal(&p); e != nil {
  260. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  261. return
  262. } else {
  263. bytes = &bs
  264. serialNumber = p.GetHeader().GetRequestID()
  265. }
  266. case global.DelUserReceiveInfoRsp: // 删除收货地址请求响应
  267. var p pb.DelUserReceiveInfoRsp
  268. if err = proto.Unmarshal(b, &p); err != nil {
  269. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  270. return
  271. }
  272. if bs, e := protojson.Marshal(&p); e != nil {
  273. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  274. return
  275. } else {
  276. bytes = &bs
  277. serialNumber = p.GetHeader().GetRequestID()
  278. }
  279. case global.UserReceiveIsDefaultRsp:
  280. var p pb.UserReceiveIsDefaultRsp
  281. if err = proto.Unmarshal(b, &p); err != nil {
  282. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  283. return
  284. }
  285. if bs, e := protojson.Marshal(&p); e != nil {
  286. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  287. return
  288. } else {
  289. bytes = &bs
  290. serialNumber = p.GetHeader().GetRequestID()
  291. }
  292. case global.UserReceiptInfoRsp: // 新增修改用户发票信息请求响应
  293. var p pb.UserReceiptInfoRsp
  294. if err = proto.Unmarshal(b, &p); err != nil {
  295. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  296. return
  297. }
  298. if bs, e := protojson.Marshal(&p); e != nil {
  299. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  300. return
  301. } else {
  302. bytes = &bs
  303. serialNumber = p.GetHeader().GetRequestID()
  304. }
  305. case global.DelUserReceiptInfoRsp: // 删除用户发票信息请求响应
  306. var p pb.DelUserReceiptInfoRsp
  307. if err = proto.Unmarshal(b, &p); err != nil {
  308. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  309. return
  310. }
  311. if bs, e := protojson.Marshal(&p); e != nil {
  312. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  313. return
  314. } else {
  315. bytes = &bs
  316. serialNumber = p.GetHeader().GetRequestID()
  317. }
  318. case global.T2bBankSignRsp: // 签约应答
  319. var p pb.T2BBankSignRsp
  320. if err = proto.Unmarshal(b, &p); err != nil {
  321. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  322. return
  323. }
  324. if bs, e := protojson.Marshal(&p); e != nil {
  325. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  326. return
  327. } else {
  328. bytes = &bs
  329. serialNumber = p.GetHeader().GetRequestID()
  330. }
  331. case global.T2bBankCancelSignRsp: // 解约应答
  332. var p pb.T2BBankCancelSignRsp
  333. if err = proto.Unmarshal(b, &p); err != nil {
  334. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  335. return
  336. }
  337. if bs, e := protojson.Marshal(&p); e != nil {
  338. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  339. return
  340. } else {
  341. bytes = &bs
  342. serialNumber = p.GetHeader().GetRequestID()
  343. }
  344. case global.T2bBankWithdrawRsp: // 出金应答
  345. var p pb.T2BBankWithdrawRsp
  346. if err = proto.Unmarshal(b, &p); err != nil {
  347. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  348. return
  349. }
  350. if bs, e := protojson.Marshal(&p); e != nil {
  351. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  352. return
  353. } else {
  354. bytes = &bs
  355. serialNumber = p.GetHeader().GetRequestID()
  356. }
  357. case global.T2bBankDepositRsp: // 入金应答
  358. var p pb.T2BBankDepositRsp
  359. if err = proto.Unmarshal(b, &p); err != nil {
  360. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  361. return
  362. }
  363. if bs, e := protojson.Marshal(&p); e != nil {
  364. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  365. return
  366. } else {
  367. bytes = &bs
  368. serialNumber = p.GetHeader().GetRequestID()
  369. }
  370. case global.WarehouseApplyRsp: // 仓库申请应答
  371. var p pb.WarehouseApplyRsp
  372. if err = proto.Unmarshal(b, &p); err != nil {
  373. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  374. return
  375. }
  376. if bs, e := protojson.Marshal(&p); e != nil {
  377. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  378. return
  379. } else {
  380. bytes = &bs
  381. serialNumber = p.GetHeader().GetRequestID()
  382. }
  383. case global.PerformanceContractedApplyRsp: // 违约申请应答
  384. var p pb.PerformanceContractedApplyRsp
  385. if err = proto.Unmarshal(b, &p); err != nil {
  386. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  387. return
  388. }
  389. if bs, e := protojson.Marshal(&p); e != nil {
  390. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  391. return
  392. } else {
  393. bytes = &bs
  394. serialNumber = p.GetHeader().GetRequestID()
  395. }
  396. case global.PerformanceDelayApplyRsp: // 延期申请应答
  397. var p pb.PerformanceDelayApplyRsp
  398. if err = proto.Unmarshal(b, &p); err != nil {
  399. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  400. return
  401. }
  402. if bs, e := protojson.Marshal(&p); e != nil {
  403. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  404. return
  405. } else {
  406. bytes = &bs
  407. serialNumber = p.GetHeader().GetRequestID()
  408. }
  409. case global.PerformanceManualConfirmRsp: // 履约手动确认应答
  410. var p pb.PerformanceManualConfirmRsp
  411. if err = proto.Unmarshal(b, &p); err != nil {
  412. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  413. return
  414. }
  415. if bs, e := protojson.Marshal(&p); e != nil {
  416. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  417. return
  418. } else {
  419. bytes = &bs
  420. serialNumber = p.GetHeader().GetRequestID()
  421. }
  422. case global.PerformanceModifyContactRsp: // 履约修改联络信息回应
  423. var p pb.PerformanceModifyContactRsp
  424. if err = proto.Unmarshal(b, &p); err != nil {
  425. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  426. return
  427. }
  428. if bs, e := protojson.Marshal(&p); e != nil {
  429. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  430. return
  431. } else {
  432. bytes = &bs
  433. serialNumber = p.GetHeader().GetRequestID()
  434. }
  435. case global.GoodsFavoriteOperateRsp: // 商品收藏操作接口应答
  436. var p pb.GoodsFavoriteOperateRsp
  437. if err = proto.Unmarshal(b, &p); err != nil {
  438. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  439. return
  440. }
  441. if bs, e := protojson.Marshal(&p); e != nil {
  442. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  443. return
  444. } else {
  445. bytes = &bs
  446. serialNumber = p.GetHeader().GetRequestID()
  447. }
  448. case global.ZSBuyOrderListingRsp: // 钻石买挂牌接口应答
  449. var p pb.ZSBuyOrderListingRsp
  450. if err = proto.Unmarshal(b, &p); err != nil {
  451. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  452. return
  453. }
  454. if bs, e := protojson.Marshal(&p); e != nil {
  455. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  456. return
  457. } else {
  458. bytes = &bs
  459. serialNumber = p.GetHeader().GetRequestID()
  460. }
  461. case global.ZSSellOrderListingRsp: // 钻石卖挂牌接口响应
  462. var p pb.ZSSellOrderListingRsp
  463. if err = proto.Unmarshal(b, &p); err != nil {
  464. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  465. return
  466. }
  467. if bs, e := protojson.Marshal(&p); e != nil {
  468. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  469. return
  470. } else {
  471. bytes = &bs
  472. serialNumber = p.GetHeader().GetRequestID()
  473. }
  474. case global.ZSBuyOrderDestingRsp: // 钻石卖摘牌申请接口响应
  475. var p pb.ZSBuyOrderDestingRsp
  476. if err = proto.Unmarshal(b, &p); err != nil {
  477. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  478. return
  479. }
  480. if bs, e := protojson.Marshal(&p); e != nil {
  481. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  482. return
  483. } else {
  484. bytes = &bs
  485. serialNumber = p.GetHeader().GetRequestID()
  486. }
  487. case global.ZSSellOrderDestingApplyOperateRsp: // 钻石卖摘牌申请操作接口应答
  488. var p pb.ZSSellOrderDestingApplyOperateRsp
  489. if err = proto.Unmarshal(b, &p); err != nil {
  490. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  491. return
  492. }
  493. if bs, e := protojson.Marshal(&p); e != nil {
  494. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  495. return
  496. } else {
  497. bytes = &bs
  498. serialNumber = p.GetHeader().GetRequestID()
  499. }
  500. case global.ZSBuyOrderDestingNegPriceRsp: // 买摘牌询价接口应答
  501. var p pb.ZSBuyOrderDestingNegPriceRsp
  502. if err = proto.Unmarshal(b, &p); err != nil {
  503. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  504. return
  505. }
  506. if bs, e := protojson.Marshal(&p); e != nil {
  507. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  508. return
  509. } else {
  510. bytes = &bs
  511. serialNumber = p.GetHeader().GetRequestID()
  512. }
  513. case global.ZSBuyOrderDestingNegPriceOperateRsp: // 买摘牌询价操作接口应答
  514. var p pb.ZSBuyOrderDestingNegPriceOperateRsp
  515. if err = proto.Unmarshal(b, &p); err != nil {
  516. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  517. return
  518. }
  519. if bs, e := protojson.Marshal(&p); e != nil {
  520. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  521. return
  522. } else {
  523. bytes = &bs
  524. serialNumber = p.GetHeader().GetRequestID()
  525. }
  526. case global.WRListingCancelOrderRsp: // 挂牌撤单应答
  527. var p pb.WRListingCancelOrderRsp
  528. if err = proto.Unmarshal(b, &p); err != nil {
  529. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  530. return
  531. }
  532. if bs, e := protojson.Marshal(&p); e != nil {
  533. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  534. return
  535. } else {
  536. bytes = &bs
  537. serialNumber = p.GetHeader().GetRequestID()
  538. }
  539. case global.HdWROrderRsp:
  540. var p pb.HdWROrderRsp
  541. if err = proto.Unmarshal(b, &p); err != nil {
  542. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  543. return
  544. }
  545. if bs, e := protojson.Marshal(&p); e != nil {
  546. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  547. return
  548. } else {
  549. bytes = &bs
  550. serialNumber = p.GetHeader().GetRequestID()
  551. }
  552. case global.WROutApplyRsp:
  553. var p pb.WROutApplyRsp
  554. if err = proto.Unmarshal(b, &p); err != nil {
  555. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  556. return
  557. }
  558. if bs, e := protojson.Marshal(&p); e != nil {
  559. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  560. return
  561. } else {
  562. bytes = &bs
  563. serialNumber = p.GetHeader().GetRequestID()
  564. }
  565. case global.ReceiptZSOutApplyRsp: // 钻石出库申请接口响应
  566. var p pb.ReceiptZSOutApplyRsp
  567. if err = proto.Unmarshal(b, &p); err != nil {
  568. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  569. return
  570. }
  571. if bs, e := protojson.Marshal(&p); e != nil {
  572. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  573. return
  574. } else {
  575. bytes = &bs
  576. serialNumber = p.GetHeader().GetRequestID()
  577. }
  578. case global.SpotPresaleListingOrderRsp: // 铁合金现货预售挂牌接口应答
  579. var p pb.SpotPresaleListingOrderRsp
  580. if err = proto.Unmarshal(b, &p); err != nil {
  581. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  582. return
  583. }
  584. if bs, e := protojson.Marshal(&p); e != nil {
  585. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  586. return
  587. } else {
  588. bytes = &bs
  589. serialNumber = p.GetHeader().GetRequestID()
  590. }
  591. case global.CJJCMemberOperateRsp: // 出境检测会员操作响应
  592. var p pb.CJJCMemberOperateRsp
  593. if err = proto.Unmarshal(b, &p); err != nil {
  594. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  595. return
  596. }
  597. if bs, e := protojson.Marshal(&p); e != nil {
  598. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  599. return
  600. } else {
  601. bytes = &bs
  602. serialNumber = p.GetHeader().GetRequestID()
  603. }
  604. case global.BSFWMemberOperateRsp: // 保税服务会员操作响应
  605. var p pb.BSFWMemberOperateRsp
  606. if err = proto.Unmarshal(b, &p); err != nil {
  607. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  608. return
  609. }
  610. if bs, e := protojson.Marshal(&p); e != nil {
  611. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  612. return
  613. } else {
  614. bytes = &bs
  615. serialNumber = p.GetHeader().GetRequestID()
  616. }
  617. case global.AccountFundInfoRsp: // 账户资金信息响应
  618. var p pb.AccountFundInfoRsp
  619. if err = proto.Unmarshal(b, &p); err != nil {
  620. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  621. return
  622. }
  623. if bs, e := protojson.Marshal(&p); e != nil {
  624. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  625. return
  626. } else {
  627. bytes = &bs
  628. serialNumber = p.GetHeader().GetRequestID()
  629. }
  630. case global.GZPresaleApplyRsp: // 广钻预售申请响应
  631. var p pb.GZPresaleApplyRsp
  632. if err = proto.Unmarshal(b, &p); err != nil {
  633. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  634. return
  635. }
  636. if bs, e := protojson.Marshal(&p); e != nil {
  637. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  638. return
  639. } else {
  640. bytes = &bs
  641. serialNumber = p.GetHeader().GetRequestID()
  642. }
  643. case global.GZPresaleOrderRsp: // 广钻预售认购下单响应
  644. var p pb.GZPresaleOrderRsp
  645. if err = proto.Unmarshal(b, &p); err != nil {
  646. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  647. return
  648. }
  649. if bs, e := protojson.Marshal(&p); e != nil {
  650. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  651. return
  652. } else {
  653. bytes = &bs
  654. serialNumber = p.GetHeader().GetRequestID()
  655. }
  656. case global.GZCenterPurchaseApplyRsp: // 广钻集采申请响应
  657. var p pb.GZCenterPurchaseApplyRsp
  658. if err = proto.Unmarshal(b, &p); err != nil {
  659. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  660. return
  661. }
  662. if bs, e := protojson.Marshal(&p); e != nil {
  663. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  664. return
  665. } else {
  666. bytes = &bs
  667. serialNumber = p.GetHeader().GetRequestID()
  668. }
  669. case global.GZCenterPurchaseOrderRsp: // 广钻集采认购下单响应
  670. var p pb.GZCenterPurchaseOrderRsp
  671. if err = proto.Unmarshal(b, &p); err != nil {
  672. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  673. return
  674. }
  675. if bs, e := protojson.Marshal(&p); e != nil {
  676. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  677. return
  678. } else {
  679. bytes = &bs
  680. serialNumber = p.GetHeader().GetRequestID()
  681. }
  682. case global.BSWMSReckonPayRsp: // WMS结算单支付接口响应
  683. var p pb.BSWMSReckonPayRsp
  684. if err = proto.Unmarshal(b, &p); err != nil {
  685. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  686. return
  687. }
  688. if bs, e := protojson.Marshal(&p); e != nil {
  689. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  690. return
  691. } else {
  692. bytes = &bs
  693. serialNumber = p.GetHeader().GetRequestID()
  694. }
  695. case global.OrderRsp:
  696. var p pb.OrderRsp
  697. if err = proto.Unmarshal(b, &p); err != nil {
  698. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  699. return
  700. }
  701. if bs, e := protojson.Marshal(&p); e != nil {
  702. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  703. return
  704. } else {
  705. bytes = &bs
  706. serialNumber = p.GetHeader().GetRequestID()
  707. }
  708. case global.CancelOrderRsp:
  709. var p pb.CancelOrderRsp
  710. if err = proto.Unmarshal(b, &p); err != nil {
  711. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  712. return
  713. }
  714. if bs, e := protojson.Marshal(&p); e != nil {
  715. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  716. return
  717. } else {
  718. bytes = &bs
  719. serialNumber = p.GetHeader().GetRequestID()
  720. }
  721. case global.HolderCloseRsp:
  722. var p pb.HolderCloseRsp
  723. if err = proto.Unmarshal(b, &p); err != nil {
  724. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  725. return
  726. }
  727. if bs, e := protojson.Marshal(&p); e != nil {
  728. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  729. return
  730. } else {
  731. bytes = &bs
  732. serialNumber = p.GetHeader().GetRequestID()
  733. }
  734. case global.DeliveryOrderRsp:
  735. var p pb.DeliveryOrderRsp
  736. if err = proto.Unmarshal(b, &p); err != nil {
  737. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  738. return
  739. }
  740. if bs, e := protojson.Marshal(&p); e != nil {
  741. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  742. return
  743. } else {
  744. bytes = &bs
  745. serialNumber = p.GetHeader().GetRequestID()
  746. }
  747. case global.MakeUpDepositRsp:
  748. var p pb.MakeUpDepositRsp
  749. if err = proto.Unmarshal(b, &p); err != nil {
  750. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  751. return
  752. }
  753. if bs, e := protojson.Marshal(&p); e != nil {
  754. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  755. return
  756. } else {
  757. bytes = &bs
  758. serialNumber = p.GetHeader().GetRequestID()
  759. }
  760. case global.HoldAppendDepositRsp:
  761. var p pb.HoldAppendDepositRsp
  762. if err = proto.Unmarshal(b, &p); err != nil {
  763. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  764. return
  765. }
  766. if bs, e := protojson.Marshal(&p); e != nil {
  767. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  768. return
  769. } else {
  770. bytes = &bs
  771. serialNumber = p.GetHeader().GetRequestID()
  772. }
  773. case global.OfflineDeliveryRsp:
  774. var p pb.OfflineDeliveryRsp
  775. if err = proto.Unmarshal(b, &p); err != nil {
  776. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  777. return
  778. }
  779. if bs, e := protojson.Marshal(&p); e != nil {
  780. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  781. return
  782. } else {
  783. bytes = &bs
  784. serialNumber = p.GetHeader().GetRequestID()
  785. }
  786. case global.HdWRDealOrderRsp:
  787. var p pb.HdWRDealOrderRsp
  788. if err = proto.Unmarshal(b, &p); err != nil {
  789. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  790. return
  791. }
  792. if bs, e := protojson.Marshal(&p); e != nil {
  793. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  794. return
  795. } else {
  796. bytes = &bs
  797. serialNumber = p.GetHeader().GetRequestID()
  798. }
  799. case global.SupplementDepositRsp:
  800. var p pb.SupplementDepositRsp
  801. if err = proto.Unmarshal(b, &p); err != nil {
  802. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  803. return
  804. }
  805. if bs, e := protojson.Marshal(&p); e != nil {
  806. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  807. return
  808. } else {
  809. bytes = &bs
  810. serialNumber = p.GetHeader().GetRequestID()
  811. }
  812. case global.RefundedDepositRsp:
  813. var p pb.RefundedDepositRsp
  814. if err = proto.Unmarshal(b, &p); err != nil {
  815. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  816. return
  817. }
  818. if bs, e := protojson.Marshal(&p); e != nil {
  819. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  820. return
  821. } else {
  822. bytes = &bs
  823. serialNumber = p.GetHeader().GetRequestID()
  824. }
  825. case global.MarketOrderDeliveryApplyRsp:
  826. var p pb.MarketOrderDeliveryApplyRsp
  827. if err = proto.Unmarshal(b, &p); err != nil {
  828. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  829. return
  830. }
  831. if bs, e := protojson.Marshal(&p); e != nil {
  832. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  833. return
  834. } else {
  835. bytes = &bs
  836. serialNumber = p.GetHeader().GetRequestID()
  837. }
  838. case global.DeliveryClientOperatorRsp:
  839. var p pb.DeliveryClientOperatorRsp
  840. if err = proto.Unmarshal(b, &p); err != nil {
  841. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  842. return
  843. }
  844. if bs, e := protojson.Marshal(&p); e != nil {
  845. global.M2A_LOG.Error("总线回复数据反序列化失败", zap.Error(err))
  846. return
  847. } else {
  848. bytes = &bs
  849. serialNumber = p.GetHeader().GetRequestID()
  850. }
  851. }
  852. return
  853. }
  854. // RabbitMQSubscribeTopic 订阅主题
  855. func RabbitMQSubscribeTopic() (err error) {
  856. // 订阅需要的总线响应主题
  857. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_USER); err != nil {
  858. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  859. return
  860. }
  861. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_NTF); err != nil {
  862. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  863. return
  864. }
  865. if err = rabbitmq.SubscribeTopic(global.TOPIC_CLIENT_NTF); err != nil {
  866. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  867. return
  868. }
  869. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_QKERNEL); err != nil {
  870. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  871. return
  872. }
  873. if err = rabbitmq.SubscribeTopic(global.TOPIC_MANAGE_RSP); err != nil {
  874. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  875. return
  876. }
  877. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_BANK); err != nil {
  878. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  879. return
  880. }
  881. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_MONEY); err != nil {
  882. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  883. return
  884. }
  885. if err = rabbitmq.SubscribeTopic(global.TOPIC_PERFORMANCE_RSP); err != nil {
  886. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  887. return
  888. }
  889. if err = rabbitmq.SubscribeTopic(global.TOPIC_WAREHOUSE_RECIEPT_RSP); err != nil {
  890. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  891. return
  892. }
  893. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_TRADE); err != nil {
  894. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  895. return
  896. }
  897. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_TRADE_GZ); err != nil {
  898. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  899. return
  900. }
  901. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_CJBS_TRADE_GZ); err != nil {
  902. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  903. return
  904. }
  905. // 铁合金
  906. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_PRESALE_THJ); err != nil {
  907. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  908. return
  909. }
  910. if err = rabbitmq.SubscribeTopic(global.TOPIC_MANAGER_THJ_NTF); err != nil {
  911. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  912. return
  913. }
  914. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_PRESALE_GZ); err != nil {
  915. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  916. return
  917. }
  918. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_WAREHOUSE_CENTERPURCHASE_GZ); err != nil {
  919. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  920. return
  921. }
  922. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_ORDER); err != nil {
  923. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  924. return
  925. }
  926. if err = rabbitmq.SubscribeTopic(global.TOPIC_RSP_DELIVERY_TRADE); err != nil {
  927. global.M2A_LOG.Error("rabbitmq subscribe topic failed, err:", zap.Error(err))
  928. return
  929. }
  930. global.M2A_LOG.Info("rabbitmq subscribe topic successed.")
  931. return
  932. }
  933. // StartRabbitMQReceive 开始接收总线消息
  934. func StartRabbitMQReceive() {
  935. t := &MQProc{}
  936. go func() {
  937. for _, subinfo := range rabbitmq.SubInfos {
  938. rabbitmq.Receive(subinfo.Topic, subinfo.QueueName, t)
  939. }
  940. }()
  941. }
  942. // InitFuncodeTopic 初始化功能码主题MAP
  943. func InitFuncodeTopic() {
  944. if global.M2A_FuncodeTopic == nil {
  945. global.M2A_FuncodeTopic = make(map[string][]int)
  946. }
  947. global.M2A_FuncodeTopic[global.TOPIC_REQ_QKERNEL] = []int{
  948. global.ModifyPwdReq,
  949. }
  950. global.M2A_FuncodeTopic[global.TOPIC_MANAGE_REQ] = []int{
  951. global.UserReceiveInfoReq,
  952. global.DelUserReceiveInfoReq,
  953. global.UserReceiveIsDefaultReq,
  954. global.UserReceiptInfoReq,
  955. global.DelUserReceiptInfoReq,
  956. global.WarehouseApplyReq,
  957. global.WROutApplyReq,
  958. }
  959. global.M2A_FuncodeTopic[global.TOPIC_REQ_BANK] = []int{
  960. global.T2bBankSignReq,
  961. global.T2bBankCancelSignReq,
  962. global.T2bBankWithdrawReq,
  963. global.T2bBankDepositReq,
  964. }
  965. global.M2A_FuncodeTopic[global.TOPIC_REQ_MONEY] = []int{
  966. global.AccountFundInfoReq,
  967. }
  968. global.M2A_FuncodeTopic[global.TOPIC_PERFORMANCE_REQ] = []int{
  969. global.PerformanceContractedApplyReq,
  970. global.PerformanceDelayApplyReq,
  971. global.PerformanceManualConfirmReq,
  972. global.PerformanceModifyContactReq,
  973. }
  974. global.M2A_FuncodeTopic[global.TOPIC_WAREHOUSE_RECIEPT] = []int{
  975. global.ReceiptZSOutApplyReq,
  976. }
  977. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_TRADE] = []int{
  978. global.WRListingCancelOrderReq,
  979. global.HdWROrderReq,
  980. global.HdWRDealOrderReq,
  981. }
  982. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_TRADE_GZ] = []int{
  983. global.GoodsFavoriteOperateReq,
  984. global.ZSBuyOrderListingReq,
  985. global.ZSSellOrderListingReq,
  986. global.ZSBuyOrderDestingReq,
  987. global.ZSSellOrderDestingApplyReq,
  988. global.ZSSellOrderDestingApplyOperateReq,
  989. global.ZSBuyOrderDestingNegPriceReq,
  990. global.ZSBuyOrderDestingNegPriceOperateReq,
  991. }
  992. global.M2A_FuncodeTopic[global.TOPIC_REQ_CJBS_TRADE_GZ] = []int{
  993. global.CJJCMemberOperateReq,
  994. global.BSFWMemberOperateReq,
  995. global.BSWMSReckonPayReq,
  996. }
  997. // 铁合金
  998. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_PRESALE_THJ] = []int{
  999. global.SpotPresaleListingOrderReq,
  1000. }
  1001. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_PRESALE_GZ] = []int{
  1002. global.GZPresaleApplyReq,
  1003. global.GZPresaleOrderReq,
  1004. }
  1005. global.M2A_FuncodeTopic[global.TOPIC_REQ_WAREHOUSE_CENTERPURCHASE_GZ] = []int{
  1006. global.GZCenterPurchaseApplyReq,
  1007. global.GZCenterPurchaseOrderReq,
  1008. }
  1009. global.M2A_FuncodeTopic[global.TOPIC_REQ_ORDER] = []int{
  1010. global.OrderReq,
  1011. global.CancelOrderReq,
  1012. global.HolderCloseReq,
  1013. global.MakeUpDepositReq,
  1014. global.HoldAppendDepositReq,
  1015. global.OfflineDeliveryReq,
  1016. global.SupplementDepositReq,
  1017. global.RefundedDepositReq,
  1018. global.MarketOrderDeliveryApplyReq,
  1019. global.DeliveryClientOperatorReq,
  1020. }
  1021. global.M2A_FuncodeTopic[global.TOPIC_REQ_DELIVERY_TRADE] = []int{
  1022. global.DeliveryOrderReq,
  1023. }
  1024. global.M2A_FuncodeTopic[global.TOPIC_REQ_USER] = []int{
  1025. global.LoginReq,
  1026. }
  1027. }