index.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import request from '@/utils/request';
  2. import { AxiosPromise } from 'axios';
  3. import {
  4. TournamentsVO,
  5. TournamentsForm,
  6. TournamentsQuery,
  7. TournamentsBindStructuresQuery,
  8. TournamentsBindStructuresVO
  9. } from '@/api/system/business/tournaments/types';
  10. /**
  11. * 查询【请填写功能名称】列表
  12. * @param query
  13. * @returns {*}
  14. */
  15. export const listTournaments = (query?: TournamentsQuery): AxiosPromise<TournamentsVO[]> => {
  16. return request({
  17. url: '/business/tournaments/list',
  18. method: 'get',
  19. params: query
  20. });
  21. };
  22. /**
  23. * 查询【请填写功能名称】详细
  24. * @param id
  25. */
  26. export const getTournaments = (id: string | number): AxiosPromise<TournamentsVO> => {
  27. return request({
  28. url: '/business/tournaments/' + id,
  29. method: 'get'
  30. });
  31. };
  32. /**
  33. * 新增【请填写功能名称】
  34. * @param data
  35. */
  36. export const addTournaments = (data: TournamentsForm) => {
  37. return request({
  38. url: '/business/tournaments',
  39. method: 'post',
  40. data: data
  41. });
  42. };
  43. /**
  44. * 修改【请填写功能名称】
  45. * @param data
  46. */
  47. export const updateTournaments = (data: TournamentsForm) => {
  48. return request({
  49. url: '/business/tournaments',
  50. method: 'put',
  51. data: data
  52. });
  53. };
  54. /**
  55. * 删除【请填写功能名称】
  56. * @param id
  57. */
  58. export const delTournaments = (id: string | number | Array<string | number>) => {
  59. return request({
  60. url: '/business/tournaments/' + id,
  61. method: 'delete'
  62. });
  63. };
  64. export const getSelectTournamentBlindStructuresList = (query?: TournamentsBindStructuresQuery): AxiosPromise<TournamentsBindStructuresVO[]> => {
  65. return request({
  66. url: '/business/tournaments/selectTournamentBlindStructuresList',
  67. method: 'get',
  68. params: query
  69. });
  70. };
  71. /**
  72. * 分配盲注给赛事
  73. * @param data 请求数据 { tournamentId, blindStructureIds }
  74. */
  75. export const assignTournamentBlindStructures = (data: { tournamentId: number; blindStructureIds: number[] }): AxiosPromise<void> => {
  76. return request({
  77. url: '/business/tournaments/assignTournamentBlindStructures',
  78. method: 'post',
  79. data: data
  80. });
  81. };
  82. /**
  83. * 上传 比赛图标
  84. * @param file 文件
  85. */
  86. export const uploadTournament = async (file: File) => {
  87. const formData = new FormData();
  88. formData.append('file', file); // 后端接收的参数名是 "file"
  89. const res = await request({
  90. url: '/business/tournaments/uploadTournament',
  91. method: 'POST',
  92. data: formData,
  93. headers: {
  94. 'Content-Type': 'multipart/form-data'
  95. }
  96. });
  97. return res;
  98. };
  99. /**
  100. * 删除【请填写功能名称】
  101. * @param id
  102. */
  103. export const deleteCheckTournament = (id: string | number | Array<string | number>) => {
  104. return request({
  105. url: '/business/tournaments/deleteCheckTournament/' + id,
  106. method: 'delete'
  107. });
  108. };
  109. export const closeSendTournament = (id: string | number | Array<string | number>) => {
  110. return request({
  111. url: '/business/tournaments/closeSendTournament/' + id,
  112. method: 'GET'
  113. });
  114. };
  115. /**
  116. * 查询 赛事统计相关
  117. * @param query
  118. */
  119. export const getStatisticsPageList = (query?: TournamentsQuery): AxiosPromise<TournamentsVO[]> => {
  120. return request({
  121. url: '/business/tournaments/getStatisticsPageList',
  122. method: 'get',
  123. params: query
  124. });
  125. };
  126. /**
  127. * 恢复比赛
  128. * @param id
  129. */
  130. export const recoverTournament = (id: string | number | Array<string | number>) => {
  131. return request({
  132. url: '/business/tournaments/recoverTournament/' + id,
  133. method: 'delete'
  134. });
  135. };
  136. /**
  137. * 粉碎删除
  138. * @param id
  139. */
  140. export const deleteRelationTournament = (id: string | number | Array<string | number>) => {
  141. return request({
  142. url: '/business/tournaments/deleteRelationTournament/' + id,
  143. method: 'delete'
  144. });
  145. };
  146. export const publishToTournament = (id: string | number | Array<string | number>) => {
  147. return request({
  148. url: '/business/tournaments/publishToTournament/' + id,
  149. method: 'get'
  150. });
  151. };