router.go 31 KB

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