router.go 28 KB

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