router.go 24 KB

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