Skip to content

Commit

Permalink
feat: 新增订单和支付配置页面
Browse files Browse the repository at this point in the history
  • Loading branch information
79E committed May 22, 2023
1 parent 25d3032 commit 9cba2a6
Show file tree
Hide file tree
Showing 18 changed files with 1,695 additions and 183 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chatgpt-web",
"private": false,
"version": "1.0.1",
"version": "1.2.0",
"description": "ChatGPT Web",
"author": "79E",
"keywords": [
Expand All @@ -27,6 +27,7 @@
"@ant-design/icons": "^5.0.1",
"@ant-design/pro-components": "^2.4.4",
"@traptitech/markdown-it-katex": "^3.6.0",
"alipay-sdk": "^3.4.0",
"antd": "5.5.0",
"bull": "^4.10.4",
"cors": "^2.8.5",
Expand Down Expand Up @@ -57,6 +58,7 @@
"@types/markdown-it": "^12.2.3",
"@types/markdown-it-link-attributes": "^3.0.1",
"@types/node": "^20.1.3",
"@types/node-fetch": "^2.6.4",
"@types/nodemailer": "^6.4.7",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
Expand Down
8 changes: 4 additions & 4 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { userStore } from '@/store'

function App() {
const { user_info } = userStore()
const routers: Array<any> = useMemo(()=>{

const routers: Array<any> = useMemo(() => {
let routerList = [...webRouter]
if(user_info?.role === 'administrator'){
if (user_info?.role === 'administrator') {
routerList = [...routerList, ...adminRouter]
}
return routerList
},[user_info])
}, [user_info])

const routesElement = useRoutes([...routers])
return routesElement
Expand Down
56 changes: 34 additions & 22 deletions src/pages/admin/carmi/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { ProTable } from '@ant-design/pro-components'
import { Tag, message, Button, Modal, Radio, DatePicker, InputNumber, Space, Spin, Input } from 'antd'
import { useRef, useState } from 'react'
import { delAdminCarmi, getAdminCarmi, addAdminCarmis } from '@/request/adminApi'
import { delAdminCarmi, getAdminCarmi, addAdminCarmis, getAdminCarmiCheck } from '@/request/adminApi'
import { CarmiInfo } from '@/types/admin'
import { formatTime } from '@/utils'
import styles from './index.module.less'
Expand Down Expand Up @@ -127,7 +127,19 @@ function CarmiPage() {
toolbar={{
actions: [
<Button
key="primary"
key="check"
type="primary"
size="small"
onClick={() => {
getAdminCarmiCheck().then(()=>{
message.success('提交成功,请稍后查看')
})
}}
>
异步检查卡密
</Button>,
<Button
key="produce"
type="primary"
size="small"
onClick={() => {
Expand Down Expand Up @@ -182,7 +194,7 @@ function CarmiPage() {
min={1}
max={99999}
onChange={(e) => {
if(e){
if (e) {
setGenerateModal(g => ({ ...g, reward: e }))
}
}}
Expand Down Expand Up @@ -211,21 +223,21 @@ function CarmiPage() {
</div>
</Space>
<div className={styles.formCard}>
<p className={styles.formCard_title}>生成数量</p>
<InputNumber
style={{
width:'100%'
}}
size="large"
min={1}
max={50}
onChange={(e) => {
if(e){
setGenerateModal(g => ({ ...g, quantity: e }))
}
}}
value={generateModal.quantity}
/>
<p className={styles.formCard_title}>生成数量</p>
<InputNumber
style={{
width: '100%'
}}
size="large"
min={1}
max={50}
onChange={(e) => {
if (e) {
setGenerateModal(g => ({ ...g, quantity: e }))
}
}}
value={generateModal.quantity}
/>
</div>
<div className={styles.generate}
style={{
Expand Down Expand Up @@ -257,13 +269,13 @@ function CarmiPage() {
end_time: generateModal.end_time,
quantity: generateModal.quantity,
reward: generateModal.reward
}).then((res)=>{
if(res.code) return;
}).then((res) => {
if (res.code) return;
const keys = res.data.map(info => `${info.key}`).join('\n')
setGenerateModal(g => ({ ...g, loading: false, result: keys }))
tableActionRef.current?.reloadAndRest?.()
}).finally(()=>{
setGenerateModal(g => ({ ...g, loading: false}))
}).finally(() => {
setGenerateModal(g => ({ ...g, loading: false }))
})
}}
type="primary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function ConfigPage() {
<ProFormDigit
name="history_message_count"
label="携带数量"
tooltip="对话时携带历史聊天记录数量"
tooltip="新用户注册赠送积分数量"
min={1}
max={100000}
/>
Expand Down
25 changes: 25 additions & 0 deletions src/pages/admin/order/index.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.jsonPre {
padding: 5px;
margin: 5px;
white-space: pre-wrap;

[class*='string'] {
color: green;
}

[class*='number'] {
color: darkorange;
}

[class*='boolean'] {
color: blue;
}

[class*='null'] {
color: magenta;
}

[class*='key'] {
color: red;
}
}
Loading

0 comments on commit 9cba2a6

Please sign in to comment.