接口调用时获取用户的x-data-ip和x-data-ua & 修改isp参数类型 & 使用教程初版 &后台用户名字段展示 &添加支付平台字段

This commit is contained in:
Eamon-meng
2025-12-01 19:11:53 +08:00
parent b91de82bc2
commit b0a0b37b19
13 changed files with 300 additions and 43 deletions

View File

@@ -32,7 +32,7 @@ export async function GET(req: NextRequest) {
count: Number(count),
prov,
city,
isp,
isp: Number(isp),
})
if (!result.success) {
throw new Error(result.message)

View File

@@ -33,7 +33,7 @@ export default function HelpMenu() {
icon={h03}
title="产品功能"
items={[
{lead: '常见问题', href: '#'},
{lead: '常见问题', href: '/prodFeat'},
{lead: '产品介绍', href: '#'},
{lead: '行业资讯', href: '#'},
]}

View File

@@ -1,41 +1,68 @@
import QuickStart from '@/components/docs/quickStart.mdx'
import Markdown from '@/components/markdown'
'use client'
import {useEffect, useState} from 'react'
import {useRouter, usePathname, useSearchParams} from 'next/navigation'
import BreadCrumb from '@/components/bread-crumb'
import Wrap from '@/components/wrap'
import QuickStart from '@/components/composites/quickStart'
import Sidebar, {MENU} from '@/components/composites/sidebar'
export type CollectPageProps = {}
export default function CollectPage(props: CollectPageProps) {
const router = useRouter()
const pathname = usePathname()
const searchParams = useSearchParams()
// 初始根据 url ?doc=xxx 设置选中项,回退到默认 'browser-proxy'
const initialDoc = searchParams?.get('doc') ?? 'browser-proxy'
const [selected, setSelected] = useState<string>(initialDoc)
const [collapsed, setCollapsed] = useState<boolean>(false)
// 当 selected 改变时同步更新 URL
useEffect(() => {
const url = `${pathname}?doc=${selected}`
router.replace(url)
}, [selected, pathname, router])
const selectedLabel = (() => {
for (const sec of MENU) {
const found = sec.items.find(i => i.key === selected)
if (found) return found.label
}
return selected
})()
export default function QuickStartPage() {
return (
<div className="container mx-auto p-4">
<Markdown>
<QuickStart/>
</Markdown>
</div>
<main className="mt-20 flex flex-col gap-4">
<Wrap className="flex flex-col py-8 gap-8">
<BreadCrumb items={[
{label: '帮助中心', href: '/help'},
{label: '使用教程', href: '/help/tutorials'},
{label: selectedLabel, href: `${pathname}?doc=${selected}`},
]}/>
{/* 两列布局:左侧侧边栏,右侧内容 */}
<div className="flex gap-6">
<Sidebar
collapsed={collapsed}
onToggle={() => setCollapsed(v => !v)}
selected={selected}
onSelect={key => setSelected(key)}
/>
<div className="flex-1 bg-white border rounded p-6 min-h-[420px]">
{selected === 'browser-proxy' && <QuickStart hidePreview/>}
{selected !== 'browser-proxy' && (
<div>
<h2 className="text-2xl font-semibold mb-4">
{selected === 'code-download' ? '代码下载' : '占位页面'}
</h2>
<p className="text-slate-600">
MDX/ Sidebar
</p>
</div>
)}
</div>
</div>
</Wrap>
</main>
)
}
// app/
// ├── help/
// │ ├── tutorials/ # 使用教程
// │ │ ├── quick-start/ # 快速入手
// │ │ │ └── page.tsx
// │ │ ├── code-download/ # 代码下载
// │ │ │ └── page.tsx
// │ │ └── api-docs/ # API文档
// │ │ └── page.tsx
// │ │
// │ └── features/ # 产品功能
// │ ├── faq/ # 常见问题
// │ │ └── page.tsx
// │ ├── introduction/ # 产品介绍
// │ │ └── page.tsx
// │ └── industry-news/ # 行业资讯
// │ └── page.tsx
// │
// components/
// └── docs/
// ├── tutorials/
// │ ├── quickStart.mdx # MDX内容文件
// │ ├── codeDownload.mdx
// │ └── apiDocs.mdx
// └── features/
// ├── faq.mdx
// ├── introduction.mdx
// └── industryNews.mdx

View File

@@ -26,7 +26,7 @@ async function UserCenter() {
<Card className="h-full">
<CardContent className="flex-auto flex flex-col justify-between gap-4">
<div className="flex flex-col gap-1">
<p>{profile.phone}</p>
<p>{profile.username?.trim() || profile.email || profile.phone}</p>
<p className="text-sm text-weak">{`最后登录:${format(profile.last_login, 'yyyy-MM-dd HH:mm')}`}</p>
</div>
<div className={merge(

View File

@@ -65,6 +65,7 @@ export default function BillsPage(props: BillsPageProps) {
const res = await listBills({
page, size, type, create_after, create_before, trade_id,
})
console.log(res, 'res')
if (res.success) {
setData(res.data)
@@ -249,6 +250,29 @@ export default function BillsPage(props: BillsPageProps) {
)
},
},
{
accessorKey: 'platform',
header: '支付平台',
cell: ({row}) => {
const trade = row.original.trade
if (!trade) return <span>-</span>
return (
<div className="flex items-center gap-2">
{trade.platform === 1 ? (
<>
<span></span>
</>
) : trade.platform === 2 ? (
<>
<span></span>
</>
) : (
<span>-</span>
)}
</div>
)
},
},
{
accessorKey: 'created_at', header: '创建时间', cell: ({row}) => (
format(new Date(row.original.created_at), 'yyyy-MM-dd HH:mm')