rabbitmq.go 35 KB

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