rabbitmq.go 36 KB

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