rabbitmq.go 36 KB

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