|
@@ -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
|