wjx hace 2 semanas
padre
commit
78a9957306

+ 11 - 0
src/pages/iaaData/const.tsx

@@ -123,6 +123,17 @@ export enum MARKETING_TARGET_TYPE_ENUM {
     MARKETING_TARGET_TYPE_WECHAT_WORK = '企业微信'
 }
 
+/** 成本保障状态 */
+export enum COST_GUARANTEE_STATUS_ENUM {
+	COST_GUARANTEE_STATUS_NONE = '无成本保障状态',
+	COST_GUARANTEE_STATUS_EFFECTIVE = '成本保障生效中',
+	COST_GUARANTEE_STATUS_FAILED = '成本保障已失效',
+	COST_GUARANTEE_STATUS_FINISHED = '成本保障已结束',
+	COST_GUARANTEE_STATUS_CONFIRMING = '成本保障确认中',
+	COST_GUARANTEE_STATUS_SUCCEEDED = '超成本赔付已完成',
+	COST_GUARANTEE_STATUS_FROZEN = '成本保障已冻结'
+}
+
 /**广告组推广目标类型*/
 export enum PromotedObjectType {
     PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT = '微信公众号',

+ 17 - 2
src/pages/iaaData/game/tencent/adList/index.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react"
+import React, { useCallback, useEffect, useState } from "react"
 import { useAjax } from "@/Hook/useAjax"
 import { getGDTListApi, GetGDTListProps, getGDTTotalApi } from "@/services/iaaData"
 import TablePro from "@/components/TablePro"
@@ -7,7 +7,7 @@ import QueryForm from "@/components/QueryForm"
 import moment from "moment"
 import { useModel } from "umi"
 import { Button, Dropdown, message, Space } from "antd"
-import { modifyStatusBatchApi } from "@/services/gameData"
+import { modifyStatusBatchApi, syncBatchApi } from "@/services/gameData"
 import { DeleteOutlined, DownOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
 import DayAd from "./dayAd"
 import AutoAcquisitionSet from "@/pages/iaaData/novel/tencent/adList/autoAcquisitionSet"
@@ -39,6 +39,7 @@ const TencentIaaAd: React.FC = () => {
     const modifyStatusBatch = useAjax((params) => modifyStatusBatchApi(params))
     const getGDTList = useAjax((params) => getGDTListApi(params))
     const getGDTTotal = useAjax((params) => getGDTTotalApi(params))
+    const syncBatch = useAjax((params) => syncBatchApi(params))
     /****************************************/
 
     useEffect(() => {
@@ -91,6 +92,19 @@ const TencentIaaAd: React.FC = () => {
         })
     }
 
+    // 同步 
+    const sync = useCallback(() => {
+        if (selectedRows?.length > 0) {
+            let accountAdgroupMaps = [...new Set(selectedRows?.map(item => item.accountId + ',' + item.promotionId))]
+            syncBatch.run({ accountAdgroupMaps }).then(res => {
+                res?.data && getGDTList.refresh()
+                res?.data ? message.success('同步成功!') : message.error('同步失败!')
+            })
+        } else {
+            message.error('请勾选需要同步的广告')
+        }
+
+    }, [getGDTList, selectedRows])
 
     return <div>
         <TablePro
@@ -98,6 +112,7 @@ const TencentIaaAd: React.FC = () => {
                 {/* <Switch checkedChildren="开启全选" unCheckedChildren="关闭全选" checked={!isZj} onChange={(e) => { setIsZj(!e); }} /> */}
                 <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' loading={syncBatch.loading} disabled={selectedRows.length === 0} onClick={sync}>同步</Button>
                 <Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
                     setUpdateDate({ visible: true, type: '删除' })
                 }}>删除</Button>

+ 18 - 2
src/pages/iaaData/novel/tencent/adList/index.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react"
+import React, { useCallback, useEffect, useState } from "react"
 import { useAjax } from "@/Hook/useAjax"
 import { getNovelGDTListApi, GetNovelGDTListProps, getNovelGDTTotalApi } from "@/services/iaaData"
 import TablePro from "@/components/TablePro"
@@ -6,7 +6,7 @@ import columns12 from "./tableConfig"
 import moment from "moment"
 import { useModel } from "umi"
 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 DayAd from "./dayAd"
 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 getGDTList = useAjax((params) => getNovelGDTListApi(params))
     const getGDTTotal = useAjax((params) => getNovelGDTTotalApi(params))
+    const syncBatch = useAjax((params) => syncBatchApi(params))
     /****************************************/
 
     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>
         <TablePro
             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: '#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 ? <>
                     <Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
                         setUpdateDate({ visible: true, type: '删除' })

+ 12 - 1
src/pages/iaaData/novel/tencent/adList/tableConfig.tsx

@@ -1,7 +1,7 @@
 import WidthEllipsis from "@/components/widthEllipsis"
 import { Badge, Progress, Space, Statistic, Tag } from "antd"
 import React from "react"
-import { ADGROUP_STATUS, BID_MODE_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, OPTIMIZATIONGOAL_ENUM, PRODUCT_TYPE_ENUM, SMART_BID_TYPE_ENUM } from "../../../const"
+import { ADGROUP_STATUS, BID_MODE_ENUM, COST_GUARANTEE_STATUS_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, OPTIMIZATIONGOAL_ENUM, PRODUCT_TYPE_ENUM, SMART_BID_TYPE_ENUM } from "../../../const"
 import SwitchStatus from "./switchStatus"
 import CreativePreview from "../../../components/CreativePreview"
 import TimeSeriesLook from "@/pages/iaaData/components/TimeSeriesLook"
@@ -151,6 +151,17 @@ function columns12(dayHandle: (data: any) => void, onChange?: () => void): { lab
                     title: '书名', dataIndex: 'bookName', label: '广告基本信息', align: 'center', width: 110, default: 23,
                     render: (a: string) => (<WidthEllipsis value={a} />)
                 },
+                {
+                    title: '成本保障状态', dataIndex: 'costGuaranteeStatus', label: '广告基本信息', align: 'center', width: 85,
+                    render: (a: string) => (<WidthEllipsis value={COST_GUARANTEE_STATUS_ENUM[a as keyof typeof COST_GUARANTEE_STATUS_ENUM]} />)
+                },
+                {
+                    title: '成本保障赔付金额', dataIndex: 'costGuaranteeMoney', label: '广告基本信息', align: 'right', width: 70, sorter: true,
+                    render: (a: string, b: any) => {
+                        if (b?.accountId === '总计') return '--';
+                        return <Statistic value={a || 0} precision={2} />
+                    }
+                },
                 {
                     title: '标记备注', dataIndex: 'tagRemark', label: '广告基本信息', align: 'center', width: 80, default: 24,
                     render: (a: string) => (<WidthEllipsis value={a} />)

+ 12 - 0
src/services/gameData/index.ts

@@ -239,6 +239,18 @@ export async function modifyStatusBatchApi(data: ADQV3.ModifyStatusBatchProps) {
     });
 }
 
+/**
+ * 同步
+ * @param data 
+ * @returns 
+ */
+export async function syncBatchApi(data: ADQV3.AccountAdgroupMapsProps) {
+    return request(api + '/adq/adgroup/syncBatch', {
+        method: 'PUT',
+        data
+    });
+}
+
 /**
  * 删除广告
  * @param data