useMonitor.ts 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { useAjax } from '@/Hook/useAjax'
  2. import {
  3. ListType, getPlanListApi, getTotalCostApi, getPlanCostApi, getCostSpeedApi, getUserGroupApi, getAllPlanListApi,
  4. allPlanProps, getDetailListApi, getMinuteListApi, downLoadUpAdApi, downLoadDetailApi,
  5. downLoadDetailMinuteApi, downLoadSpeedApi, downLoadAllAdListApi, addEditGroupApi, getAdGroupListApi, deleteAdGroupApi,
  6. getAccountListApi, AccountListProps, addDelAccountApi, getBookListAllApi, getAdqAccountListApi
  7. } from '@/services/adMonitor/adMonitor'
  8. export default function useMonitor() {
  9. /** 获取起量计划列表 */
  10. const getPlanList = useAjax((params: ListType) => getPlanListApi(params), { formatResult: true })
  11. /**获取起来计划列表明细*/
  12. const getPlanDetailList = useAjax((params: ListType) => getDetailListApi(params), { formatResult: true, debounceInterval: 100 })
  13. /**获取起来计划列表5min*/
  14. const getMinuteList = useAjax((params: ListType) => getMinuteListApi(params), { formatResult: true, debounceInterval: 100 })
  15. /** 获取今日计划总消耗图谱 */
  16. const getTotalCost = useAjax((params: ListType) => getTotalCostApi(params), { formatResult: true })
  17. /** 获取计划消耗图谱 */
  18. const getPlanCost = useAjax((params: ListType) => getPlanCostApi(params), { formatResult: true })
  19. /** 获取消耗速度详情(弹窗) */
  20. const getCostSpeed = useAjax((params: ListType) => getCostSpeedApi(params), { formatResult: true })
  21. /** 获取组员 */
  22. const getUserGroup = useAjax(() => getUserGroupApi(), { formatResult: true })
  23. /** 计划列表 */
  24. const getAllPlanList = useAjax((params: allPlanProps) => getAllPlanListApi(params), { formatResult: true, debounceInterval: 500 })
  25. const getBookListAll = useAjax(() => getBookListAllApi(), { formatResult: true })
  26. /** 下载 */
  27. const downLoadUpAd = useAjax((params: ListType) => downLoadUpAdApi(params), { formatResult: true })
  28. const downLoadDetail = useAjax((params: ListType) => downLoadDetailApi(params), { formatResult: true })
  29. const downLoadDetailMinute = useAjax((params: ListType) => downLoadDetailMinuteApi(params), { formatResult: true })
  30. const downLoadSpeed = useAjax((params: ListType) => downLoadSpeedApi(params), { formatResult: true })
  31. const downLoadAllAdList = useAjax((params: allPlanProps) => downLoadAllAdListApi(params), { formatResult: true })
  32. // 监控数据源
  33. const addEditGroup = useAjax((params: { groupName: string, id?: number, remark?: string }) => addEditGroupApi(params), { formatResult: true })
  34. const getAdGroupList = useAjax(() => getAdGroupListApi(), { formatResult: true })
  35. const deleteAdGroup = useAjax((params: { id: number }) => deleteAdGroupApi(params), { formatResult: true })
  36. const getAccountList = useAjax((params: AccountListProps) => getAccountListApi(params), { formatResult: true })
  37. const addDelAccount = useAjax((params: { accountIdList: number[], groupId: number, type: 0 | 1 }) => addDelAccountApi(params), { formatResult: true })
  38. // 获取广告账号列表
  39. const getAdqAccountList = useAjax(() => getAdqAccountListApi(), { formatResult: true })
  40. return {
  41. getPlanList,
  42. getTotalCost,
  43. getPlanCost,
  44. getCostSpeed,
  45. getUserGroup,
  46. getAllPlanList,
  47. getPlanDetailList,
  48. getMinuteList,
  49. downLoadUpAd,
  50. downLoadDetail,
  51. downLoadDetailMinute,
  52. downLoadSpeed,
  53. downLoadAllAdList,
  54. addEditGroup,
  55. getAdGroupList,
  56. deleteAdGroup,
  57. getAccountList,
  58. addDelAccount,
  59. getBookListAll,
  60. getAdqAccountList
  61. }
  62. }