router.go 25 KB

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