router.go 33 KB

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