wjx 1 year ago
parent
commit
54d5c5dd18

+ 12 - 0
config/routerConfig.ts

@@ -338,6 +338,18 @@ const gameDataStatistics = {
                     name: '玩家登录日志',
                     access: 'loginLog',
                     component: './gameDataStatistics/player/loginLog',
+                },
+                {
+                    path: '/gameDataStatistics/player/banGamePlayerManage',
+                    name: '封禁玩家管理',
+                    access: 'banGamePlayerManage',
+                    component: './gameDataStatistics/player/banGamePlayerManage',
+                },
+                {
+                    path: '/gameDataStatistics/player/banIpManage',
+                    name: '封禁IP管理',
+                    access: 'banIpManage',
+                    component: './gameDataStatistics/player/banIpManage',
                 }
             ]
         },

+ 5 - 5
src/pages/gameDataStatistics/order/tableConfig.tsx

@@ -16,23 +16,23 @@ function columns12(onDetail: (data: any) => void): { label: string, fieldSHow?:
                 },
                 {
                     title: '商户订单号ID', dataIndex: 'orderId', label: '订单明细', align: 'center', width: 120, default: 2,
-                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
+                    render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />)
                 },
                 {
                     title: 'CP订单号', dataIndex: 'cpOrderId', label: '订单明细', align: 'center', width: 130, default: 3,
-                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
+                    render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />)
                 },
                 {
                     title: '第三方支付订单号', dataIndex: 'merchantOrderNo', label: '订单明细', align: 'center', width: 85, default: 4,
-                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
+                    render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />)
                 },
                 {
                     title: '玩家ID', dataIndex: 'gameUserId', label: '订单明细', align: 'center', width: 65, default: 5,
-                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
+                    render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />)
                 },
                 {
                     title: '玩家账号', dataIndex: 'username', label: '订单明细', align: 'center', width: 95, default: 6,
-                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
+                    render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />)
                 },
                 {
                     title: '玩家注册时间', dataIndex: 'regTime', label: '订单明细', align: 'center', width: 135, default: 7, sorter: true,

+ 87 - 0
src/pages/gameDataStatistics/player/banGamePlayerManage/index.tsx

@@ -0,0 +1,87 @@
+import { useAjax } from "@/Hook/useAjax"
+import { gamePlayerBanListProps, getBanUserListApi, updateBanUserApi } from "@/services/gameData/player"
+import { Button, Card, Col, Form, Input, Row, Space, message } from "antd"
+import React, { useEffect, useState } from "react"
+import moment from "moment"
+
+/**
+ * 封禁玩家管理
+ * @returns 
+ */
+const BanGamePlayerManage: React.FC = () => {
+
+    /*********************************/
+    const [form] = Form.useForm()
+    const [initialValues, setInitialValues] = useState<any>({})
+    const [queryFrom, setQueryForm] = useState<gamePlayerBanListProps>({ pageNum: 1, pageSize: 20 })
+    const [addShow, setAddShow] = useState<boolean>(false)
+    const getBanUserList = useAjax((params: gamePlayerBanListProps) => getBanUserListApi(params))
+    const updateBanUser = useAjax((params: { userId: string, status: number }) => updateBanUserApi(params))
+    /*********************************/
+
+    useEffect(() => {
+        getBanUserList.run(queryFrom)
+    }, [queryFrom])
+
+    const onFinish = (data: any) => {
+        const { banTime, registerTime, ...value } = data
+        let params = { ...queryFrom, ...value }
+        if (banTime) {
+            params.beginDate = moment(banTime[0]).format('YYYY-MM-DD')
+            params.endDate = moment(banTime[1]).format('YYYY-MM-DD')
+        } else {
+            delete params?.beginDate
+            delete params?.endDate
+        }
+        if (registerTime) {
+            params.regBeginTime = moment(registerTime[0]).format('YYYY-MM-DD')
+            params.regEndTime = moment(registerTime[1]).format('YYYY-MM-DD')
+        } else {
+            delete params?.regBeginTime
+            delete params?.regEndTime
+        }
+        setQueryForm({ ...params, pageNum: 1 })
+    }
+
+    // 解封 封禁
+    const handle = (data: any) => {
+        updateBanUser.run({ userId: data.userId, status: data.status === 0 ? 1 : 0 }).then(res => {
+            if (res) {
+                if (data.status === 0) {
+                    message.success('封禁成功')
+                } else {
+                    message.success('解封成功')
+                }
+                getBanUserList.refresh()
+            }
+        })
+    }
+
+    return <Card
+        style={{ borderRadius: 8 }}
+        headStyle={{ textAlign: 'left' }}
+        bodyStyle={{ padding: '5px 10px' }}
+    >
+        <div style={{ textAlign: 'center', fontWeight: 'bold', padding: '4px 6px 6px', fontSize: 16, marginBottom: 4, position: 'relative' }}>
+            封禁玩家管理
+        </div>
+        <Space style={{ width: '100%' }} direction="vertical" size={10}>
+            <Form layout="inline" className='queryForm' initialValues={initialValues} name="basicGameServer" form={form} onFinish={onFinish}>
+                <Row gutter={[0, 6]}>
+                    <Col><Form.Item name='userId'>
+                        <Input placeholder="玩家ID" allowClear style={{ width: 140 }} />
+                    </Form.Item></Col>
+                    
+                    <Col>
+                        <Space>
+                            <Button type="primary" htmlType="submit">搜索</Button>
+                            <Button onClick={() => form.resetFields()}>重置</Button>
+                        </Space>
+                    </Col>
+                </Row>
+            </Form>
+        </Space>
+    </Card>
+}
+
+export default BanGamePlayerManage

+ 98 - 0
src/pages/gameDataStatistics/player/banGamePlayerManage/tableConfig.tsx

@@ -0,0 +1,98 @@
+import { Popconfirm, Tag } from "antd"
+import React from "react"
+
+function columnsPos(handle: (data: any) => void) {
+
+    let newArr: any = [
+        {
+            title: 'ID',
+            dataIndex: 'id',
+            key: 'id',
+            align: 'center',
+            width: 60
+        },
+        {
+            title: '玩家ID',
+            dataIndex: 'userId',
+            key: 'userId',
+            align: 'center',
+            ellipsis: true,
+            width: 120
+        },
+        {
+            title: '玩家账号',
+            dataIndex: 'userName',
+            key: 'userName',
+            align: 'center',
+            width: 150,
+            ellipsis: true,
+        },
+        {
+            title: '玩家昵称',
+            dataIndex: 'userNickName',
+            key: 'userNickName',
+            align: 'center',
+            width: 120,
+            ellipsis: true,
+        },
+        {
+            title: '玩家注册时间',
+            dataIndex: 'regTime',
+            key: 'regTime',
+            align: 'center',
+            width: 120,
+            ellipsis: true,
+        },
+        {
+            title: '封禁时间',
+            dataIndex: 'banTime',
+            key: 'banTime',
+            align: 'center',
+            width: 120,
+            ellipsis: true,
+        },
+        {
+            title: '更新时间',
+            dataIndex: 'updateTime',
+            key: 'updateTime',
+            align: 'center',
+            width: 120,
+            ellipsis: true,
+        },
+        {
+            title: '当前封禁状态',
+            dataIndex: 'status',
+            key: 'status',
+            align: 'center',
+            width: 120,
+            render: (a: number) => {
+                if (a === 1) {
+                    return <Tag color="#f50">封禁</Tag>
+                }
+                return <Tag color="#108ee9">已解封</Tag>
+            }
+        },
+        {
+            title: '操作',
+            dataIndex: 'cz',
+            key: 'cz',
+            align: 'center',
+            width: 80,
+            fixed: 'right',
+            render: (a: string, b: any) => (
+                <Popconfirm
+                    title={b?.status === 1 ? '确定解封?' : '确定封禁?'}
+                    onConfirm={() => { handle && handle(b) }}
+                    okText="是"
+                    cancelText="否"
+                >
+                    <a style={{ fontSize: "12px", color: b?.status === 1 ? '#108ee9' : '#f50' }}> {b?.status === 1 ? '解封' : '封禁'}</a>
+                </Popconfirm>
+
+            )
+        }
+    ]
+    return newArr
+}
+
+export default columnsPos

+ 19 - 0
src/pages/gameDataStatistics/player/banIpManage/index.tsx

@@ -0,0 +1,19 @@
+import React from "react"
+
+
+/**
+ * 封禁IP管理
+ * @returns 
+ */
+const BanIpManage: React.FC = () => {
+
+    /*************************/
+
+    /*************************/
+
+    return <div>
+        1111
+    </div>
+}
+
+export default BanIpManage

+ 1 - 1
src/pages/gameDataStatistics/player/list/index.tsx

@@ -68,7 +68,7 @@ const List: React.FC = () => {
             }
         })
         getUserUpdate.run(params).then(res => {
-            if (res.data) {
+            if (res) {
                 message.success('编辑成功!')
                 ajax.refresh()//重新获取用户列表
                 ajax1.refresh()//重新获取详情列表

+ 37 - 0
src/services/gameData/player.ts

@@ -256,4 +256,41 @@ export async function getIpUserListApi(params: IpUserProps) {
         method: 'POST',
         data: params,
     });
+}
+
+
+
+let apiManage = api + '/manage'
+
+/** 获取封禁玩家列表 */
+export interface gamePlayerBanListProps {
+    pageNum: number,
+    pageSize: number,
+    userId?: any,  // 玩家ID
+    userName?: string, // 玩家账号
+    userNickName?: string, // 玩家昵称
+    regBeginTime?: string,
+    regEndTime?: string, // 注册时间
+    beginDate?: string,
+    endDate?: string, // 封禁时间
+}
+
+/** 封禁IP列表查询 */
+export async function getBanUserListApi(params: gamePlayerBanListProps) {
+    return request(apiManage + '/ban/user/list', {
+        method: 'POST',
+        data: params,
+    });
+}
+
+/**
+ * 解封 封禁
+ * @param params 
+ * @returns 
+ */
+ export async function updateBanUserApi(params: { userId: string, status: number }) {
+    return request(apiManage + '/ban/user/add/or/update', {
+        method: 'POST',
+        data: params,
+    });
 }