useWeChat.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { useAjax } from '@/Hook/useAjax'
  2. import { getAccApi, getOrientApi, setPromotionPageAjax, getLayoutLocalApi, delLayoutLocalApi,
  3. delAdPlanLocalApi, getPlanActionRecordApi, createAd, getAdWechatServiceNameApi, getAdWechatWechatNameApi,
  4. getTaskListApi, getScanStatusApi, TaskProps, PlanProps, OrientProps, refreshDataApi } from '@/services/operating/adWeChat'
  5. export default function useWeChat() {
  6. const getAcc = useAjax(() => getAccApi(), { formatResult: true })
  7. const getOrient = useAjax((params: OrientProps) => getOrientApi(params), { formatResult: true })
  8. // const getBookRank = useAjax((params: Params) => bookRank(params), { formatResult: true })
  9. const setPromotionPage = useAjax((params: { userId: string | number, name: string, typesetting: string }) => setPromotionPageAjax(params), { formatResult: true })
  10. const getLayoutLocal = useAjax((params: { pageNum: number, pageSize: number, name?: string | undefined, updateStartDate?: string | undefined, updateEndDate?: string | undefined }) => getLayoutLocalApi(params), { formatResult: true })
  11. const delLayoutLocal = useAjax((params: { userId: string | number, name: string }) => delLayoutLocalApi(params), { formatResult: true })
  12. const delAdPlanLocal = useAjax((params: { objectName: string, serviceName: string, wechatName: string }) => delAdPlanLocalApi(params), { formatResult: true })
  13. const getPlanActionRecord = useAjax((params: PlanProps) => getPlanActionRecordApi(params), { formatResult: true })
  14. const createAdPost = useAjax((params) => createAd(params), { formatResult: true })
  15. const getAdWechatServiceName = useAjax(() => getAdWechatServiceNameApi(), { formatResult: true })
  16. const getAdWechatWechatName = useAjax((params: { serviceName: string }) => getAdWechatWechatNameApi(params), { formatResult: true })
  17. const getTaskList = useAjax((params: TaskProps) => getTaskListApi(params), { formatResult: true })
  18. const getScanStatus = useAjax(() => getScanStatusApi(), { formatResult: true })
  19. const refreshData = useAjax((params: {userId: number, is_refresh: string}) => refreshDataApi(params), { formatResult: true })
  20. return {
  21. getAcc,
  22. getOrient,
  23. setPromotionPage,
  24. getLayoutLocal,
  25. delLayoutLocal,
  26. delAdPlanLocal,
  27. getPlanActionRecord,
  28. createAdPost,
  29. getAdWechatServiceName,
  30. getAdWechatWechatName,
  31. getTaskList,
  32. getScanStatus,
  33. refreshData
  34. }
  35. }