Bläddra i källkod

风险监控弹窗

wjx 3 månader sedan
förälder
incheckning
ed87d2603d

+ 6 - 19
src/pages/gsData/roleIpMonitor/loginIpDetails.tsx

@@ -1,21 +1,20 @@
 import { useAjax } from '@/Hook/useAjax';
-import { getRoleIpDetailListApi } from '@/services/gsData';
+import { getRoleIpDetail1ListApi } from '@/services/gsData';
 import { Modal, Table } from 'antd';
 import React, { useEffect, useState } from 'react';
 
 const LoginIpDetails: React.FC<{ roleId: any, icon?: React.ReactNode }> = ({ roleId, icon }) => {
 
     /*********************************/
-    const [queryForm, setQueryForm] = useState<{ pageSize: number, pageNum: number }>({ pageNum: 1, pageSize: 10 })
     const [visible, setVisible] = useState<boolean>(false)
-    const getRoleIpDetailList = useAjax((params) => getRoleIpDetailListApi(params))
+    const getRoleIpDetail1List = useAjax((params) => getRoleIpDetail1ListApi(params))
     /*********************************/
 
     useEffect(() => {
         if (visible) {
-            getRoleIpDetailList.run({ roleId, ...queryForm })
+            getRoleIpDetail1List.run({ roleId })
         }
-    }, [roleId, visible, queryForm])
+    }, [roleId, visible])
 
     return <>
         <a onClick={() => setVisible(true)}>{icon}</a>
@@ -40,22 +39,10 @@ const LoginIpDetails: React.FC<{ roleId: any, icon?: React.ReactNode }> = ({ rol
                     }
                 ]}
                 rowKey={'ip'}
-                dataSource={getRoleIpDetailList?.data?.records}
-                loading={getRoleIpDetailList?.loading}
+                dataSource={getRoleIpDetail1List?.data}
+                loading={getRoleIpDetail1List?.loading}
                 size="small"
                 bordered
-                pagination={{
-                    total: getRoleIpDetailList?.data?.total,
-                    pageSize: getRoleIpDetailList?.data?.size,
-                    current: getRoleIpDetailList?.data?.current
-                }}
-                onChange={(pagination) => {
-                    let { current, pageSize } = pagination
-                    let newQueryForm = JSON.parse(JSON.stringify(queryForm))
-                    newQueryForm.pageNum = current || newQueryForm.pageNum
-                    newQueryForm.pageSize = pageSize || newQueryForm.pageSize
-                    setQueryForm({ ...newQueryForm })
-                }}
             />
         </Modal>}
     </>

+ 8 - 22
src/pages/gsData/roleIpMonitor/regIpRoleDetails.tsx

@@ -9,28 +9,24 @@ import React, { useEffect, useState } from 'react';
  * @param param0 
  * @returns 
  */
-const RegIpRoleDetails: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode }> = ({ ip, userId, icon }) => {
+const RegIpRoleDetails: React.FC<{ roleId: string, excludeUserType: 0 | 1, icon?: React.ReactNode }> = ({ roleId, excludeUserType, icon }) => {
 
     /*********************************/
-    const [queryForm, setQueryForm] = useState<{ pageSize: number, pageNum: number }>({ pageNum: 1, pageSize: 10 })
     const [visible, setVisible] = useState<boolean>(false)
     const getRoleDetailList = useAjax((params) => getRoleDetailListApi(params))
     /*********************************/
 
     useEffect(() => {
         if (visible) {
-            const params: { regIp: string, excludeUserId?: any } = { regIp: ip, ...queryForm }
-            if (userId) {
-                params.excludeUserId = userId
-            }
+            const params = { roleId, excludeUserType }
             getRoleDetailList.run(params)
         }
-    }, [ip, userId, visible, queryForm])
+    }, [roleId, excludeUserType, visible])
 
     return <>
         <a onClick={() => setVisible(true)}>{icon}</a>
         {visible && <Modal
-            title={<strong>同IP下角色列表{userId ? '(排除同玩家)' : ''}({ip})</strong>}
+            title={<strong>同IP下角色列表{excludeUserType ? '(排除同玩家)' : ''}(角色ID:{roleId})</strong>}
             visible={visible}
             onCancel={() => setVisible(false)}
             footer={null}
@@ -94,23 +90,13 @@ const RegIpRoleDetails: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode
                         ellipsis: true
                     }
                 ]}
