|
@@ -1,4 +1,4 @@
|
|
-import React, { useEffect, useState } from "react"
|
|
|
|
|
|
+import React, { useCallback, useEffect, useState } from "react"
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
import { getNovelGDTListApi, GetNovelGDTListProps, getNovelGDTTotalApi } from "@/services/iaaData"
|
|
import { getNovelGDTListApi, GetNovelGDTListProps, getNovelGDTTotalApi } from "@/services/iaaData"
|
|
import TablePro from "@/components/TablePro"
|
|
import TablePro from "@/components/TablePro"
|
|
@@ -6,7 +6,7 @@ import columns12 from "./tableConfig"
|
|
import moment from "moment"
|
|
import moment from "moment"
|
|
import { useModel } from "umi"
|
|
import { useModel } from "umi"
|
|
import { Button, Dropdown, message, Select, Space, Switch } from "antd"
|
|
import { Button, Dropdown, message, Select, Space, Switch } from "antd"
|
|
-import { modifyStatusBatchApi } from "@/services/gameData"
|
|
|
|
|
|
+import { modifyStatusBatchApi, syncBatchApi } from "@/services/gameData"
|
|
import { DeleteOutlined, DownOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
|
|
import { DeleteOutlined, DownOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
|
|
import DayAd from "./dayAd"
|
|
import DayAd from "./dayAd"
|
|
import QueryFormNovel from "@/components/QueryForm/queryFormNovel"
|
|
import QueryFormNovel from "@/components/QueryForm/queryFormNovel"
|
|
@@ -41,6 +41,7 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
const modifyStatusBatch = useAjax((params) => modifyStatusBatchApi(params))
|
|
const modifyStatusBatch = useAjax((params) => modifyStatusBatchApi(params))
|
|
const getGDTList = useAjax((params) => getNovelGDTListApi(params))
|
|
const getGDTList = useAjax((params) => getNovelGDTListApi(params))
|
|
const getGDTTotal = useAjax((params) => getNovelGDTTotalApi(params))
|
|
const getGDTTotal = useAjax((params) => getNovelGDTTotalApi(params))
|
|
|
|
+ const syncBatch = useAjax((params) => syncBatchApi(params))
|
|
/****************************************/
|
|
/****************************************/
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -96,6 +97,20 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 同步
|
|
|
|
+ const sync = useCallback(() => {
|
|
|
|
+ if (selectedRows?.length > 0) {
|
|
|
|
+ let accountAdgroupMaps = [...new Set(selectedRows?.map(item => item.accountId + ',' + item.adgroupId))]
|
|
|
|
+ syncBatch.run({ accountAdgroupMaps }).then(res => {
|
|
|
|
+ res?.data && getGDTList.refresh()
|
|
|
|
+ res?.data ? message.success('同步成功!') : message.error('同步失败!')
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ message.error('请勾选需要同步的广告')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }, [getGDTList, selectedRows])
|
|
|
|
+
|
|
return <div>
|
|
return <div>
|
|
<TablePro
|
|
<TablePro
|
|
czChild={<Space>
|
|
czChild={<Space>
|
|
@@ -112,6 +127,7 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
/>
|
|
/>
|
|
<Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={modifyStatusBatch.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(true)}>启动</Button>
|
|
<Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={modifyStatusBatch.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(true)}>启动</Button>
|
|
<Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={modifyStatusBatch.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(false)}>暂停</Button>
|
|
<Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={modifyStatusBatch.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(false)}>暂停</Button>
|
|
|
|
+ <Button type='primary' loading={syncBatch.loading} disabled={selectedRows.length === 0} onClick={sync}>同步</Button>
|
|
{handleType === 1 ? <>
|
|
{handleType === 1 ? <>
|
|
<Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
|
|
<Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
|
|
setUpdateDate({ visible: true, type: '删除' })
|
|
setUpdateDate({ visible: true, type: '删除' })
|