api.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import { request } from '@umijs/max';
  4. /** 获取当前的用户 GET /api/currentUser */
  5. export async function currentUser(options?: { [key: string]: any }) {
  6. return request<{
  7. data: API.CurrentUser;
  8. }>('/api/currentUser', {
  9. method: 'GET',
  10. ...(options || {}),
  11. });
  12. }
  13. /** 退出登录接口 POST /api/login/outLogin */
  14. export async function outLogin(options?: { [key: string]: any }) {
  15. return request<Record<string, any>>('/api/login/outLogin', {
  16. method: 'POST',
  17. ...(options || {}),
  18. });
  19. }
  20. /** 登录接口 POST /api/login/account */
  21. export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  22. return request<API.LoginResult>('/api/login/account', {
  23. method: 'POST',
  24. headers: {
  25. 'Content-Type': 'application/json',
  26. },
  27. data: body,
  28. ...(options || {}),
  29. });
  30. }
  31. /** 此处后端没有提供注释 GET /api/notices */
  32. export async function getNotices(options?: { [key: string]: any }) {
  33. return request<API.NoticeIconList>('/api/notices', {
  34. method: 'GET',
  35. ...(options || {}),
  36. });
  37. }
  38. /** 获取规则列表 GET /api/rule */
  39. export async function rule(
  40. params: {
  41. // query
  42. /** 当前的页码 */
  43. current?: number;
  44. /** 页面的容量 */
  45. pageSize?: number;
  46. },
  47. options?: { [key: string]: any },
  48. ) {
  49. return request<API.RuleList>('/api/rule', {
  50. method: 'GET',
  51. params: {
  52. ...params,
  53. },
  54. ...(options || {}),
  55. });
  56. }
  57. /** 更新规则 PUT /api/rule */
  58. export async function updateRule(options?: { [key: string]: any }) {
  59. return request<API.RuleListItem>('/api/rule', {
  60. method: 'POST',
  61. data:{
  62. method: 'update',
  63. ...(options || {}),
  64. }
  65. });
  66. }
  67. /** 新建规则 POST /api/rule */
  68. export async function addRule(options?: { [key: string]: any }) {
  69. return request<API.RuleListItem>('/api/rule', {
  70. method: 'POST',
  71. data:{
  72. method: 'post',
  73. ...(options || {}),
  74. }
  75. });
  76. }
  77. /** 删除规则 DELETE /api/rule */
  78. export async function removeRule(options?: { [key: string]: any }) {
  79. return request<Record<string, any>>('/api/rule', {
  80. method: 'POST',
  81. data:{
  82. method: 'delete',
  83. ...(options || {}),
  84. }
  85. });
  86. }