wjx há 1 ano atrás
pai
commit
03caaa1e5a
2 ficheiros alterados com 87 adições e 28 exclusões
  1. 65 27
      src/components/QueryForm/index.tsx
  2. 22 1
      src/services/gameData/index.ts

+ 65 - 27
src/components/QueryForm/index.tsx

@@ -2,7 +2,7 @@ import { Button, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row
 import React, { useEffect, useState } from "react"
 import moment from "moment"
 import { useAjax } from "@/Hook/useAjax"
-import { getAllOfOwnerUserApi, getChannelChoiceListApi, getGameChoiceListApi, getCpChoiceListApi, getGameChoiceParentListType1Api, getPayListApi, getSubUserWithSelfListApi, getTtAllUserListApi, getUserSystemTypeChoiceListApi, getUserVipLevelChoiceListApi, getRoleUserListApi, getGameServerListApi, getGameListApi, getGameServerUnListApi } from "@/services/gameData"
+import { getAllOfOwnerUserApi, getChannelChoiceListApi, getGameChoiceListApi, getCpChoiceListApi, getGameChoiceParentListType1Api, getPayListApi, getSubUserWithSelfListApi, getTtAllUserListApi, getUserSystemTypeChoiceListApi, getUserVipLevelChoiceListApi, getRoleUserListApi, getGameServerListApi, getGameListApi, getGameServerUnListApi, getAccountListNewApi, getAgentListNewApi, getPitcherListNewApi, getGameListNewApi } from "@/services/gameData"
 import { ActiveEnum, DeviceType, LoginType, PayStatus, TYPE, gameClassifyEnum } from "./const"
 import { ADSTATUSEnum as ADSTTTATUSEnum } from "@/pages/gameDataStatistics/adlist/monitor/const"
 import { ADSTATUSEnum } from "@/pages/gameDataStatistics/adlist/tencentMonitor/const"
@@ -237,6 +237,7 @@ const QueryForm: React.FC<Props> = (props) => {
     const isMergeServer = Form.useWatch('isMergeServer', form)
     const serverName = Form.useWatch('serverName', form)
     const serverIds = Form.useWatch('serverIds', form)
+    const sourceSystem = Form.useWatch('sourceSystem', form)
     const [accountList, setAccountList] = useState<any[]>([])
     const [userIdList, setUserIdList] = useState<any[]>([])
     const [gsList, setGsList] = useState<any[]>([])
@@ -245,6 +246,7 @@ const QueryForm: React.FC<Props> = (props) => {
     const [gameList, setGameList] = useState<any[]>([])
     const [parentGameList, setParentGameList] = useState<any[]>([])
     const [superGameList, setSuperGameList] = useState<any[]>([])
+    const [agentData, setAgentData] = useState<{ label: string, value: string }[]>([])
 
 
     const getAllOfOwnerUser = useAjax(() => getAllOfOwnerUserApi())
@@ -261,6 +263,10 @@ const QueryForm: React.FC<Props> = (props) => {
     const getRoleUserList = useAjax((params) => getRoleUserListApi(params))
     const getGameServerList = useAjax((params) => getGameServerListApi(params))
     const getGameServerUnList = useAjax((params) => getGameServerUnListApi(params))
+    const getAccountListNew = useAjax((params) => getAccountListNewApi(params))
+    const getAgentListNew = useAjax((params) => getAgentListNewApi(params))
+    const getPitcherListNew = useAjax((params) => getPitcherListNewApi(params))
+    const getGameListNew = useAjax((params) => getGameListNewApi(params))
     /**************************/
 
     useEffect(() => {
@@ -284,36 +290,48 @@ const QueryForm: React.FC<Props> = (props) => {
         if (isAccountId) {
             // 请求广告账号列表
             async function getAccount() {
-                let data: any[] = []
-                let res1 = await getAllOfOwnerUser.run()
-                let data1 = []
-                if (res1) {
-                    data1 = res1?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.corporationName }))
-                }
-                let res2 = await getTtAllUserList.run()
-                let data2 = []
-                if (res2) {
-                    data2 = res2?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.accountName }))
+                if (sourceSystem === 'ZX_ONE') {
+                    let data: any[] = []
+                    let res1 = await getAllOfOwnerUser.run()
+                    let data1 = []
+                    if (res1) {
+                        data1 = res1?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.corporationName }))
+                    }
+                    let res2 = await getTtAllUserList.run()
+                    let data2 = []
+                    if (res2) {
+                        data2 = res2?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.accountName }))
+                    }
+                    data = [...data1, ...data2]
+                    setAccountList(data)
+                } else if (['BG_OLD', 'BG_NEW', 'ZX_SDK'].includes(sourceSystem)) {
+                    let res1 = await getAccountListNew.run({ sourceSystem })
+                    setAccountList(res1?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: '' })))
                 }
-                data = [...data1, ...data2]
-                setAccountList(data)
             }
             getAccount()
         }