-                rowKey={'roleId'}
-                dataSource={getRoleDetailList?.data?.records}
+                rowKey={(record) => {
+                    return record.roleId + '_' + record.gameId + '_' + record.userId
+                }}
+                dataSource={getRoleDetailList?.data}
                 loading={getRoleDetailList?.loading}
                 size="small"
                 bordered
-                pagination={{
-                    total: getRoleDetailList?.data?.total,
-                    pageSize: getRoleDetailList?.data?.size,
-                    current: getRoleDetailList?.data?.current
-                }}
-                onChange={(pagination) => {
-                    let { current, pageSize } = pagination
-                    let newQueryForm = JSON.parse(JSON.stringify(queryForm))
-                    newQueryForm.pageNum = current || newQueryForm.pageNum
-                    newQueryForm.pageSize = pageSize || newQueryForm.pageSize
-                    setQueryForm({ ...newQueryForm })
-                }}
             />
         </Modal>}
     </>

+ 4 - 4
src/pages/gsData/roleIpMonitor/tableConfig.tsx

@@ -54,7 +54,7 @@ function columns12(): { label: string, fieldSHow?: { label: string, saveField: s
                     render: (a: string) => <Statistic value={a || 0} />
                 },
                 {
-                    title: '角色注册IP', dataIndex: 'ip', label: '基本信息', align: 'center', width: 100, default: 7,
+                    title: '角色注册IP', dataIndex: 'ip', label: '基本信息', align: 'center', width: 110, default: 7,
                     render: (a: string) => <Statistic value={a || 0} />
                 },
                 {
@@ -67,15 +67,15 @@ function columns12(): { label: string, fieldSHow?: { label: string, saveField: s
                 },
                 {
                     title: '角色同IP的玩家数量', dataIndex: 'user_count', label: '基本信息', align: 'center', width: 70, sorter: true, default: 10,
-                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<TongIpUser ip={b.ip} icon={<EyeOutlined />} />} />
+                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<TongIpUser roleId={b.role_id} icon={<EyeOutlined />} />} />
                 },
                 {
                     title: '同IP的角色数量', dataIndex: 'role_count', label: '基本信息', align: 'center', width: 70, sorter: true, default: 11,
-                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<RegIpRoleDetails ip={b.ip} icon={<EyeOutlined />} />} />
+                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<RegIpRoleDetails roleId={b.role_id} excludeUserType={0} icon={<EyeOutlined />} />} />
                 },
                 {
                     title: '同IP的角色数量(排除同玩家)', dataIndex: 'ip_role_count_filter', label: '基本信息', align: 'center', width: 90, sorter: true, default: 12,
-                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<RegIpRoleDetails ip={b.ip} userId={b?.user_id} icon={<EyeOutlined />} />} />
+                    render: (a: number, b: any) => <Statistic value={a || 0} suffix={<RegIpRoleDetails roleId={b.role_id} excludeUserType={1} icon={<EyeOutlined />} />} />
                 },
                 {
                     title: '同玩家IP的角色数量(排除同玩家)', dataIndex: 'role_user_ip_count_filter', label: '基本信息', align: 'center', width: 100, sorter: true, default: 13,

+ 9 - 21
src/pages/gsData/roleIpMonitor/tongIpUser.tsx

@@ -8,23 +8,23 @@ import React, { useEffect, useState } from "react"
  * 角色同IP的玩家
  * @returns 
  */
-const TongIpUser: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode }> = ({ ip, icon }) => {
+const TongIpUser: React.FC<{ roleId: any, userId?: any, icon?: React.ReactNode }> = ({ roleId, icon }) => {
+
     /*********************************/
-    const [queryForm, setQueryForm] = useState<{ pageSize: number, pageNum: number }>({ pageNum: 1, pageSize: 10 })
     const [visible, setVisible] = useState<boolean>(false)
     const getUserDetailList = useAjax((params) => getUserDetailListApi(params))
     /*********************************/
 
     useEffect(() => {
         if (visible) {
-            getUserDetailList.run({ regIp: ip, ...queryForm })
+            getUserDetailList.run({ roleId })
         }
-    }, [ip, visible, queryForm])
+    }, [roleId, visible])
 
     return <>
         <a onClick={() => setVisible(true)}>{icon}</a>
         {visible && <Modal
-            title={<strong>角色同IP的玩家(IP:{ip})</strong>}
+            title={<strong>角色同IP的玩家(角色ID:{roleId})</strong>}
             visible={visible}
             onCancel={() => setVisible(false)}
             footer={null}
@@ -42,8 +42,8 @@ const TongIpUser: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode }> =
                     },
                     {
                         title: '玩家ID',
-                        dataIndex: 'userId',
-                        key: 'userId',
+                        dataIndex: 'id',
+                        key: 'id',
                         align: 'center',
                         width: 85,
                     },
