Sfoglia il codice sorgente

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

wjx 1 anno fa
parent
commit
f9b0c4f074

+ 6 - 0
config/routerConfig.ts

@@ -164,6 +164,12 @@ const launchSystem = {
                 },
             ],
         },
+        {
+            path: '/launchSystemNew/adminSpecialUseConsume',
+            name: '管理员拉消耗专用',
+            component: './launchSystemNew/adminSpecialUseConsume',
+            access: 'adminSpecialUseConsume',
+        },
     ],
 
 }

+ 3 - 2
src/app.tsx

@@ -6,7 +6,7 @@ import RightContent from '@/components/RightContent';
 import { ResponseError } from 'umi-request';
 import { queryCurrent, getMenu } from './services/user';
 import defaultSettings from '../config/defaultSettings';
-import { DesktopOutlined, MessageOutlined, SendOutlined, TeamOutlined, QrcodeOutlined, DatabaseOutlined, ReadOutlined, MobileOutlined, FundViewOutlined, RadarChartOutlined, BarChartOutlined, WechatOutlined, BookOutlined, FileImageOutlined, EyeOutlined, UserOutlined } from '@ant-design/icons';
+import { DesktopOutlined, MessageOutlined, SendOutlined, TeamOutlined, QrcodeOutlined, DatabaseOutlined, ReadOutlined, MobileOutlined, FundViewOutlined, RadarChartOutlined, BarChartOutlined, WechatOutlined, BookOutlined, FileImageOutlined, EyeOutlined, UserOutlined, UserSwitchOutlined } from '@ant-design/icons';
 import { getMyMenu, headrRouter } from '../config/routerConfig';
 import { ReactComponent as LaunchSvg } from '@/assets/launch.svg'
 import { ReactComponent as AdLaunchSvg } from '@/assets/adLaunch.svg'
