Merge branch 'main' of https://gitee.com/wg123/video-gen
This commit is contained in:
@@ -147,6 +147,10 @@ async def oauth_list(
|
||||
"open_type": oauth.open_type,
|
||||
"port_type": oauth.port_type,
|
||||
"appid": oauth.appid,
|
||||
"access_token": oauth.access_token,
|
||||
"access_token_expired": oauth.access_token_expired,
|
||||
"refresh_token": oauth.refresh_token,
|
||||
"refresh_token_expired": oauth.refresh_token_expired,
|
||||
"material_auth_status": oauth.material_auth_status,
|
||||
"created_at": oauth.created_at,
|
||||
"updated_at": oauth.updated_at,
|
||||
|
||||
@@ -26,6 +26,10 @@ class UserOAuthOut(BaseModel):
|
||||
open_type: int = Field(..., description="开户方式(1=千川,2=广告,3=本地推,4=星图,5=快手代理商,6=巨量星图,7=巨量服务单,8=腾讯服务单,9=腾讯营销K2,10=腾讯营销K3)")
|
||||
port_type: int = Field(..., description="平台端口(1=巨量,2=磁力,3=巨量星图,4=服务单,5=腾讯)")
|
||||
appid: Optional[str] = Field(None, description="授权应用id")
|
||||
access_token: Optional[str] = Field(None, description="授权token")
|
||||
access_token_expired: Optional[datetime] = Field(None, description="token过期时间")
|
||||
refresh_token: Optional[str] = Field(None, description="授权刷新token")
|
||||
refresh_token_expired: Optional[datetime] = Field(None, description="刷新token过期时间")
|
||||
material_auth_status: bool = Field(False, description="是否敏感物料授权")
|
||||
created_at: datetime = Field(..., description="创建时间")
|
||||
updated_at: datetime = Field(..., description="更新时间")
|
||||
|
||||
+94
-94
File diff suppressed because one or more lines are too long
Vendored
+34
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
@@ -29,6 +30,39 @@
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-Ducf_SGZ.js"></script>
|
||||
=======
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
||||
<title>民众智创</title>
|
||||
<script>
|
||||
(function() {
|
||||
var cached = localStorage.getItem('siteInfo');
|
||||
if (cached) {
|
||||
try {
|
||||
var info = JSON.parse(cached);
|
||||
if (info.siteName) {
|
||||
document.title = info.siteName;
|
||||
}
|
||||
if (info.siteLogo) {
|
||||
var link = document.querySelector('link[rel="icon"]');
|
||||
if (link) {
|
||||
link.href = info.siteLogo;
|
||||
link.type = 'image/png';
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-DCmxkqpk.js"></script>
|
||||
>>>>>>> 88c31dce9fdbfa6c2c9605197a81fea1f3aaaca9
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-D3IaMBsq.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Table, Modal, App, Input, Pagination, Typography, Space } from 'antd';
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
import { LockOutlined, ArrowLeftOutlined } from '@ant-design/icons';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { getOAuthAccountList, deleteOAuthAccount, getOpenTypeAll } from '../api';
|
||||
|
||||
const formatDateTime = (dateStr: string) => {
|
||||
@@ -25,6 +26,7 @@ interface AuthorizationData {
|
||||
}
|
||||
|
||||
const AuthAccountPage: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const { message } = App.useApp();
|
||||
const [authorizations, setAuthorizations] = useState<AuthorizationData[]>([]);
|
||||
const [listLoading, setListLoading] = useState(false);
|
||||
@@ -213,6 +215,15 @@ const AuthAccountPage: React.FC = () => {
|
||||
},
|
||||
];
|
||||
|
||||
const handleBack = () => {
|
||||
const referrer = document.referrer;
|
||||
if (referrer.includes(window.location.origin)) {
|
||||
navigate(-1);
|
||||
} else {
|
||||
navigate('/authorization');
|
||||
}
|
||||
};
|
||||
|
||||
const tableData = authorizations.map((item, index) => ({
|
||||
...item,
|
||||
index: index + 1,
|
||||
@@ -222,6 +233,7 @@ const AuthAccountPage: React.FC = () => {
|
||||
return (
|
||||
<div style={{ minHeight: '94vh' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 }}>
|
||||
<Button type="text" icon={<ArrowLeftOutlined />} onClick={handleBack} />
|
||||
<LockOutlined style={{ color: '#6366f1', fontSize: 16 }} />
|
||||
<Typography.Text strong style={{ fontSize: 16 }}>授权管理</Typography.Text>
|
||||
</div>
|
||||
|
||||
@@ -154,6 +154,19 @@ const AuthorizationPage: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleReauthorize = async (record: AuthorizationData) => {
|
||||
try {
|
||||
const response = await requestOAuth({ open_type: record.openType });
|
||||
if (response.authUrl) {
|
||||
window.open(response.authUrl, '_blank');
|
||||
} else {
|
||||
message.error('获取授权链接失败');
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('重新授权失败');
|
||||
}
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'ID',
|
||||
@@ -162,13 +175,12 @@ const AuthorizationPage: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '授权账户ID',
|
||||
dataIndex: 'advertiserId',
|
||||
key: 'advertiserId',
|
||||
width: 160,
|
||||
dataIndex: 'accountId',
|
||||
key: 'accountId',
|
||||
},
|
||||
{
|
||||
title: '授权账户名称',
|
||||
dataIndex: 'advertiserName',
|
||||
dataIndex: 'accountName',
|
||||
key: 'accountName',
|
||||
},
|
||||
{
|
||||
@@ -211,9 +223,10 @@ const AuthorizationPage: React.FC = () => {
|
||||
key: 'accountUsername',
|
||||
},
|
||||
{
|
||||
title: '授权应用ID',
|
||||
dataIndex: 'appid',
|
||||
key: 'appid',
|
||||
title: '开户方式',
|
||||
dataIndex: 'openType',
|
||||
key: 'openType',
|
||||
render: (text: number) => <span style={{ color: '#1e293b' }}>{openTypeMap[text] || text}</span>,
|
||||
},
|
||||
{
|
||||
title: '是否敏感物料授权',
|
||||
@@ -227,27 +240,9 @@ const AuthorizationPage: React.FC = () => {
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '开户方式',
|
||||
dataIndex: 'openType',
|
||||
key: 'openType',
|
||||
render: (text: number) => <span style={{ color: '#1e293b' }}>{openTypeMap[text] || text}</span>,
|
||||
},
|
||||
{
|
||||
title: '平台端口',
|
||||
dataIndex: 'portType',
|
||||
key: 'portType',
|
||||
ellipsis: true,
|
||||
render: (text: number) => <span style={{ color: '#1e293b' }}>{PORT_TYPE_MAP[text] || text}</span>,
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
title: '授权过期时间',
|
||||
dataIndex: 'accessTokenExpired',
|
||||
key: 'accessTokenExpired',
|
||||
width: 160,
|
||||
render: (text: string) => <span style={{ color: '#64748b' }}>{formatDateTime(text)}</span>,
|
||||
},
|
||||
@@ -263,15 +258,24 @@ const AuthorizationPage: React.FC = () => {
|
||||
dataIndex: 'action',
|
||||
fixed: 'right' as const,
|
||||
key: 'action',
|
||||
width: 140,
|
||||
width: 190,
|
||||
render: (_: unknown, record) => (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => navigate(`/consume?advertiserId=${record.advertiserId}`)}
|
||||
style={{ color: '#6366f1', padding: 0 }}
|
||||
>
|
||||
查看授权账户
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => navigate(`/authacc?advertiserId=${record.advertiserId}`)}
|
||||
style={{ color: '#6366f1', padding: 0 }}
|
||||
>
|
||||
查看授权账户
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => handleReauthorize(record)}
|
||||
style={{ color: '#00c49f', padding: 0, marginLeft: 8 }}
|
||||
>
|
||||
重新授权
|
||||
</Button>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -92,7 +92,7 @@ const ConsumePage: React.FC = () => {
|
||||
if (referrer.includes(window.location.origin)) {
|
||||
navigate(-1);
|
||||
} else {
|
||||
navigate('/authorization');
|
||||
navigate('/materials');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user