@@ -130,23 +130,11 @@ const TongIpUser: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode }> =
                     },
 
                 ]}
-                rowKey={'userId'}
-                dataSource={getUserDetailList?.data?.records}
+                rowKey={'id'}
+                dataSource={getUserDetailList?.data}
                 loading={getUserDetailList?.loading}
                 size="small"
                 bordered
-                pagination={{
-                    total: getUserDetailList?.data?.total,
-                    pageSize: getUserDetailList?.data?.size,
-                    current: getUserDetailList?.data?.current
-                }}
-                onChange={(pagination) => {
-                    let { current, pageSize } = pagination
-                    let newQueryForm = JSON.parse(JSON.stringify(queryForm))
-                    newQueryForm.pageNum = current || newQueryForm.pageNum
-                    newQueryForm.pageSize = pageSize || newQueryForm.pageSize
-                    setQueryForm({ ...newQueryForm })
-                }}
             />
         </Modal>}
     </>

+ 6 - 6
src/services/gsData/index.ts

@@ -288,8 +288,8 @@ export async function getGameCountryRoleListApi(data: getGameCountryRoleListProp
  * @param data 
  * @returns 
  */
-export async function getRoleIpDetailListApi(data: { roleId: string }) {
-    return request(api + `/gameData/role/roleIpDetail/listOfPage`, {
+export async function getRoleIpDetail1ListApi(data: { roleId: string }) {
+    return request(api + `/gameData/role/roleIpDetail/list`, {
         method: 'POST',
         data
     });
@@ -301,8 +301,8 @@ export async function getRoleIpDetailListApi(data: { roleId: string }) {
  * @param data 
  * @returns 
  */
-export async function getRoleDetailListApi(data: { regIp: string }) {
-    return request(api + `/gameData/role/roleDetail/listOfPage`, {
+export async function getRoleDetailListApi(data: { roleId: string, excludeUserType: 0 | 1 }) {
+    return request(api + `/gameData/role/roleDetailList`, {
         method: 'POST',
         data
     });
@@ -313,8 +313,8 @@ export async function getRoleDetailListApi(data: { regIp: string }) {
  * @param data 
  * @returns 
  */
-export async function getUserDetailListApi(data: { regIp: string }) {
-    return request(api + `/gameData/role/userDetail/listOfPage`, {
+export async function getUserDetailListApi(data: { roleId: string }) {
+    return request(api + `/gameData/role/userDetail/list`, {
         method: 'POST',
         data
     });