router.go 29 KB

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