@@ -107,7 +107,8 @@ const IconMap = {
   material: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><MaterialSvg /></span>,
   gdt: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><GdtSvg /></span>,
   monitor: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><MonitorSvg /></span>,
-  eye: <EyeOutlined />
+  eye: <EyeOutlined />,
+  user: <UserSwitchOutlined />
 };
 //处理菜单
 const loopMenuItem = (menus: MenuDataItem[],): MenuDataItem[] => {

+ 4 - 3
src/components/EarlyWarning/addEdit.tsx

@@ -37,6 +37,7 @@ const AddEdit: React.FC<Props> = (props) => {
             if (values?.rules) {
                 let newValues = JSON.parse(JSON.stringify(values))
                 let { rules, defaultRule, enable, notifyFrequency, ruleName, warningType, unTipWhenStop } = newValues
+                console.log(rules)
                 let params = rules?.map((item: any) => {
                     const { field, operationType, operationValue, ...newItem } = item
                     let ov = {}
@@ -44,10 +45,10 @@ const AddEdit: React.FC<Props> = (props) => {
                         ov = { operationValue }
                     }
                     return {
-                        rule: Object.keys(newItem).map((item: any) => {
+                        rule: Object.keys(newItem).filter(key => field.includes(key)).map(key => {
                             return {
-                                ...newItem[item],
-                                field: item
+                                ...newItem[key],
+                                field: key
                             }
                         }),
                         operationType,

+ 5 - 11
src/components/EarlyWarning/priceInput.tsx

@@ -1,4 +1,4 @@
-import { Input, Select } from "antd";
+import { Input, InputNumber, Select } from "antd";
 import React, { useState } from "react"
 
 
@@ -29,15 +29,9 @@ const PriceInput: React.FC<Props> = ({ value = {}, onChange, disabled = false })
         onChange?.({ value: number, condition, ...value, ...changedValue });
     };
 
-    const onNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
-        const newNumber = parseInt(e.target.value || '0', 10);
-        if (Number.isNaN(number)) {
-            return;
-        }
-        if (!('number' in value)) {
-            setNumber(newNumber);
-        }
-        triggerChange({ value: newNumber });
+    const onNumberChange = (value: number) => {
+        setNumber(value);
+        triggerChange({ value: value });
     };
 
     const onConditionChange = (newCondition: Condition) => {
@@ -60,7 +54,7 @@ const PriceInput: React.FC<Props> = ({ value = {}, onChange, disabled = false })
             <Select.Option value="<=">小于等于</Select.Option>
             <Select.Option value="=">等于</Select.Option>
         </Select>
-        <Input
+        <InputNumber
             type="text"
             disabled={disabled}
             value={value.value || number}

+ 32 - 0
src/pages/launchSystemNew/account/components/openV3.tsx

@@ -0,0 +1,32 @@
+import { useAjax } from "@/Hook/useAjax"
+import { openV3Api } from "@/services/launchAdq/adq"
+import { LoadingOutlined } from "@ant-design/icons"
+import { Button, Tooltip, message } from "antd"
+import React from "react"
+
+
+interface Props {
+    accountId: any
+    onChange?: () => void
+}
+const OpenV3: React.FC<Props> = ({ accountId, onChange }) => {
+
+    /*************************************/
+    const openV3a = useAjax((params) => openV3Api(params), { formatResult: true })
+    /*************************************/
+    // 
+    const openV3 = () => {
+        openV3a.run(accountId).then(res => {
+            if (res?.data) {
+                message.success('开启成功')
+                onChange?.()
+            }
+        })
+    }
+
+    return <Tooltip title="开启3.0">
+        <Button size="small" style={{ color: "#0eb83a" }} onClick={openV3}>{openV3a.loading ? <LoadingOutlined /> : <span>3.0</span>}</Button>
+    </Tooltip>
+}
+
+export default React.memo(OpenV3)

+ 1 - 1
src/pages/launchSystemNew/account/game/index.tsx

@@ -174,7 +174,7 @@ const AdAuthorize: React.FC = () => {
                     ajax={getAdAccountList}
                     dataSource={getAdAccountList?.data?.data?.records}
                     loading={getAdAccountList?.loading}
-                    columns={() => columnsMp(edit, setOpenServer, del, checkAccount, changeRecord, putUserHandle, activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
+                    columns={() => columnsMp(edit, setOpenServer, del, checkAccount, changeRecord, putUserHandle, () => getAdAccountList.refresh(), activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
                     total={getAdAccountList?.data?.data?.total}
                     page={getAdAccountList?.data?.data?.current}
                     pageSize={getAdAccountList?.data?.data?.size}

+ 17 - 4
src/pages/launchSystemNew/account/game/tableConfig.tsx

@@ -4,7 +4,20 @@ import { Badge, Button, Popconfirm, Space, Tooltip } from "antd"
 import React from "react"
 import DivideIntoGroups from "./divideIntoGroups"
 import './index.less'
-export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any) => void, del: (groupId: number, accountId: number) => void, checkAccount: (value: any[]) => void, changeRecord: (accountId: number, id: number) => void, putUserHandle: (data: any) => void, activeKey: string, userId: string | undefined, groupId?: number, getAdAccountList?: any): any {
+import OpenV3 from "../components/openV3"
+export function columnsMp(
+    edit: (params: any) => void,
+    setOpenServer: (data: any) => void,
+    del: (groupId: number, accountId: number) => void,
+    checkAccount: (value: any[]) => void,
+    changeRecord: (accountId: number, id: number) => void,
+    putUserHandle: (data: any) => void,
+    v3Change: () => void,
+    activeKey: string,
+    userId: string | undefined,
+    groupId?: number,
+    getAdAccountList?: any
+): any {
     return [
         {
             title: 'ID',
@@ -86,7 +99,7 @@ export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any
             width: 90,
             ellipsis: true,
             render: (a: any[], b: any) => {
-                return a?.length > 0 ? a?.[0]?.ruleName: '--'
+                return a?.length > 0 ? a?.[0]?.ruleName : '--'
             }
         },
         // {
@@ -182,11 +195,11 @@ export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any
             title: '操作',
             dataIndex: 'cz',
             key: 'cz',
-            align: 'center',
-            width: 200,
+            width: 250,
             fixed: 'right',
             render: (a: any, b: any) => {
                 return <Space>
+                    {(Object.keys(b)?.includes('addV3') && !b.addV3) && <OpenV3 accountId={b?.accountId} onChange={v3Change} />}
                     <Tooltip title="配置服务商">
                         <Button size="small" style={{ color: "#00bcd4" }} onClick={() => setOpenServer([b])} icon={<SettingOutlined />}></Button>
                     </Tooltip>

+ 3 - 2
src/pages/launchSystemNew/account/novel/index.tsx

@@ -141,7 +141,8 @@ const AdAuthorize: React.FC = () => {
             }
         })
     }
-    // 
+    
+
     return <div style={{ height: '100%' }}>
         <Tabs
             tabBarStyle={{ marginBottom: 1 }}
@@ -174,7 +175,7 @@ const AdAuthorize: React.FC = () => {
                     ajax={getAdAccountList}
                     dataSource={getAdAccountList?.data?.data?.records}
                     loading={getAdAccountList?.loading}
-                    columns={() => columnsMp(edit, setOpenServer, del, checkAccount, changeRecord, putUserHandle, activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
+                    columns={() => columnsMp(edit, setOpenServer, del, checkAccount, changeRecord, putUserHandle, () => getAdAccountList.refresh(), activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
                     total={getAdAccountList?.data?.data?.total}
                     page={getAdAccountList?.data?.data?.current}
                     pageSize={getAdAccountList?.data?.data?.size}

+ 17 - 4
src/pages/launchSystemNew/account/novel/tableConfig.tsx

@@ -4,7 +4,20 @@ import { Badge, Button, Popconfirm, Space, Tooltip } from "antd"
 import React from "react"
 import DivideIntoGroups from "./divideIntoGroups"
 import './index.less'
-export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any) => void, del: (groupId: number, accountId: number) => void, checkAccount: (value: any[]) => void, changeRecord: (accountId: number, id: number) => void, putUserHandle: (data: any) => void, activeKey: string, userId: string | undefined, groupId?: number, getAdAccountList?: any): any {
+import OpenV3 from "../components/openV3"
+export function columnsMp(
+    edit: (params: any) => void,
+    setOpenServer: (data: any) => void,
+    del: (groupId: number, accountId: number) => void,
+    checkAccount: (value: any[]) => void,
+    changeRecord: (accountId: number, id: number) => void,
+    putUserHandle: (data: any) => void,
+    v3Change: () => void,
+    activeKey: string,
+    userId: string | undefined,
+    groupId?: number,
+    getAdAccountList?: any
+): any {
     return [
         {
             title: 'ID',
@@ -86,7 +99,7 @@ export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any
             width: 90,
             ellipsis: true,
             render: (a: any[], b: any) => {
-                return a?.length > 0 ? a?.[0]?.ruleName: '--'
+                return a?.length > 0 ? a?.[0]?.ruleName : '--'
             }
         },
         // {
@@ -182,11 +195,11 @@ export function columnsMp(edit: (params: any) => void, setOpenServer: (data: any
             title: '操作',
             dataIndex: 'cz',
             key: 'cz',
-            align: 'center',
-            width: 200,
+            width: 250,
             fixed: 'right',
             render: (a: any, b: any) => {
                 return <Space>
+                    {(Object.keys(b)?.includes('addV3') && !b.addV3) && <OpenV3 accountId={b?.accountId} onChange={v3Change} />}
                     <Tooltip title="配置服务商">
                         <Button size="small" style={{ color: "#00bcd4" }} onClick={() => setOpenServer([b])} icon={<SettingOutlined />}></Button>
                     </Tooltip>

+ 77 - 0
src/pages/launchSystemNew/adminSpecialUseConsume/index.tsx

@@ -0,0 +1,77 @@
+import { useAjax } from "@/Hook/useAjax"
+import { syncAccountDayApi } from "@/services/launchAdq/adminSpecialUseConsume"
+import { Button, Card, DatePicker, Form, FormProps, Input, message } from "antd"
+import React from "react"
+import moment from "moment"
+import { RangePickerProps } from "antd/lib/date-picker"
+
+/**
+ * 管理员拉消耗专用
+ * @returns 
+ */
+const AdminSpecialUseConsume: React.FC = () => {
+
+
+    /*********************************/
+    const [form] = Form.useForm()
+    const syncAccountDay = useAjax((params) => syncAccountDayApi(params), { formatResult: true })
+    /*********************************/
+
+    const onFinish: FormProps<any>["onFinish"] = (values) => {
+        const { accountIds, pullDate } = values
+        let params: any = {}
+        params.accountIds = accountIds.split(/[,,\s\n]+/);
+        params.beginDate = moment(pullDate[0]).format('YYYY-MM-DD')
+        params.endDate = moment(pullDate[1]).format('YYYY-MM-DD')
+        console.log('Success:', params);
+        syncAccountDay.run(params).then(res => {
+            if (res?.data) {
+                message.success('拉取成功')
+                form.setFieldsValue({})
+            }
+        })
+    };
+
+    const disabledDate: RangePickerProps['disabledDate'] = (current) => {
+        // Can not select days before today and today
+        return current && current > moment().endOf('day');
+    };
+
+    return <Card
+        title={<strong>管理员拉消耗专用</strong>}
+        bodyStyle={{ height: 'calc(100vh - 155px)' }}
+    >
+        <Form
+            name="asucBasic"
+            layout="vertical"
+            style={{ maxWidth: 600 }}
+            onFinish={onFinish}
+            autoComplete="off"
+            form={form}
+        >
+            <Form.Item
+                label={<strong>广告账号</strong>}
+                name="accountIds"
+                rules={[{ required: true, message: '请输入广告账号!' }]}
+            >
+                <Input.TextArea rows={6} placeholder="请输入广告账号(多个逗号,空格,换行)" />
+            </Form.Item>
+
+            <Form.Item
+                label={<strong>日期区间</strong>}
+                name="pullDate"
+                rules={[{ required: true, message: '请选择日期!' }]}
+            >
+                <DatePicker.RangePicker disabledDate={disabledDate} />
+            </Form.Item>
+
+            <Form.Item wrapperCol={{ offset: 10, span: 14 }}>
+                <Button type="primary" htmlType="submit" loading={syncAccountDay.loading}>
+                    提交
+                </Button>
+            </Form.Item>
+        </Form>
+    </Card>
+}
+
+export default AdminSpecialUseConsume

+ 15 - 0
src/services/launchAdq/adminSpecialUseConsume.ts

@@ -0,0 +1,15 @@
+import { request } from 'umi';
+import { api } from '../api';
+
+
+/**
+ * 管理员拉消耗
+ * @param data 
+ * @returns 
+ */
+export async function syncAccountDayApi(data: { accountIds: any[], beginDate: string, endDate: string }) {
+    return request(api + `/tencentData/monitorAdData/syncAccountDay`, {
+        method: 'POST',
+        data
+    });
+}

+ 12 - 1
src/services/launchAdq/adq.ts

@@ -464,4 +464,15 @@ export async function delUserTagApi(data: { accountId: string, adgroupId: string
   return request(api + `/tencentMonitor/adUserTag/removeTag/${data.accountId}/${data.adgroupId}`, {
     method: 'DELETE'
   });
-}
+}
+
+/**
+ * 开启3.0
+ * @param accountId 
+ * @returns 
+ */
+export async function openV3Api(accountId: string) {
+  return request(api + `/adq/adAccount/addV3/${accountId}`, {
+    method: 'PUT'
+  });
+}