shenwu 10 månader sedan
förälder
incheckning
3b1d02d47a

+ 45 - 25
src/pages/launchSystemNew/account/game/qqAuto.tsx → src/pages/launchSystemNew/account/components/qqAuto.tsx

@@ -6,33 +6,36 @@ let name = {
     1: '游戏账号失败列表:',
     1: '游戏账号失败列表:',
 }
 }
 var time: any = null
 var time: any = null
-let api= "http://47.99.157.216:8023"
-// let api= "http://127.0.0.1:8023"
-function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
-    const { qqVisible, callBack } = props
+// let api = "http://47.99.157.216:8023"
+let api = "http://127.0.0.1:8023"
+function QQAuth(props: { qqVisible: boolean, callBack: () => void, adAppType: 0 | 1, title: string, smType?: "QQ" | "WX", isOld?: boolean }) {
+    const { qqVisible, callBack, adAppType, smType, title, isOld } = props
     let [visible, setVisible] = useState(false)
     let [visible, setVisible] = useState(false)
-    let [loading,setLoading]=useState(false)
+    let [loading, setLoading] = useState(false)
     let [codeUrl, setCodeUrl] = useState('')
     let [codeUrl, setCodeUrl] = useState('')
     let [err, setErr] = useState({})
     let [err, setErr] = useState({})
     let [data, setData] = useState({
     let [data, setData] = useState({
         userId: localStorage.getItem('userId'),
         userId: localStorage.getItem('userId'),
-        adAppType: 1,
+        adAppType,
         users: [],
         users: [],
         callbackPage: 'http%3A%2F%2Ferp.zanxiangnet.com%2FadCode',
         callbackPage: 'http%3A%2F%2Ferp.zanxiangnet.com%2FadCode',
-        authorization: `Bearer ${sessionStorage.getItem('Admin-Token')}`
+        authorization: `Bearer ${sessionStorage.getItem('Admin-Token')}`,
+        smType: smType ? "WX" : "QQ",
+        isOld
     })
     })
     let adAppIdonChange = useCallback((checkedValue) => {
     let adAppIdonChange = useCallback((checkedValue) => {
         let v = checkedValue.target.value
         let v = checkedValue.target.value
-        console.log("checkedValue===>",v)
-        setData({ ...data, adAppType:v})
+        console.log("checkedValue===>", v)
+        setData({ ...data, adAppType: v })
     }, [data])
     }, [data])
     let submit = useCallback(() => {
     let submit = useCallback(() => {
         if (data.users.some(user => isNaN(user))) {
         if (data.users.some(user => isNaN(user))) {
             message.error('账号请使用数字!!!!!!')
             message.error('账号请使用数字!!!!!!')
             return
             return
         }
         }
+        console.log(data)
         setLoading(true)
         setLoading(true)
-        fetch(api+'/qq/auth', {
+        fetch(api + '/qq/auth', {
             method: 'POST',
             method: 'POST',
             headers: {
             headers: {
                 "content-type": "application/json",
                 "content-type": "application/json",
@@ -42,11 +45,11 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
             if (r?.data?.codeImgUrl) {
             if (r?.data?.codeImgUrl) {
                 setCodeUrl(r?.data?.codeImgUrl)
                 setCodeUrl(r?.data?.codeImgUrl)
                 setVisible(true)
                 setVisible(true)
-                let n=0
+                let n = 0
                 time = setInterval(() => {
                 time = setInterval(() => {
-                    if(n< 60){
-                        n+=1
-                        fetch(`${api}/qq/isOk?userId=${localStorage.getItem('userId')}`, {
+                    if (n < 60) {
+                        n += 1
+                        fetch(`${api}/qq/isOk?userId=${localStorage.getItem('userId')}&smType=${data.smType}`, {
                             method: 'GET'
                             method: 'GET'
                         }).then(res => res.json()).then(r => {
                         }).then(res => res.json()).then(r => {
                             if (r.data) {
                             if (r.data) {
@@ -56,17 +59,17 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
                                 setLoading(false)
                                 setLoading(false)
                             }
                             }
                         })
                         })
-                    }else{
+                    } else {
                         message.error('扫码超时请重新扫码!')
                         message.error('扫码超时请重新扫码!')
                         setVisible(false)
                         setVisible(false)
                         setCodeUrl("")
                         setCodeUrl("")
                         clearInterval(time)
                         clearInterval(time)
                         setLoading(false)
                         setLoading(false)
                     }
                     }
-                   
+
                 }, 1000)
                 }, 1000)
             } else {
             } else {
-                message.success('已经开始授权,稍后自行查看结果!')
+                message.success('已经开始授权,稍后自行查看结果!如遇到问题请点击清除账号状态按钮重试!')
                 setLoading(false)
                 setLoading(false)
             }
             }
             console.log(r)
             console.log(r)
@@ -100,16 +103,29 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
         width={800}
         width={800}
         onCancel={callBack}
         onCancel={callBack}
         maskClosable={false}
         maskClosable={false}
+        title={<>{title}<span style={{ color: 'red' }}>(如需更换手机扫码请先点击清除账号状态)</span></>}
     >
     >
         <div>
         <div>
             <Row>
             <Row>
+                <Col span='24'>
+                    <Row>
+                        <Col span={3}><h3>扫码渠道:</h3></Col>
+                        <Col span={20}>
+                            <Radio.Group style={{ width: '100%' }} onChange={(e) => {
+                                setData({ ...data, smType: e.target.value })
+                            }} defaultValue={data.smType}>
+                                <Radio value={"QQ"}>QQ</Radio>
+                                {!isOld && <Radio value={"WX"}>微信</Radio>}
+                            </Radio.Group>
+                        </Col>
+                    </Row>
+                </Col>
                 <Col span='24'>
                 <Col span='24'>
                     <Row>
                     <Row>
                         <Col span={3}><h3>平台选择:</h3></Col>
                         <Col span={3}><h3>平台选择:</h3></Col>
                         <Col span={20}>
                         <Col span={20}>
                             <Radio.Group style={{ width: '100%' }} onChange={adAppIdonChange} defaultValue={data.adAppType}>
                             <Radio.Group style={{ width: '100%' }} onChange={adAppIdonChange} defaultValue={data.adAppType}>
-                                {/* <Radio value={0}>小说</Radio> */}
-                                <Radio value={1}>游戏</Radio>
+                                {adAppType === 0 ? <Radio value={0}>小说</Radio> : <Radio value={1}>游戏</Radio>}
                             </Radio.Group>
                             </Radio.Group>
                         </Col>
                         </Col>
                     </Row>
                     </Row>
@@ -123,7 +139,7 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
             </Row>
             </Row>
             <Row style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>
             <Row style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>
                 <Space>
                 <Space>
-                    <Button type='primary' onClick={submit} loading={loading}>提交</Button>
+                    <Button type='primary' onClick={submit} loading={loading} disabled={data.users.length === 0}>提交</Button>
                     <Button type='default' onClick={query} >查询授权失败账号</Button>
                     <Button type='default' onClick={query} >查询授权失败账号</Button>
                     <Popconfirm title={'清除账号状态将清除所有失败记录,并清空上一次扫码授权状态!'} onConfirm={del} >
                     <Popconfirm title={'清除账号状态将清除所有失败记录,并清空上一次扫码授权状态!'} onConfirm={del} >
                         <Button type='primary' danger >清除账号状态</Button>
                         <Button type='primary' danger >清除账号状态</Button>
@@ -146,13 +162,17 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
             <Modal
             <Modal
                 visible={visible}
                 visible={visible}
                 footer={null}
                 footer={null}
-                width={200}
-                onCancel={() => setVisible(false)}
+                width={250}
+                onCancel={() => { setVisible(false); location.reload() }}
                 maskClosable={false}
                 maskClosable={false}
+                title={<>{data?.smType === 'QQ' ? "QQ扫码" : "微信扫码"}</>}
             >
             >
-                <Image
-                    style={{ width: 150 }}
-                    src={codeUrl} />
+                <div style={{ display: 'flex', justifyItems: "center", alignItems: 'center' }}>
+                    <Image
+                        style={{ width: 150 }}
+                        src={codeUrl} />
+                    <strong style={{ color: 'red', width: '100%', textAlign: 'center' }}>扫码成功后自动关闭窗口</strong>
+                </div>
             </Modal>
             </Modal>
         </div>
         </div>
     </Modal>
     </Modal>

+ 6 - 2
src/pages/launchSystemNew/account/game/index.tsx

@@ -8,7 +8,7 @@ import { getAdAccountGameListApi, GetAdAccountParams, putAdAccountApi } from '@/
 import style from './index.less'
 import style from './index.less'
 import TableData from '../../components/TableData'
 import TableData from '../../components/TableData'
 import GroupLeft from './groupLeft'
 import GroupLeft from './groupLeft'
-import QQAuth from './qqAuto'
+import QQAuth from '../components/qqAuto'
 import { MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
 import { MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
 import TeamMembers from '../../components/teamMembers'
 import TeamMembers from '../../components/teamMembers'
 import { getAdAccountAllOfMemberGame, getErpUserAll, getServiceProviderAll, putConfigServiceProvider } from '@/services/launchAdq/adq'
 import { getAdAccountAllOfMemberGame, getErpUserAll, getServiceProviderAll, putConfigServiceProvider } from '@/services/launchAdq/adq'
@@ -23,6 +23,7 @@ import SetEarlyWarningsAccount from '@/components/EarlyWarning/setEarlyWarningsA
 /** 投放管理 */
 /** 投放管理 */
 const AdAuthorize: React.FC = () => {
 const AdAuthorize: React.FC = () => {
     let [visible, setVisible] = useState(false)
     let [visible, setVisible] = useState(false)
+    let [newVisible, setNewVisible] = useState(false)
     /*************************/
     /*************************/
     const { groupListInit } = useModel('useLaunchAdq.useAdAuthorize')
     const { groupListInit } = useModel('useLaunchAdq.useAdAuthorize')
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
@@ -225,6 +226,7 @@ const AdAuthorize: React.FC = () => {
                         <Button onClick={getList} type='primary' loading={getAdAccountList.loading}>搜索</Button>
                         <Button onClick={getList} type='primary' loading={getAdAccountList.loading}>搜索</Button>
                         <AddAccountToGroup onChange={() => getAdAccountList.refresh()} />
                         <AddAccountToGroup onChange={() => getAdAccountList.refresh()} />
                         <Button type='primary' onClick={() => setVisible(true)}><PlusOutlined />广告账号授权</Button>
                         <Button type='primary' onClick={() => setVisible(true)}><PlusOutlined />广告账号授权</Button>
+                        <Button type='primary' onClick={() => setNewVisible(true)}><PlusOutlined />广告业务单元批量授权</Button>
                         {switchType === 'account' ?
                         {switchType === 'account' ?
                             (selectAccData?.length > 0 && <>
                             (selectAccData?.length > 0 && <>
                                 <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { checkAccount(selectAccData) }}>批量切号</Button>
                                 <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { checkAccount(selectAccData) }}>批量切号</Button>
@@ -326,7 +328,9 @@ const AdAuthorize: React.FC = () => {
 
 
         </Modal>}
         </Modal>}
         {/* 广告授权 */}
         {/* 广告授权 */}
-        {visible && <QQAuth qqVisible={visible} callBack={() => setVisible(false)} />}
+        {visible && <QQAuth qqVisible={visible} callBack={() => setVisible(false)} adAppType={1} title='游戏广告账号授权' isOld={true}/>}
+        {/* 广告业务单元批量授权 */}
+        {newVisible && <QQAuth qqVisible={newVisible} callBack={() => setNewVisible(false)} adAppType={1} smType={"WX"} title='游戏广告业务单元批量授权'/>}
         {/* 变更记录 */}
         {/* 变更记录 */}
         {crShow && <ChangeRecord visible={crShow} data={crData} onClose={() => { setCrShow(false); setCrData(null) }} />}
         {crShow && <ChangeRecord visible={crShow} data={crData} onClose={() => { setCrShow(false); setCrData(null) }} />}
         {/* 切号 */}
         {/* 切号 */}

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

@@ -8,7 +8,7 @@ import { getAdAccountListApi, GetAdAccountParams, putAdAccountApi } from '@/serv
 import style from './index.less'
 import style from './index.less'
 import TableData from '../../components/TableData'
 import TableData from '../../components/TableData'
 import GroupLeft from './groupLeft'
 import GroupLeft from './groupLeft'
-import QQAuth from './qqAuto'
+import QQAuth from '../components/qqAuto'
 import { MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
 import { MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
 import TeamMembers from '../../components/teamMembers'
 import TeamMembers from '../../components/teamMembers'
 import { getAdAccountAllOfMember, getErpUserAll, getServiceProviderAll, putConfigServiceProvider } from '@/services/launchAdq/adq'
 import { getAdAccountAllOfMember, getErpUserAll, getServiceProviderAll, putConfigServiceProvider } from '@/services/launchAdq/adq'
@@ -23,6 +23,7 @@ import SetEarlyWarningsAccount from '@/components/EarlyWarning/setEarlyWarningsA
 /** 投放管理 */
 /** 投放管理 */
 const AdAuthorize: React.FC = () => {
 const AdAuthorize: React.FC = () => {
     let [visible, setVisible] = useState(false)
     let [visible, setVisible] = useState(false)
+    let [newVisible, setNewVisible] = useState(false)
     /*************************/
     /*************************/
     const { groupListInit } = useModel('useLaunchAdq.useAdAuthorize')
     const { groupListInit } = useModel('useLaunchAdq.useAdAuthorize')
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
@@ -186,7 +187,7 @@ const AdAuthorize: React.FC = () => {
                             style={{ width: 120 }}
                             style={{ width: 120 }}
                             placeholder="选择操作类型"
                             placeholder="选择操作类型"
                             onChange={(e) => {
                             onChange={(e) => {
-                                setSwitchType(e); 
+                                setSwitchType(e);
                                 setSelectAccData([])
                                 setSelectAccData([])
                             }}
                             }}
                             value={switchType}
                             value={switchType}
@@ -226,6 +227,7 @@ const AdAuthorize: React.FC = () => {
                         <Button onClick={getList} type='primary' loading={getAdAccountList.loading}>搜索</Button>
                         <Button onClick={getList} type='primary' loading={getAdAccountList.loading}>搜索</Button>
                         <AddAccountToGroup onChange={() => getAdAccountList.refresh()} />
                         <AddAccountToGroup onChange={() => getAdAccountList.refresh()} />
                         <Button type='primary' onClick={() => setVisible(true)}><PlusOutlined />广告账号授权</Button>
                         <Button type='primary' onClick={() => setVisible(true)}><PlusOutlined />广告账号授权</Button>
+                        <Button type='primary' onClick={() => setNewVisible(true)}><PlusOutlined />广告业务单元批量授权</Button>
                         {switchType === 'account' ?
                         {switchType === 'account' ?
                             (selectAccData?.length > 0 && <>
                             (selectAccData?.length > 0 && <>
                                 <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { checkAccount(selectAccData) }}>批量切号</Button>
                                 <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { checkAccount(selectAccData) }}>批量切号</Button>
@@ -327,7 +329,9 @@ const AdAuthorize: React.FC = () => {
 
 
         </Modal>}
         </Modal>}
         {/* 广告授权 */}
         {/* 广告授权 */}
-        {visible && <QQAuth qqVisible={visible} callBack={() => setVisible(false)} />}
+        {visible && <QQAuth qqVisible={visible} callBack={() => setVisible(false)} adAppType={0} title='小说广告账号授权' isOld={true}/>}
+        {/* 广告业务单元批量授权 */}
+        {newVisible && <QQAuth qqVisible={newVisible} callBack={() => setNewVisible(false)} adAppType={0} smType={"WX"}  title='小说广告业务单元批量授权'/>}
         {/* 变更记录 */}
         {/* 变更记录 */}
         {crShow && <ChangeRecord visible={crShow} data={crData} onClose={() => { setCrShow(false); setCrData(null) }} />}
         {crShow && <ChangeRecord visible={crShow} data={crData} onClose={() => { setCrShow(false); setCrData(null) }} />}
         {/* 切号 */}
         {/* 切号 */}

+ 0 - 161
src/pages/launchSystemNew/account/novel/qqAuto.tsx

@@ -1,161 +0,0 @@
-import { useCallback, useState } from "react"
-import React from 'react'
-import { Col, Row, Radio, Input, Button, message, Space, Image, Modal, Popconfirm } from "antd";
-let name = {
-    0: '小说账号失败列表:',
-    1: '游戏账号失败列表:',
-}
-var time: any = null
-let api= "http://47.99.157.216:8023"
-// let api= "http://127.0.0.1:8023"
-function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
-    const { qqVisible, callBack } = props
-    let [visible, setVisible] = useState(false)
-    let [loading,setLoading]=useState(false)
-    let [codeUrl, setCodeUrl] = useState('')
-    let [err, setErr] = useState({})
-    let [data, setData] = useState({
-        userId: localStorage.getItem('userId'),
-        adAppType: 0,
-        users: [],
-        callbackPage: 'http%3A%2F%2Ferp.zanxiangnet.com%2FadCode',
-        authorization: `Bearer ${sessionStorage.getItem('Admin-Token')}`
-    })
-    let adAppIdonChange = useCallback((checkedValue) => {
-        let v = checkedValue.target.value
-        console.log("checkedValue===>",v)
-        setData({ ...data, adAppType:v})
-    }, [data])
-    let submit = useCallback(() => {
-        if (data.users.some(user => isNaN(user))) {
-            message.error('账号请使用数字!!!!!!')
-            return
-        }
-        setLoading(true)
-        fetch(api+'/qq/auth', {
-            method: 'POST',
-            headers: {
-                "content-type": "application/json",
-            },
-            body: JSON.stringify(data)
-        }).then(res => res.json()).then(r => {
-            if (r?.data?.codeImgUrl) {
-                setCodeUrl(r?.data?.codeImgUrl)
-                setVisible(true)
-                let n=0
-                time = setInterval(() => {
-                    if(n< 60){
-                        n+=1
-                        fetch(`${api}/qq/isOk?userId=${localStorage.getItem('userId')}`, {
-                            method: 'GET'
-                        }).then(res => res.json()).then(r => {
-                            if (r.data) {
-                                setVisible(false)
-                                setCodeUrl("")
-                                clearInterval(time)
-                                setLoading(false)
-                            }
-                        })
-                    }else{
-                        message.error('扫码超时请重新扫码!')
-                        setVisible(false)
-                        setCodeUrl("")
-                        clearInterval(time)
-                        setLoading(false)
-                    }
-                   
-                }, 1000)
-            } else {
-                message.success('已经开始授权,稍后自行查看结果!')
-                setLoading(false)
-            }
-            console.log(r)
-        })
-    }, [data])
-    let query = () => {
-        fetch(`${api}/qq/queryErr?userId=${localStorage.getItem('userId')}`, {
-            method: 'GET'
-        }).then(res => res.json()).then(r => {
-            console.log(r)
-            setErr(r.data)
-        })
-    }
-    let del = () => {
-        fetch(`${api}/qq/delCookie?userId=${localStorage.getItem('userId')}`, {
-            method: 'GET'
-        }).then(res => res.json()).then(r => {
-            console.log(r)
-            message.success('清理成功!!!!请重新扫码授权登录!!!')
-        })
-    }
-    let userIdChange = useCallback((e) => {
-        let value = e.target.value
-        let arr = value.split(/,|,/)
-        let newArr = arr?.map((str: string) => Number(str.replace(/\s/ig, '')))
-        setData({ ...data, users: newArr })
-    }, [data])
-    return <Modal
-        visible={qqVisible}
-        footer={null}
-        width={800}
-        onCancel={callBack}
-        maskClosable={false}
-    >
-        <div>
-            <Row>
-                <Col span='24'>
-                    <Row>
-                        <Col span={3}><h3>平台选择:</h3></Col>
-                        <Col span={20}>
-                            <Radio.Group style={{ width: '100%' }} onChange={adAppIdonChange} defaultValue={data.adAppType}>
-                                <Radio value={0}>小说</Radio>
-                                {/* <Radio value={1}>游戏</Radio> */}
-                            </Radio.Group>
-                        </Col>
-                    </Row>
-                </Col>
-                <Col span='24'>
-                    <Row>
-                        <Col span={3}><h3>账号ID:</h3></Col>
-                        <Col span={20}> <Input.TextArea placeholder='多个账号请以,号隔开例:123456,222333,444444' rows={5} onChange={userIdChange} allowClear></Input.TextArea></Col>
-                    </Row>
-                </Col>
-            </Row>
-            <Row style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>
-                <Space>
-                    <Button type='primary' onClick={submit} loading={loading}>提交</Button>
-                    <Button type='default' onClick={query} >查询授权失败账号</Button>
-                    <Popconfirm title={'清除账号状态将清除所有失败记录,并清空上一次扫码授权状态!'} onConfirm={del} >
-                        <Button type='primary' danger >清除账号状态</Button>
-                    </Popconfirm>
-
-                </Space>
-            </Row>
-            <Row>
-                {
-                    Object.keys(err).map((key, i) => {
-                        return <Col key={i} span={24}>
-                            <div>
-                                <h4>{name[key]}</h4>
-                                <p>{err[key]?.join()}</p>
-                            </div>
-                        </Col>
-                    })
-                }
-            </Row>
-            <Modal
-                visible={visible}
-                footer={null}
-                width={200}
-                onCancel={() => setVisible(false)}
-                maskClosable={false}
-            >
-                <Image
-                    style={{ width: 150 }}
-                    src={codeUrl} />
-            </Modal>
-        </div>
-    </Modal>
-
-}
-export default QQAuth