-    }, [isAccountId])
+    }, [isAccountId, sourceSystem])
 
     /** 游戏列表 */
     useEffect(() => {
         if (isGameId || isOrderGameId || isParentId || isGameIds || isSuperParentGameId) {
-            getGameList.run().then(res => {
+            getGameListNew.run({ sourceSystem }).then(res => {
                 const { gameList, parentGameList, superGameList } = res
-                setGameList(gameList)
+                if (['BG_OLD', 'BG_NEW', 'ZX_SDK'].includes(sourceSystem)) {
+                    setGameList(gameList?.map((item: { id: any; game_name: any }) => ({ id: item.id, name: item.game_name })) || [])
+                }
                 setParentGameList(parentGameList)
                 setSuperGameList(superGameList)
             })
-            getGameChoiceList.run()
+
+            if (sourceSystem === 'ZX_ONE') {
+                getGameChoiceList.run().then(res => {
+                    setGameList(res || [])
+                })
+            }
         }
-    }, [isGameId, isGameIds, isOrderGameId, isParentId, isSuperParentGameId])
+    }, [isGameId, isGameIds, isOrderGameId, isParentId, isSuperParentGameId, sourceSystem])
 
     useEffect(() => {
         if (isCpId) {
@@ -330,18 +348,34 @@ const QueryForm: React.FC<Props> = (props) => {
     /** 投手列表 */
     useEffect(() => {
         if (isSysUserId) {
-            getSubUserWithSelfList.run().then(res => {
-                setUserIdList(res ? Object.keys(res)?.map(key => ({ userId: key, nickname: res[key] })) : [])
-            })
+            if (['BG_OLD', 'BG_NEW', 'ZX_SDK'].includes(sourceSystem)) {
+                getPitcherListNew.run({ sourceSystem }).then(res => {
+                    setUserIdList(res?.map((item: { pitcherId: any; pitcherName: any }) => ({ userId: item.pitcherId, nickname: item.pitcherName })))
+                })
+            } else {
+                getSubUserWithSelfList.run().then(res => {
+                    setUserIdList(res ? Object.keys(res)?.map(key => ({ userId: key, nickname: res[key] })) : [])
+                })
+            }
         }
-    }, [isSysUserId])
+    }, [isSysUserId, sourceSystem])
 
     /** 推广渠道 */
     useEffect(() => {
         if (isAgentId) {
-            getChannelChoiceList.run()
+            if (['BG_OLD', 'BG_NEW', 'ZX_SDK'].includes(sourceSystem)) {
+                getAgentListNew.run({ sourceSystem }).then(res => {
+                    setAgentData(res?.map((item: { agentName: any; agentId: any }) => ({ label: item.agentName, value: item.agentId })))
+                })
+            } else {
+                getChannelChoiceList.run().then(res => {
+                    console.log(res)
+                    setAgentData(res?.map((item: { agentName: any; id: any }) => ({ label: item.agentName, value: item.id })))
+                })
+            }
         }
-    }, [isAgentId])
+    }, [isAgentId, sourceSystem])
+    console.log('agentData--->', agentData)
 
     /** 游戏应用类型 */
     useEffect(() => {
@@ -510,11 +544,12 @@ const QueryForm: React.FC<Props> = (props) => {
                     style={{ width: 140 }}
                     allowClear
                     placeholder={'广告账号'}
+                    loading={getAccountListNew.loading || getAllOfOwnerUser.loading}
                     filterOption={(input, option) =>
                         (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
                     }
                 >
-                    {accountList.map(item => <Select.Option key={item.value} value={item.value}>{item.label.toString() + '_' + item.corporationName}</Select.Option>)}
+                    {accountList.map(item => <Select.Option key={item.value} value={item.value}>{item.label.toString() + (item.corporationName ? `_${item.corporationName}` : '')}</Select.Option>)}
                 </Select>
             </Form.Item></Col>}
             {/* 公司ID */}
@@ -688,12 +723,13 @@ const QueryForm: React.FC<Props> = (props) => {
                     showSearch
                     style={{ minWidth: 140 }}
                     allowClear
+                    loading={getGameListNew.loading || getGameChoiceList.loading}
                     placeholder={'请选择游戏'}
                     filterOption={(input, option) =>
                         (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
                     }
                 >
-                    {getGameChoiceList?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
+                    {gameList?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
                 </Select>
             </Form.Item></Col>}
             {isGameIds && <Col><Form.Item name='gameId'>
@@ -1006,11 +1042,12 @@ const QueryForm: React.FC<Props> = (props) => {
                     allowClear
                     dropdownMatchSelectWidth={false}
                     placeholder={'请选择渠道'}
+                    loading={getChannelChoiceList.loading || getAgentListNew.loading}
                     filterOption={(input, option) =>
                         (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
                     }
                 >
-                    {getChannelChoiceList?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.agentName}</Select.Option>)}
+                    {agentData?.map((item: any) => <Select.Option value={item.value} key={item.value}>{item.label}</Select.Option>)}
                 </Select>
             </Form.Item></Col>}
 
@@ -1031,6 +1068,7 @@ const QueryForm: React.FC<Props> = (props) => {
                     showSearch
                     style={{ width: 120 }}
                     allowClear
+                    loading={getSubUserWithSelfList.loading || getPitcherListNew.loading}
                     placeholder={'请选择投手'}
                     filterOption={(input, option) =>
                         (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0

+ 22 - 1
src/services/gameData/index.ts

@@ -1,6 +1,6 @@
 
 import { request } from 'umi';
-import { gameApi } from '../api';
+import { gameApi, api } from '../api';
 
 /**
  * 腾讯所有推广账号列表
@@ -140,4 +140,25 @@ export async function getGameServerUnListApi(params: { gameId: number }) {
  */
 export async function getGameListApi() {
     return request(gameApi + `/gameData/gameList/list`);
+}
+
+
+// 所有广告账号列表
+export async function getAccountListNewApi(data: { sourceSystem: string }) {
+    return request(api + `/gameData/choice/account/list`, { method: 'POST', data });
+}
+
+// 所有渠道列表
+export async function getAgentListNewApi(data: { sourceSystem: string }) {
+    return request(api + `/gameData/choice/agent/list`, { method: 'POST', data });
+}
+
+// 所有游戏列表
+export async function getGameListNewApi(data: { sourceSystem: string }) {
+    return request(api + `/gameData/choice/game/list`, { method: 'POST', data });
+}
+
+// 所有投手列表
+export async function getPitcherListNewApi(data: { sourceSystem: string }) {
+    return request(api + `/gameData/choice/pitcher/list`, { method: 'POST', data });
 }