index.ts 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. import { v4 } from 'uuid'
  2. import http from '@/services/http'
  3. import { RequestConfig } from '@/services/http/types'
  4. import { ClientType } from '@/constants/client'
  5. import { useLoginStore, useAccountStore } from '@/stores'
  6. const loginStore = useLoginStore()
  7. const accountStore = useAccountStore()
  8. /**
  9. * 铁合金现货预售摘牌
  10. */
  11. export function spotPresaleDestingOrder(config: RequestConfig<Partial<Proto.SpotPresaleDestingOrderReq>>) {
  12. return http.mqRequest<Proto.SpotPresaleDestingOrderRsp>({
  13. data: config.data,
  14. requestCode: 'SpotPresaleDestingOrderReq',
  15. responseCode: 'SpotPresaleDestingOrderRsp',
  16. marketId: 64201
  17. })
  18. }
  19. /**
  20. * 铁合金现货预售交收确认
  21. */
  22. export function spotPresaleDeliveryConfirm(config: RequestConfig<Proto.SpotPresaleDeliveryConfirmReq>) {
  23. return http.mqRequest<Proto.SpotPresaleDeliveryConfirmRsp>({
  24. data: config.data,
  25. requestCode: 'SpotPresaleDeliveryConfirmReq',
  26. responseCode: 'SpotPresaleDeliveryConfirmRsp',
  27. marketId: 64201
  28. })
  29. }
  30. /**
  31. * 铁合金现货预售违约确认
  32. */
  33. export function spotPresaleBreachOfContractConfirm(config: RequestConfig<Proto.SpotPresaleBreachOfContractConfirmReq>) {
  34. return http.mqRequest<Proto.SpotPresaleBreachOfContractConfirmRsp>({
  35. data: config.data,
  36. requestCode: 'SpotPresaleBreachOfContractConfirmReq',
  37. responseCode: 'SpotPresaleBreachOfContractConfirmRsp',
  38. marketId: 64201
  39. })
  40. }
  41. /**
  42. * 铁合金现货预售违约申请接口请求
  43. */
  44. export function spotPresaleBreachOfContractApply(config: RequestConfig<Proto.SpotPresaleBreachOfContractApplyReq>) {
  45. return http.mqRequest<Proto.SpotPresaleBreachOfContractApplyRsp>({
  46. data: config.data,
  47. requestCode: 'SpotPresaleBreachOfContractApplyReq',
  48. responseCode: 'SpotPresaleBreachOfContractApplyRsp',
  49. marketId: 64201
  50. })
  51. }
  52. /**
  53. * 铁合金现货预售付款处理接口请求
  54. */
  55. export function spotPresalePlayment(config: RequestConfig<Proto.SpotPresalePlaymentReq>) {
  56. return http.mqRequest<Proto.SpotPresalePlaymentRsp>({
  57. data: config.data,
  58. requestCode: 'SpotPresalePlaymentReq',
  59. responseCode: 'SpotPresalePlaymentRsp',
  60. marketId: 64201
  61. })
  62. }
  63. /**
  64. * 挂牌撤单请求
  65. */
  66. export function wrListingCancelOrder(config: RequestConfig<Proto.WRListingCancelOrderReq>) {
  67. return http.mqRequest<Proto.WRListingCancelOrderRsp>({
  68. data: config.data,
  69. requestCode: 'WRListingCancelOrderReq',
  70. responseCode: 'WRListingCancelOrderRsp',
  71. marketId: 65201
  72. })
  73. }
  74. /**
  75. * 仓单出库申请
  76. */
  77. export function wrOutApply(config: RequestConfig<Proto.WROutApplyReq>) {
  78. return http.mqRequest<Proto.WROutApplyRsp>({
  79. data: config.data,
  80. requestCode: 'WROutApplyReq',
  81. responseCode: 'WROutApplyRsp'
  82. })
  83. }
  84. /**
  85. * 持仓单挂牌请求
  86. */
  87. export function hdWROrder(config: RequestConfig<Proto.HdWROrderReq>) {
  88. return http.mqRequest<Proto.HdWROrderRsp>({
  89. data: config.data,
  90. requestCode: 'HdWROrderReq',
  91. responseCode: 'HdWROrderRsp',
  92. marketId: 17201
  93. })
  94. }
  95. /**
  96. * 持仓单摘牌请求
  97. */
  98. export function hdWRDealOrder(config: RequestConfig<Proto.HdWRDealOrderReq>) {
  99. return http.mqRequest<Proto.HdWRDealOrderRsp>({
  100. data: config.data,
  101. requestCode: 'HdWRDealOrderReq',
  102. responseCode: 'HdWRDealOrderRsp'
  103. })
  104. }
  105. /**
  106. * 铁合金现货预售转让挂牌接口请求
  107. */
  108. export function spotPresaleTransferListing(config: RequestConfig<Proto.SpotPresaleTransferListingReq>) {
  109. return http.mqRequest<Proto.SpotPresaleTransferListingRsp>({
  110. data: config.data,
  111. requestCode: 'SpotPresaleTransferListingReq',
  112. responseCode: 'SpotPresaleTransferListingRsp',
  113. marketId: 64201
  114. })
  115. }
  116. /**
  117. * 铁合金现货预售转让撤销接口请求
  118. */
  119. export function spotPresaleTransferCancel(config: RequestConfig<Proto.SpotPresaleTransferCancelReq>) {
  120. return http.mqRequest<Proto.SpotPresaleTransferCancelRsp>({
  121. data: config.data,
  122. requestCode: 'SpotPresaleTransferCancelReq',
  123. responseCode: 'SpotPresaleTransferCancelRsp',
  124. marketId: 64201
  125. })
  126. }
  127. /**
  128. * 铁合金现货预售转让摘牌接口请求
  129. */
  130. export function spotPresaleTransferDesting(config: RequestConfig<Proto.SpotPresaleTransferDestingReq>) {
  131. return http.mqRequest<Proto.SpotPresaleTransferDestingRsp>({
  132. data: config.data,
  133. requestCode: 'SpotPresaleTransferDestingReq',
  134. responseCode: 'SpotPresaleTransferDestingRsp',
  135. marketId: 64201
  136. })
  137. }
  138. /**
  139. * 铁合金收益支取申请接口请求
  140. */
  141. export function thjProfitDrawApply(config: RequestConfig<Proto.THJProfitDrawApplyReq>) {
  142. return http.mqRequest<Proto.THJProfitDrawApplyRsp>({
  143. data: config.data,
  144. requestCode: 'THJProfitDrawApplyReq',
  145. responseCode: 'THJProfitDrawApplyRsp',
  146. marketId: 65201
  147. })
  148. }
  149. /**
  150. * 铁合金预售点价
  151. */
  152. export function spotPresalePointPrice(config: RequestConfig<Proto.SpotPresalePointPriceReq>) {
  153. return http.mqRequest<Proto.SpotPresalePointPriceRsp>({
  154. data: config.data,
  155. requestCode: 'SpotPresalePointPriceReq',
  156. responseCode: 'SpotPresalePointPriceRsp',
  157. marketId: 64201
  158. })
  159. }
  160. /**
  161. * 挂牌撤单
  162. */
  163. export function cancelOrder(config: RequestConfig<Proto.CancelOrderReq>) {
  164. return http.mqRequest<Proto.CancelOrderRsp>({
  165. data: config.data,
  166. requestCode: 'CancelOrderReq',
  167. responseCode: 'CancelOrderRsp'
  168. })
  169. }
  170. /**
  171. * 交易下单
  172. */
  173. export function order(config: RequestConfig<Proto.OrderReq>) {
  174. return http.mqRequest<Proto.OrderRsp>({
  175. data: config.data,
  176. requestCode: 'OrderReq',
  177. responseCode: 'OrderRsp',
  178. marketId: config.data?.MarketID
  179. })
  180. }
  181. /**
  182. * 按单平仓
  183. */
  184. export function holderClose(config: RequestConfig<Proto.HolderCloseReq>) {
  185. return http.mqRequest<Proto.HolderCloseRsp>({
  186. data: config.data,
  187. requestCode: 'HolderCloseReq',
  188. responseCode: 'HolderCloseRsp',
  189. })
  190. }
  191. /**
  192. * 交割申报
  193. */
  194. export function deliveryOrder(config: RequestConfig<Partial<Proto.DeliveryOrderReq>>) {
  195. return http.mqRequest<Proto.DeliveryOrderRsp>({
  196. data: config.data,
  197. requestCode: 'DeliveryOrderReq',
  198. responseCode: 'DeliveryOrderRsp',
  199. })
  200. }
  201. /**
  202. * 补足定金
  203. */
  204. export function makeUpDeposit(config: RequestConfig<Partial<Proto.MakeUpDepositReq>>) {
  205. return http.mqRequest<Proto.MakeUpDepositRsp>({
  206. data: {
  207. UserID: loginStore.userId,
  208. AccountID: accountStore.currentAccountId,
  209. ClientSerialNo: v4(),
  210. ClientType: ClientType.Web,
  211. ...config.data
  212. },
  213. requestCode: 'MakeUpDepositReq',
  214. responseCode: 'MakeUpDepositRsp',
  215. })
  216. }
  217. /**
  218. * 持仓追加定金
  219. */
  220. export function holdAppendDeposit(config: RequestConfig<Partial<Proto.HoldAppendDepositReq>>) {
  221. return http.mqRequest<Proto.HoldAppendDepositRsp>({
  222. data: {
  223. AccountID: accountStore.currentAccountId,
  224. ClientSerialNo: v4(),
  225. ClientType: ClientType.Web,
  226. ...config.data
  227. },
  228. requestCode: 'HoldAppendDepositReq',
  229. responseCode: 'HoldAppendDepositRsp',
  230. marketId: 49201
  231. })
  232. }
  233. /**
  234. * 线下交收申请请求(水贝亿爵)
  235. */
  236. export function offlineDelivery(config: RequestConfig<Partial<Proto.OfflineDeliveryReq>>) {
  237. return http.mqRequest<Proto.OfflineDeliveryRsp>({
  238. data: {
  239. AccountID: accountStore.currentAccountId,
  240. ClientTicket: v4(),
  241. UserID: loginStore.userId,
  242. ...config.data
  243. },
  244. requestCode: 'OfflineDeliveryReq',
  245. responseCode: 'OfflineDeliveryRsp',
  246. marketId: 49201
  247. })
  248. }
  249. /**
  250. * 补充定金接口请求(水贝亿爵)
  251. */
  252. export function supplementDeposit(config: RequestConfig<Partial<Proto.SupplementDepositReq>>) {
  253. return http.mqRequest<Proto.SupplementDepositRsp>({
  254. data: {
  255. AccountID: accountStore.currentAccountId,
  256. ClientSerialNo: v4(),
  257. UserID: loginStore.userId,
  258. ...config.data
  259. },
  260. requestCode: 'SupplementDepositReq',
  261. responseCode: 'SupplementDepositRsp',
  262. marketId: 52101
  263. })
  264. }
  265. /**
  266. * 退返定金接口请求(水贝亿爵)
  267. */
  268. export function refundedDeposit(config: RequestConfig<Partial<Proto.RefundedDepositReq>>) {
  269. return http.mqRequest<Proto.RefundedDepositRsp>({
  270. data: {
  271. AccountID: accountStore.currentAccountId,
  272. ClientSerialNo: v4(),
  273. UserID: loginStore.userId,
  274. ...config.data
  275. },
  276. requestCode: 'RefundedDepositReq',
  277. responseCode: 'RefundedDepositRsp',
  278. marketId: 52101
  279. })
  280. }
  281. /**
  282. * 按单做市交收申请接口请求(水贝亿爵)
  283. */
  284. export function marketOrderDeliveryApply(config: RequestConfig<Partial<Proto.MarketOrderDeliveryApplyReq>>) {
  285. return http.mqRequest<Proto.MarketOrderDeliveryApplyRsp>({
  286. data: {
  287. AccountID: accountStore.currentAccountId,
  288. ClientSerialNo: v4(),
  289. UserID: loginStore.userId,
  290. ...config.data
  291. },
  292. requestCode: 'MarketOrderDeliveryApplyReq',
  293. responseCode: 'MarketOrderDeliveryApplyRsp',
  294. marketId: 52101
  295. })
  296. }
  297. /**
  298. * 交收终端操作接口请求(水贝亿爵)
  299. */
  300. export function deliveryClientOperator(config: RequestConfig<Partial<Proto.DeliveryClientOperatorReq>>) {
  301. return http.mqRequest<Proto.DeliveryClientOperatorRsp>({
  302. data: {
  303. AccountID: accountStore.currentAccountId,
  304. ClientSerialNo: v4(),
  305. UserID: loginStore.userId,
  306. ClientType: ClientType.Web,
  307. ...config.data
  308. },
  309. requestCode: 'DeliveryClientOperatorReq',
  310. responseCode: 'DeliveryClientOperatorRsp',
  311. marketId: 52101
  312. })
  313. }