router.go 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. package routers
  2. import (
  3. "mtp2_if/config"
  4. "mtp2_if/controllers/cfg"
  5. "mtp2_if/controllers/common"
  6. "mtp2_if/controllers/cptrade"
  7. "mtp2_if/controllers/delivery"
  8. "mtp2_if/controllers/ermcp"
  9. "mtp2_if/controllers/ermcp3"
  10. "mtp2_if/controllers/erms2"
  11. "mtp2_if/controllers/erms3"
  12. "mtp2_if/controllers/hsby"
  13. "mtp2_if/controllers/market"
  14. "mtp2_if/controllers/order"
  15. "mtp2_if/controllers/other"
  16. "mtp2_if/controllers/qhj"
  17. "mtp2_if/controllers/qhjPCWeb"
  18. "mtp2_if/controllers/quote"
  19. "mtp2_if/controllers/search"
  20. "mtp2_if/controllers/szdz"
  21. "mtp2_if/controllers/taaccount"
  22. "mtp2_if/controllers/tjmd"
  23. "mtp2_if/controllers/trade"
  24. "mtp2_if/controllers/tradexx"
  25. "mtp2_if/controllers/user"
  26. "mtp2_if/controllers/wrTrade2"
  27. "mtp2_if/controllers/wrtrade"
  28. "mtp2_if/controllers/zj"
  29. "mtp2_if/logger"
  30. "mtp2_if/token"
  31. "net/http"
  32. "time"
  33. "github.com/gin-gonic/gin"
  34. // Swagger生成的文档
  35. _ "mtp2_if/docs"
  36. ginSwagger "github.com/swaggo/gin-swagger"
  37. "github.com/swaggo/gin-swagger/swaggerFiles"
  38. )
  39. // InitRouter 初始化路由器的方法
  40. func InitRouter() *gin.Engine {
  41. r := gin.New()
  42. // 设置日志中间件
  43. r.Use(ginLoggerMiddleware())
  44. // 设置奔溃中间件
  45. r.Use(ginRecoveryMiddleware())
  46. // 跨域
  47. r.Use(CORSMiddleware())
  48. // Swagger
  49. if config.SerCfg.GetDebugMode() {
  50. r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
  51. r.GET("/debug/log", other.LogList)
  52. r.GET("/debug/download", other.DownloadFile)
  53. }
  54. // 终端配置
  55. r.GET("/cfg", cfg.QueryCfg)
  56. // 主业务路由分组
  57. apiR := r.Group("/api")
  58. // apiR.Use(token.Auth())
  59. // ************************ 账户信息 ************************
  60. userR := apiR.Group("User")
  61. userR.Use()
  62. {
  63. // 获取登录ID
  64. userR.GET("/GetLoginID", user.GetLoginID)
  65. // 获取用户邀请码请求参数
  66. userR.GET("/QueryUserReferNum", user.QueryUserReferNum)
  67. // 获取用户信息请求参数
  68. userR.Use(token.Auth()).GET("/QueryUserInfo", user.QueryUserInfo)
  69. // 获取用户实名认证状态
  70. userR.Use(token.Auth()).GET("/GetUserAuthStatus", user.GetUserAuthStatus)
  71. // 获取用户商品收藏信息
  72. userR.Use(token.Auth()).GET("/QueryUserFavoriteGoodses", user.QueryUserFavoriteGoodses)
  73. // 添加用户商品收藏信息
  74. userR.Use(token.Auth()).POST("/AddUserFavoriteGoods", user.AddUserFavoriteGoods)
  75. // 移除用户商品收藏信息
  76. userR.Use(token.Auth()).POST("/RemoveUserFavoriteGoods", user.RemoveUserFavoriteGoods)
  77. // 获取用户留言板信息
  78. userR.Use(token.Auth()).GET("/QueryMessageBoard", user.QueryMessageBoard)
  79. // 添加用户留言板信息
  80. userR.Use(token.Auth()).POST("/AddMessageBoard", user.AddMessageBoard)
  81. // 获取用户账号信息
  82. userR.Use(token.Auth()).GET("/GetUserAccount", user.GetUserAccount)
  83. // 更新用户状态
  84. userR.Use(token.Auth()).POST("/UpdateUserAccountStatus", user.UpdateUserAccountStatus)
  85. // 账户登录后信息查询
  86. userR.Use(token.Auth()).GET("/LoginQuery", user.LoginQuery)
  87. }
  88. // ************************ 资金账户 ************************
  89. taAccountR := apiR.Group("TaAccount")
  90. taAccountR.Use(token.Auth())
  91. {
  92. // 获取资金账户信息
  93. taAccountR.GET("/GetTaAccounts", taaccount.GetTaAccounts)
  94. // 资金流水查询(当前)
  95. taAccountR.GET("/QueryAmountLog", taaccount.QueryAmountLog)
  96. // 资金流水查询(历史)
  97. taAccountR.GET("/QueryHisAmountLog", taaccount.QueryHisAmountLog)
  98. }
  99. // ************************ 通用服务 ************************
  100. commonR := apiR.Group("Common")
  101. commonR.Use()
  102. {
  103. // 查询交易端菜单
  104. commonR.GET("/QueryTraderMenu", common.QueryTraderMenu)
  105. // 查询交易端列表头信息
  106. commonR.GET("/QueryTableDefine", common.QueryTableDefine)
  107. // 查询省市信息(不包括区)
  108. commonR.GET("/QueryProvincesAndCities", common.QueryProvincesAndCities)
  109. // 查询区域信息
  110. commonR.GET("/GetDivisions", common.GetDivisions)
  111. // 查询轮播图配置信息
  112. commonR.GET("/QueryImageConfigs", common.QueryImageConfigs)
  113. // 获取所有枚举信息
  114. commonR.GET("/GetAllEnums", common.GetAllEnums)
  115. // 获取服务器时间
  116. commonR.GET("/GetServerTime", common.GetServerTime)
  117. // 获取数据库错误信息
  118. commonR.GET("/QueryErrorInfos", common.QueryErrorInfos)
  119. // 通知公告系统消息查询
  120. commonR.Use(token.Auth()).GET("/QueryNotice", common.QueryNotice)
  121. // 通知公告设置已读请求
  122. commonR.Use(token.Auth()).POST("/NoticeReaded", common.NoticeReaded)
  123. // 获取交易端菜单
  124. commonR.Use(token.Auth()).GET("/GetClientMenus", common.GetClientMenus)
  125. }
  126. // ************************ 通用市场 ************************
  127. marketR := apiR.Group("Market")
  128. marketR.Use(token.Auth())
  129. {
  130. // 查询市场运行信息
  131. marketR.GET("/QueryMarketRun", market.QueryMarketRun)
  132. // 获取登录账号有权限的市场信息
  133. marketR.GET("/QueryMarketsByLoginID", market.QueryMarketsByLoginID)
  134. // 获取登录账号有权限的商品信息
  135. marketR.GET("/QueryGoodsesByLoginID", market.QueryGoodsesByLoginID)
  136. // 获取所有外部交易所信息
  137. marketR.GET("/GetAllExExchanges", market.GetAllExExchanges)
  138. }
  139. // ************************ 通用单据 ************************
  140. orderR := apiR.Group("Order")
  141. orderR.Use(token.Auth())
  142. {
  143. // 持仓汇总查询(合约市场)
  144. orderR.GET("/QueryTradePosition", order.QueryTradePosition)
  145. // 委托单查询请求(合约市场)
  146. orderR.GET("/QueryTradeOrderDetail", order.QueryTradeOrderDetail)
  147. // 历史委托单查询请求(合约市场)
  148. orderR.GET("/QueryHisTradeOrderDetail", order.QueryHisTradeOrderDetail)
  149. // 成交单查询(合约市场)
  150. orderR.GET("/QueryTradeDetail", order.QueryTradeDetail)
  151. // 历史成交单查询(合约市场)
  152. orderR.GET("/QueryHisTradeDetail", order.QueryHisTradeDetail)
  153. orderR.GET("/QueryTradeHolderDetail", tradexx.QueryTradeHolderDetail)
  154. }
  155. // ************************ 通用交易 ************************
  156. tradeR := apiR.Group("Trade")
  157. tradeR.Use(token.Auth())
  158. {
  159. // 点选挂牌委托单据查询(保证金摘牌大厅)
  160. tradeR.GET("/QueryRecieptOrder", trade.QueryRecieptOrder)
  161. }
  162. // ************************ 行情服务 ************************
  163. quoteR := apiR.Group("Quote")
  164. quoteR.Use(token.AuthByHsby())
  165. {
  166. // 查询行情历史数据
  167. quoteR.GET("/QueryHistoryDatas", quote.QueryHistoryDatas)
  168. // 查询行情Tik数据
  169. quoteR.GET("/QueryHistoryTikDatas", quote.QueryHistoryTikDatas)
  170. // 查询分时图历史数据
  171. quoteR.GET("/QueryTSData", quote.QueryTSData)
  172. // 获取商品盘面信息
  173. quoteR.GET("/QueryQuoteDay", quote.QueryQuoteDay)
  174. }
  175. // ************************ 检索服务 ************************
  176. searchR := apiR.Group("Search")
  177. searchR.Use()
  178. {
  179. // 检索商品信息
  180. searchR.GET("/SearchGoodses", search.Goodses)
  181. }
  182. // ************************ 仓单贸易 ************************
  183. wrTradeR := apiR.Group("WRTrade")
  184. wrTradeR.Use(token.Auth())
  185. {
  186. wrTradeR.GET("/GetAllDeliveryGoods", wrtrade.GetAllDeliveryGoods)
  187. }
  188. // ************************ 产能预售 ************************
  189. cpTradeR := apiR.Group("CPTrade")
  190. cpTradeR.Use(token.Auth())
  191. {
  192. // 查询产能预售申请表
  193. cpTradeR.GET("/QueryPreasleApply", cptrade.QueryPreasleApply)
  194. // 查询远期订单信息
  195. cpTradeR.GET("/QueryUserGoodsData", cptrade.QueryUserGoodsData)
  196. // 查询远期订单注销申请信息
  197. cpTradeR.GET("/QueryPositionCancel", cptrade.QueryPositionCancel)
  198. // 查询产能预售商品扩展信息
  199. cpTradeR.GET("/QueryPresaleGoodsEx", cptrade.QueryPresaleGoodsEx)
  200. // 查询产能预售我的出价信息
  201. cpTradeR.GET("/QueryCPTradeMyBidInfos", cptrade.QueryCPTradeMyBidInfos)
  202. // 查询我的预售信息
  203. cpTradeR.GET("/QueryMyCPTradeGoods", cptrade.QueryMyCPTradeGoods)
  204. // 查询产能预售委托单信息
  205. cpTradeR.GET("/QueryCPTradeOrderDetail", cptrade.QueryCPTradeOrderDetail)
  206. }
  207. // ************************ 交割服务 ************************
  208. deliveryR := apiR.Group("Delivery")
  209. deliveryR.Use(token.Auth())
  210. {
  211. // 查询商品交割关系表
  212. deliveryR.GET("/QueryDeliveryRelation", delivery.QueryDeliveryRelation)
  213. }
  214. // ************************ 风险管理 ************************
  215. erms2R := apiR.Group("Erms2")
  216. erms2R.Use(token.Auth())
  217. {
  218. // 查询内部成交单信息
  219. erms2R.GET("/QueryInnerTradeDetail", erms2.QueryInnerTradeDetail)
  220. // 查询期现套利策略表信息(指定资金账户、未结束的)
  221. erms2R.GET("/QueryArbitrageStrategy", erms2.QueryArbitrageStrategy)
  222. // 查询现货合同表信息(指定策略ID、未结束的)
  223. erms2R.GET("/QuerySpotContract", erms2.QuerySpotContract)
  224. }
  225. // ************************ 风险管理v3 ************************
  226. erms3R := apiR.Group("Erms3")
  227. erms3R.Use(token.Auth())
  228. {
  229. // 新增现货合同申请
  230. erms3R.POST("/AddSpotContractApply", erms3.AddSpotContractApply)
  231. // 查询合同申请表单数据
  232. erms3R.GET("/QuerySpotContractAppleForm", erms3.QuerySpotContractAppleForm)
  233. // 查询合同详细信息.
  234. erms3R.GET("/QuerySpotContractDetail", erms3.QuerySpotContractDetail)
  235. // 查询待审核合同
  236. erms3R.GET("/QueryPendingAuditContract", erms3.QueryPendingAuditContract)
  237. // 新增客户申请
  238. erms3R.POST("/AddUserInfoApply", erms3.AddUserInfoApply)
  239. // 修改客户申请
  240. erms3R.POST("/ModifyUserInfoApply", erms3.ModifyUserInfoApply)
  241. // 删除客户申请
  242. erms3R.GET("/DeleteUserInfoApply", erms3.DeleteUserInfoApply)
  243. // 客户申请信息查询
  244. erms3R.GET("/QueryUserInfoApplies", erms3.QueryUserInfoApplies)
  245. // 待审核业务查询
  246. erms3R.GET("/QueryPendingBusiness", erms3.QueryPendingBusiness)
  247. // 业务信息查询
  248. erms3R.GET("/QueryBusinessInfo", erms3.QueryBusinessInfo)
  249. // 客户信息查询
  250. erms3R.GET("/QueryUserInfos", erms3.QueryUserInfos)
  251. // 新增期现套利业务申请
  252. erms3R.POST("/AddErms2ASApply", erms3.AddErms2ASApply)
  253. // 新增现货贸易业务申请
  254. erms3R.POST("/AddErms2SpotTradeApply", erms3.AddErms2SpotTradeApply)
  255. }
  256. // ************************ 定制【尚志大宗】 ************************
  257. szdzR := apiR.Group("SZDZ")
  258. szdzR.Use(token.Auth())
  259. {
  260. // 点选挂牌委托单据查询(摘牌大厅)
  261. szdzR.GET("/QueryRecieptOrder", szdz.QueryRecieptOrder)
  262. // 商品提货单查询
  263. szdzR.GET("/QueryGoodsPickup", szdz.QueryGoodsPickup)
  264. // 交易系统转换流水查询
  265. szdzR.GET("/QueryConvertLog", szdz.QueryConvertLog)
  266. // 搜索白名单
  267. szdzR.GET("/SearchWhite", szdz.SearchWhite)
  268. // 查询交易系统转换设置
  269. szdzR.GET("/QueryConvertConfig", szdz.QueryConvertConfig)
  270. // 持仓汇总查询(尚志大宗)
  271. szdzR.GET("/QuerySZDZTradePosition", szdz.QuerySZDZTradePosition)
  272. }
  273. // ************************ 定制【海商报业】 ************************
  274. hsbyR := apiR.Group("HSBY")
  275. hsbyR.Use(token.AuthByHsby())
  276. {
  277. // 查询热门商品列表(二级市场,挂牌点选)
  278. hsbyR.GET("/QueryHsbyTopGoodses", hsby.QueryHsbyTopGoodses)
  279. // 查询二级市场(挂牌点选)商品信息详情
  280. hsbyR.GET("/QueryHsbyListingGoodsDetail", hsby.QueryHsbyListingGoodsDetail)
  281. // 查询二级市场(挂牌点选)商品对应的挂牌委托单信息
  282. hsbyR.GET("/QueryHsbyGoodsOrderDetails", hsby.QueryHsbyGoodsOrderDetails)
  283. // 查询“我的订单”信息
  284. hsbyR.GET("/QueryHsbyMyBuyOrderDetails", hsby.QueryHsbyMyBuyOrderDetails)
  285. // 查询“我的商品”信息
  286. hsbyR.GET("/QueryHsbyMyGoods", hsby.QueryHsbyMyGoods)
  287. // 查询新品上市商品列表(一级市场预售)
  288. hsbyR.GET("/QueryHsbyPreGoodses", hsby.QueryHsbyPreGoodses)
  289. // 查询一级市场(预售)商品信息详情
  290. hsbyR.GET("/QueryHsbyPreGoodsDetail", hsby.QueryHsbyPreGoodsDetail)
  291. // 查询"我的闲置"单据信息
  292. hsbyR.GET("/QueryHsbySellMyDetails", hsby.QueryHsbySellMyDetails)
  293. // 查询我的包裹信息
  294. hsbyR.GET("/QueryHsbyMyPackages", hsby.QueryHsbyMyPackages)
  295. // 设置我的包裹已收货状态
  296. hsbyR.POST("/SetHsbyMyPackagesStatus", hsby.SetHsbyMyPackagesStatus)
  297. // 查询省市信息(不包括区)
  298. hsbyR.GET("/QueryProvincesAndCities", hsby.QueryProvincesAndCities)
  299. // 查询"我的订单 - 已完成"单据信息
  300. hsbyR.GET("/QueryHsbyBuyMyTradeDetail", hsby.QueryHsbyBuyMyTradeDetail)
  301. // 获取我的订单与包裹数量
  302. hsbyR.GET("/GetHsbyMyCount", hsby.GetHsbyMyCount)
  303. // 获取我的订单中待付款信息
  304. hsbyR.GET("/QueryMyPayOrders", hsby.QueryMyPayOrders)
  305. // 获取我的闲置中收款信息查询
  306. hsbyR.GET("/QueryMyCollectionOrders", hsby.QueryMyCollectionOrders)
  307. // 查询海商报业相关市场信息
  308. hsbyR.GET("/QueryHsbyMarkets", hsby.QueryHsbyMarkets)
  309. // 查询游客特卖商品列表(三级商城)
  310. hsbyR.GET("/QueryHsbyVisitorMarketGoodses", hsby.QueryHsbyVisitorMarketGoodses)
  311. // 查询特卖商品列表(三级商城)
  312. hsbyR.GET("/QueryHsbyMarketGoodses", hsby.QueryHsbyMarketGoodses)
  313. // 查询游客三级市场(商城)商品信息详情
  314. hsbyR.GET("/QueryHsbyVisitorMarketGoodsDetail", hsby.QueryHsbyVisitorMarketGoodsDetail)
  315. // 查询三级市场(商城)商品信息详情
  316. hsbyR.GET("/QueryHsbyMarketGoodsDetail", hsby.QueryHsbyMarketGoodsDetail)
  317. // 我的优惠卷查询
  318. hsbyR.GET("/QueryMyCoupons", hsby.QueryMyCoupons)
  319. // 我的优惠卷持仓查询
  320. hsbyR.GET("/QueryMyCouponHolds", hsby.QueryMyCouponHolds)
  321. // 已使用优惠卷查询
  322. hsbyR.GET("/QueryMyUsedCoupon", hsby.QueryMyUsedCoupon)
  323. // 获取终端固定广告配置
  324. hsbyR.GET("/QueryClientFixedADConfigs", hsby.QueryClientFixedADConfigs)
  325. }
  326. // ***************************** 企业风险管理(app)***************************
  327. ermcpR := apiR.Group("Ermcp")
  328. ermcpR.Use(token.Auth())
  329. {
  330. // 查询待点价、履约和全部合同
  331. ermcpR.GET("/QueryUserInfo", ermcp.QueryUserInfo)
  332. ermcpR.GET("/QueryWrStandard", ermcp.QueryWrStandard)
  333. ermcpR.GET("/QueryWrStandardDetail", ermcp.QueryWrStandardDetail)
  334. ermcpR.GET("/QuerySpotContract", ermcp.QuerySpotContract)
  335. ermcpR.GET("/QueryContract", ermcp.QueryContract)
  336. ermcpR.GET("/QueryHedgePlan", ermcp.QueryHedgePlan)
  337. ermcpR.GET("/QueryBusinessDj", ermcp.QueryBusinessDj)
  338. ermcpR.GET("/QueryBusinessJs", ermcp.QueryBusinessJs)
  339. ermcpR.GET("/QueryBusinessJsEx", ermcp.QueryBusinessJsEx)
  340. ermcpR.GET("/QueryBusinessKx", ermcp.QueryBusinessKx)
  341. ermcpR.GET("/QueryBusinessFp", ermcp.QueryBusinessFp)
  342. ermcpR.GET("/QueryChangeLog", ermcp.QueryChangeLog)
  343. ermcpR.GET("/QueryRealtimeExposure", ermcp.QueryRealtimeExposure)
  344. ermcpR.GET("/QueryExposureDetail", ermcp.QueryExposureDetail)
  345. ermcpR.GET("/QueryExposureSpot", ermcp.QueryExposureSpot)
  346. ermcpR.GET("/QueryExposureSpotDetail", ermcp.QueryExposureSpotDetail)
  347. ermcpR.GET("/QueryHisExposure", ermcp.QueryHisExposure)
  348. ermcpR.GET("/QueryMiddleGoods", ermcp.QueryMiddleGoods)
  349. ermcpR.GET("/QueryMiddleGoodsDetail", ermcp.QueryMiddleGoodsDetail)
  350. ermcpR.GET("/QueryGGConvertConfig", ermcp.QueryGGConvertConfig)
  351. ermcpR.GET("/QueryMiddleGoodsChangeLog", ermcp.QueryMiddleGoodsChangeLog)
  352. ermcpR.GET("/QueryAvaildGoodsGroup", ermcp.QueryAvaildGoodsGroup)
  353. ermcpR.GET("/QueryRealtimeExposurePosition", ermcp.QueryRealtimeExposurePosition)
  354. ermcpR.GET("/QueryExposureHedgePosition", ermcp.QueryExposureHedgePosition)
  355. ermcpR.GET("/QryReportDayFinance", ermcp.QryReportDayFinance)
  356. ermcpR.GET("/QryReportDayFinanceKx", ermcp.QryReportDayFinanceKx)
  357. ermcpR.GET("/QryReportDayFinanceFp", ermcp.QryReportDayFinanceFp)
  358. ermcpR.GET("/QryReportMonthFinance", ermcp.QryReportMonthFinance)
  359. ermcpR.GET("/QryReportDaySpot", ermcp.QryReportDaySpot)
  360. ermcpR.GET("/QryReportDaySpotDetail", ermcp.QryReportDaySpotDetail)
  361. ermcpR.GET("/QryReportMonthSpot", ermcp.QryReportMonthSpot)
  362. ermcpR.GET("/QryReportMonthSpotDetail", ermcp.QryReportMonthSpotDetail)
  363. ermcpR.GET("/QryReportAreaSpotPL", ermcp.QryReportAreaSpotPL)
  364. ermcpR.GET("/QueryExposureHedgePositionDetail", ermcp.QueryExposureHedgePositionDetail)
  365. ermcpR.GET("/QueryPendingAuditInfo", ermcp.QueryPendingAuditInfo)
  366. ermcpR.GET("/QueryWarehouseInfo", ermcp.QueryWarehouseInfo)
  367. ermcpR.GET("/QueryAreaStockApply", ermcp.QueryAreaStockApply)
  368. ermcpR.GET("/QueryAreaStockApplySum", ermcp.QueryAreaStockApplySum)
  369. ermcpR.GET("/QueryAreaStock", ermcp.QueryAreaStock)
  370. ermcpR.GET("/QueryAreaStockReport", ermcp.QueryAreaStockReport)
  371. ermcpR.GET("/QueryAreaStockReportDetail", ermcp.QueryAreaStockReportDetail)
  372. ermcpR.GET("/QueryGoodsBrand", ermcp.QueryGoodsBrand)
  373. ermcpR.GET("/QueryGoodsModel", ermcp.QueryGoodsModel)
  374. ermcpR.GET("/QueryAccMgrLoginUser", ermcp.QueryAccMgrLoginUser)
  375. ermcpR.GET("/QueryAccMgrTaaccount", ermcp.QueryAccMgrTaaccount)
  376. ermcpR.GET("/QueryAccMgrMainAccountInfo", ermcp.QueryAccMgrMainAccountInfo)
  377. ermcpR.GET("/QueryAccMgrRole", ermcp.QueryAccMgrRole)
  378. ermcpR.GET("/QueryAccMgrRoleMenu", ermcp.QueryAccMgrRoleMenu)
  379. ermcpR.GET("/QueryRoleMenu", ermcp.QueryRoleMenu)
  380. ermcpR.GET("/QueryAccMgrBizGroupSet", ermcp.QueryAccMgrBizGroupSet)
  381. ermcpR.GET("/QueryAccMgrTaAccountInfo", ermcp.QueryAccMgrTaAccountInfo)
  382. ermcpR.GET("/QuerySpotGoodsPrice", ermcp.QuerySpotGoodsPrice)
  383. ermcpR.GET("/QuerySpotGoodsPriceLog", ermcp.QuerySpotGoodsPriceLog)
  384. ermcpR.GET("/QueryFuturesCompany", ermcp.QueryFuturesCompany)
  385. ermcpR.GET("/QueryTradeConfigTMP", ermcp.QueryTradeConfigTMP)
  386. ermcpR.GET("/QueryExposureGoods", ermcp.QueryExposureGoods)
  387. // 期货相关
  388. // 查询企业风管期货商品信息
  389. ermcpR.GET("/GetErmcpGoods", ermcp.GetErmcpGoods)
  390. // 查询企业风管期货主力、次主力商品信息
  391. ermcpR.GET("/GetErmcpGoodsSortByPosition", ermcp.GetErmcpGoodsSortByPosition)
  392. // 获取企业风管期货持仓头寸信息
  393. ermcpR.GET("/QueryErmcpTradePosition", ermcp.QueryErmcpTradePosition)
  394. // 获取企业风管期货内部持仓单信息
  395. ermcpR.GET("/QueryErmcpInnerHolderDetails", ermcp.QueryErmcpInnerHolderDetails)
  396. // 获取企业风管期货委托单信息
  397. ermcpR.GET("/QueryErmcpOrderDetails", ermcp.QueryErmcpOrderDetails)
  398. // 获取企业风管期货成交单信息
  399. ermcpR.GET("/QueryErmcpTradeDetails", ermcp.QueryErmcpTradeDetails)
  400. // 获取企业风管期货历史委托单信息
  401. ermcpR.GET("/QueryErmcpHisOrderDetails", ermcp.QueryErmcpHisOrderDetails)
  402. // 获取企业风管期货历史成交单信息
  403. ermcpR.GET("/QueryErmcpHisTradeDetails", ermcp.QueryErmcpHisTradeDetails)
  404. // 权限相关
  405. // 获取企业风管终端权限
  406. ermcpR.GET("/GetErmcpRoleFuncMenuLists", ermcp.GetErmcpRoleFuncMenuLists)
  407. // 获取目标登录账号当前对冲账号在线状态
  408. ermcpR.GET("/GetErmcpOutAccountStatus", ermcp.GetErmcpOutAccountStatus)
  409. }
  410. // ***************************** 企业风险管理v3(app)***************************
  411. ermcp3R := apiR.Group("Ermcp3")
  412. ermcp3R.Use(token.Auth())
  413. {
  414. ermcp3R.GET("/QueryDeliveryGoods", ermcp3.QueryDeliveryGoods)
  415. ermcp3R.GET("/QueryDeliveryGoodsDetail", ermcp3.QueryDeliveryGoodsDetail)
  416. ermcp3R.GET("/QuerySpotContract", ermcp3.QuerySpotContract)
  417. ermcp3R.GET("/QuerySpotContractBS", ermcp3.QuerySpotContractBS)
  418. ermcp3R.GET("/QueryExposureDetail", ermcp3.QueryExposureDetail)
  419. ermcp3R.GET("/QueryExposureSpot", ermcp3.QueryExposureSpot)
  420. ermcp3R.GET("/QueryExposureSpotDetail", ermcp3.QueryExposureSpotDetail)
  421. ermcp3R.GET("/QueryDGFactoryItem", ermcp3.QueryDGFactoryItem)
  422. ermcp3R.GET("/QueryGoodsbrand", ermcp3.QueryGoodsbrand)
  423. ermcp3R.GET("/QueryGoodsWrstandard", ermcp3.QueryGoodsWrstandard)
  424. ermcp3R.GET("/QueryAreaStockApply", ermcp3.QueryAreaStockApply)
  425. ermcp3R.GET("/QueryAreaStock", ermcp3.QueryAreaStock)
  426. ermcp3R.GET("/QueryAreaStockApplySum", ermcp3.QueryAreaStockApplySum)
  427. ermcp3R.GET("/QueryAreaStockReportDetail", ermcp3.QueryAreaStockReportDetail)
  428. ermcp3R.GET("/QuerySpotGoodsPrice", ermcp3.QuerySpotGoodsPrice)
  429. ermcp3R.GET("/QuerySpotGoodsPriceLog", ermcp3.QuerySpotGoodsPriceLog)
  430. ermcp3R.GET("/QueryHedgePlan", ermcp3.QueryHedgePlan)
  431. ermcp3R.GET("/QueryGoodsGroup", ermcp3.QueryGoodsGroup)
  432. ermcp3R.GET("/QueryMiddleGoodsDetail", ermcp3.QueryMiddleGoodsDetail)
  433. ermcp3R.GET("/QueryRootUserAccount", ermcp3.QueryRootUserAccount)
  434. ermcp3R.GET("/QueryPaAreaSubject", ermcp3.QueryPaAreaSubject)
  435. ermcp3R.GET("/QueryPaAreaAuditCfg", ermcp3.QueryPaAreaAuditCfg)
  436. ermcp3R.GET("/QueryPaTradeLink", ermcp3.QueryPaTradeLink)
  437. ermcp3R.GET("/QuerySCMiddleGoods", ermcp3.QuerySCMiddleGoods)
  438. ermcp3R.GET("/QueryPaTradeLinkDetail", ermcp3.QueryPaTradeLinkDetail)
  439. ermcp3R.GET("/QueryOutTradeLink", ermcp3.QueryOutTradeLink)
  440. ermcp3R.GET("/QuerySubTaaccount", ermcp3.QuerySubTaaccount)
  441. ermcp3R.GET("/QueryInnerTradeLink", ermcp3.QueryInnerTradeLink)
  442. // 报表
  443. ermcp3R.GET("/QryReportDaySpotDetail", ermcp3.QryReportDaySpotDetail)
  444. ermcp3R.GET("/QryReportDayFinanceKx", ermcp3.QryReportDayFinanceKx)
  445. ermcp3R.GET("/QryReportDayFinanceFp", ermcp3.QryReportDayFinanceFp)
  446. ermcp3R.GET("/QryReportDaySpot", ermcp3.QryReportDaySpot)
  447. ermcp3R.GET("/QryReportMonthSpot", ermcp3.QryReportMonthSpot)
  448. ermcp3R.GET("/QryReportMonthSpotDetail", ermcp3.QryReportMonthSpotDetail)
  449. ermcp3R.GET("/QryAreaSpotplReport", ermcp3.QryAreaSpotplReport)
  450. ermcp3R.GET("/QryAreaExpourseReport", ermcp3.QryAreaExpourseReport)
  451. ermcp3R.GET("/QryAreaExpourseContractDetail", ermcp3.QryAreaExpourseContractDetail)
  452. ermcp3R.GET("/QryAreaExpourseHedgeplanDetail", ermcp3.QryAreaExpourseHedgeplanDetail)
  453. ermcp3R.GET("/QryAreaExpourseFutuDetail", ermcp3.QryAreaExpourseFutuDetail)
  454. ermcp3R.GET("/QryAreaExpourseParamChLogDetail", ermcp3.QryAreaExpourseParamChLogDetail)
  455. ermcp3R.GET("/QryAreaStockReport", ermcp3.QryAreaStockReport)
  456. ermcp3R.GET("/QryFinanceReport", ermcp3.QryFinanceReport)
  457. ermcp3R.GET("/QryAreaSumPL", ermcp3.QryAreaSumPL)
  458. ermcp3R.GET("/QryTaFutureDataReport", ermcp3.QryTaFutureDataReport)
  459. ermcp3R.GET("/QrySCMiddleGoodsReport", ermcp3.QrySCMiddleGoodsReport)
  460. }
  461. // ****************************大连千海金******************************
  462. qhjR := apiR.Group("Qhj")
  463. qhjR.Use(token.Auth())
  464. {
  465. qhjR.GET("QueryContract", qhj.QueryContract)
  466. qhjR.GET("QueryContractLog", qhj.QueryContractLog)
  467. qhjR.GET("QueryRStrategy", qhj.QueryRStrategy)
  468. qhjR.GET("QueryRSTriggerLog", qhj.QueryRSTriggerLog)
  469. qhjR.GET("QueryUserReceiveInfo", qhj.QueryUserReceiveInfo)
  470. qhjR.GET("QueryUserCollectConfig", qhj.QueryUserCollectConfig)
  471. qhjR.GET("QueryTradeGoodsPickup", qhj.QueryTradeGoodsPickup)
  472. qhjR.GET("QueryBankAccountSign", qhj.QueryBankAccountSign)
  473. qhjR.GET("QueryPickGoods", qhj.QueryPickGoods)
  474. qhjR.GET("QueryPickArea", qhj.QueryPickArea)
  475. qhjR.GET("QueryBankInfo", qhj.QueryBankInfo)
  476. qhjR.GET("QueryReckonPriceLog", qhj.QueryReckonPriceLog)
  477. qhjR.GET("QueryCustomerInfo", qhj.QueryCustomerInfo)
  478. qhjR.GET("QueryCusBankSignBank", qhj.QueryCusBankSignBank)
  479. qhjR.GET("QuerySiteColumnDetail", qhj.QuerySiteColumnDetail)
  480. qhjR.GET("QueryAccountInOutApply", qhj.QueryAccountInOutApply)
  481. qhjR.GET("QueryPayOrder", qhj.QueryPayOrder)
  482. qhjR.GET("QueryGoodsEx", qhj.QueryGoodsEx)
  483. qhjR.GET("QueryParentAreaList", qhj.QueryParentAreaList)
  484. qhjR.GET("QueryAreaFinanceConfig", qhj.QueryAreaFinanceConfig)
  485. qhjR.GET("QueryMyTeam", qhj.QueryMyTeam)
  486. qhjR.GET("QueryMyTeamOrder", qhj.QueryTeamOrder)
  487. qhjR.GET("QueryBrokerRewardLog", qhj.QueryBrokerRewardLog)
  488. qhjR.GET("QueryScoreLog", qhj.QueryScoreLog)
  489. qhjR.GET("QueryBrokerApply", qhj.QueryBrokerApply)
  490. qhjR.GET("QueryBrokerApplyEx", qhj.QueryBrokerApplyEx)
  491. }
  492. // *************************千海金(PCWeb)*****************************
  493. qhjPCWebR := apiR.Group("QhjMgr")
  494. qhjPCWebR.Use(token.Auth())
  495. {
  496. qhjPCWebR.GET("QuerySubArea", qhjPCWeb.QuerySubArea)
  497. qhjPCWebR.GET("QueryCustomerInfo", qhjPCWeb.QueryCustomerInfo)
  498. qhjPCWebR.GET("QueryAccountInOutApply", qhjPCWeb.QueryAccountInOutApply)
  499. qhjPCWebR.GET("QueryTradePosition", qhjPCWeb.QueryTradePosition)
  500. qhjPCWebR.GET("QueryTradeDetail", qhjPCWeb.QueryTradeDetail)
  501. qhjPCWebR.GET("QueryTradeOrderDetail", qhjPCWeb.QueryTradeOrderDetail)
  502. qhjPCWebR.GET("QueryTradePayOrder", qhjPCWeb.QueryTradePayOrder)
  503. qhjPCWebR.GET("QueryContract", qhjPCWeb.QueryContract)
  504. qhjPCWebR.GET("QueryPickGoods", qhjPCWeb.QueryPickGoods)
  505. qhjPCWebR.GET("QueryBrokerApply", qhjPCWeb.QueryBrokerApply)
  506. qhjPCWebR.GET("QueryBrokerRewardReport", qhjPCWeb.QueryBrokerRewardReport)
  507. }
  508. // **********************千海金(协议和签约)**************************
  509. qhjAgreementR := apiR.Group("QhjSys")
  510. {
  511. qhjAgreementR.GET("QueryAgreementConfig", qhj.QueryAgreementConfig)
  512. qhjAgreementR.GET("QueryAgreementChangeLog", qhj.QueryAgreementChangeLog)
  513. qhjAgreementR.GET("QueryNodeAgreementConfig", qhj.QueryNodeAgreementConfig)
  514. qhjAgreementR.GET("QueryCustomerSignStatus", qhj.QueryCustomerSignStatus)
  515. qhjAgreementR.GET("QueryQhjCustomerSignLog", qhj.QueryQhjCustomerSignLog)
  516. qhjAgreementR.GET("QueryUserNodeCfgAndStatus", qhj.QueryUserNodeCfgAndStatus)
  517. }
  518. // **************************仓单贸易v2(仓单优化)********************
  519. wrTrade2R := apiR.Group("WrTrade2")
  520. wrTrade2R.Use(token.Auth())
  521. {
  522. wrTrade2R.GET("QueryOrderQuote", wrTrade2.QueryOrderQuote)
  523. wrTrade2R.GET("QueryOrderQuoteDetail", wrTrade2.QueryOrderQuoteDetail)
  524. wrTrade2R.GET("QueryWrPosition", wrTrade2.QueryWrPosition)
  525. wrTrade2R.GET("QueryWrOrderDetail", wrTrade2.QueryWrOrderDetail)
  526. wrTrade2R.GET("QueryWrTradeDetail", wrTrade2.QueryWrTradeDetail)
  527. wrTrade2R.GET("QueryWrSpecialMatchOrder", wrTrade2.QueryWrSpecialMatchOrder)
  528. wrTrade2R.GET("QueryWrGoodsInfo", wrTrade2.QueryWrGoodsInfo)
  529. wrTrade2R.GET("QueryPerformancePlan", wrTrade2.QueryPerformancePlan)
  530. wrTrade2R.GET("QueryHoldLB", wrTrade2.QueryHoldLB)
  531. wrTrade2R.GET("QueryFilterItem", wrTrade2.QueryFilterItem)
  532. wrTrade2R.GET("QueryFaProductDetail", wrTrade2.QueryFaProductDetail)
  533. wrTrade2R.GET("QueryWrFactorTypeInfo", wrTrade2.QueryWrFactorTypeInfo)
  534. wrTrade2R.GET("QueryWrFactorTypeInfoEx", wrTrade2.QueryWrFactorTypeInfoEx)
  535. wrTrade2R.GET("QueryWrMarketTradeConfig", wrTrade2.QueryWrMarketTradeConfig)
  536. wrTrade2R.GET("QueryFtDeliveryGoods", wrTrade2.QueryFtDeliveryGoods)
  537. wrTrade2R.GET("QueryWrStandardFactoryItem", wrTrade2.QueryWrStandardFactoryItem)
  538. wrTrade2R.GET("QueryWrPerformancePlanStep", wrTrade2.QueryWrPerformancePlanStep)
  539. wrTrade2R.GET("QueryWrFinanceBuyApply", wrTrade2.QueryWrFinanceBuyApply)
  540. wrTrade2R.GET("QueryWrScfContract", wrTrade2.QueryWrScfContract)
  541. wrTrade2R.GET("QueryWrBuybackDetail", wrTrade2.QueryWrBuybackDetail)
  542. wrTrade2R.GET("QueryWrScfContractInterest", wrTrade2.QueryWrScfContractInterest)
  543. wrTrade2R.GET("QueryWrOutInApply", wrTrade2.QueryWrOutInApply)
  544. wrTrade2R.GET("QueryWrDeliveryDetail", wrTrade2.QueryWrDeliveryDetail)
  545. wrTrade2R.GET("QueryWrBsGoodsInfo", wrTrade2.QueryWrBsGoodsInfo)
  546. wrTrade2R.GET("QueryWrTradeOrderDetail", wrTrade2.QueryWrTradeOrderDetail)
  547. wrTrade2R.GET("QueryWrAverageTradePrice", wrTrade2.QueryWrAverageTradePrice)
  548. wrTrade2R.GET("QueryOrderQuoteMyq", wrTrade2.QueryOrderQuoteMyq)
  549. wrTrade2R.GET("QueryWrDeliveryAvalidHoldLB", wrTrade2.QueryWrDeliveryAvalidHoldLB)
  550. wrTrade2R.GET("QueryWrUserFriend", wrTrade2.QueryWrUserFriend)
  551. wrTrade2R.GET("QueryWrFriendApply", wrTrade2.QueryWrFriendApply)
  552. wrTrade2R.GET("QueryPermancePlanTmp", wrTrade2.QueryPermancePlanTmp)
  553. wrTrade2R.GET("QueryWrTradeBargainApply", wrTrade2.QueryWrTradeBargainApply)
  554. wrTrade2R.GET("QueryWrPerformanceStepType", wrTrade2.QueryWrPerformanceStepType)
  555. }
  556. // **************************天津麦顿*************************
  557. tjmdR := apiR.Group("Tjmd")
  558. tjmdR.Use(token.Auth())
  559. {
  560. tjmdR.GET("QueryQuoteGoodsList", tjmd.QueryQuoteGoodsList)
  561. tjmdR.GET("QueryTjmdTradeOrderDetail", tjmd.QueryTjmdTradeOrderDetail)
  562. tjmdR.GET("QueryTjmdTransferApply", tjmd.QueryTjmdTransferApply)
  563. tjmdR.GET("QueryTjmdTodayAccountMargin", tjmd.QueryTjmdTodayAccountMargin)
  564. }
  565. // **************************中江*************************
  566. zjR := apiR.Group("ZJ")
  567. zjR.Use()
  568. {
  569. zjR.GET("GetBankTip", zj.GetBankTip)
  570. zjR.GET("GetCusBankChannels", zj.GetCusBankChannels)
  571. }
  572. return r
  573. }
  574. func ginLoggerMiddleware() gin.HandlerFunc {
  575. return func(c *gin.Context) {
  576. start := time.Now()
  577. c.Next()
  578. end := time.Now()
  579. latency := end.Sub(start)
  580. path := c.Request.URL.RequestURI()
  581. clientip := c.ClientIP()
  582. method := c.Request.Method
  583. statuscode := c.Writer.Status()
  584. logger.GetLogger().Debugf("|%3d|%13v|%15s|%s %s",
  585. statuscode,
  586. latency,
  587. clientip,
  588. method,
  589. path)
  590. }
  591. }
  592. func ginRecoveryMiddleware() gin.HandlerFunc {
  593. return gin.RecoveryWithWriter(logger.GetLogWriter())
  594. }
  595. // CORSMiddleware cors跨域.
  596. func CORSMiddleware() gin.HandlerFunc {
  597. return func(c *gin.Context) {
  598. c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
  599. c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
  600. c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With, X-session-Token")
  601. c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
  602. c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type, X-session-Token")
  603. if c.Request.Method == "OPTIONS" {
  604. c.AbortWithStatus(http.StatusNoContent)
  605. return
  606. }
  607. c.Next()
  608. }
  609. }