diff --git a/public/images/icon_border.png b/public/images/icon_border.png new file mode 100644 index 0000000..72c749d Binary files /dev/null and b/public/images/icon_border.png differ diff --git a/src/pages/ManualRechargeAndWithdrawal/index.jsx b/src/pages/ManualRechargeAndWithdrawal/index.jsx index 5aaed6b..da8e697 100644 --- a/src/pages/ManualRechargeAndWithdrawal/index.jsx +++ b/src/pages/ManualRechargeAndWithdrawal/index.jsx @@ -1,7 +1,6 @@ import React, { useState, useEffect } from "react"; import { Form, Input, Table, Image, Space, Button, Modal, Radio } from "antd"; import baseRequest from "../../utils/baseRequest"; -import { generateSignature } from "../../utils/crypto"; const ManualRechargeAndWithdrawalContent = (props) => { const { TextArea } = Input; @@ -134,20 +133,16 @@ const ManualRechargeAndWithdrawalContent = (props) => { const modalSearch = async (value) => { try { const base = baseRequest(); - const signature = generateSignature(); - const response = await fetch( - `/op/account/list_by_user_id?signature=${signature}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - user_id: parseInt(value.userId, 10), - ...base, - }), - } - ); + const response = await fetch(`/op/account/list_by_user_id`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + user_id: parseInt(value.userId, 10), + ...base, + }), + }); const data = await response.json(); if (data.ret === -1) { alert(data.msg); @@ -177,34 +172,23 @@ const ManualRechargeAndWithdrawalContent = (props) => { try { const base = baseRequest(); - const signature = generateSignature({ - mid: selectedUser, - coins: parseInt(value.num, 10), - operator: base.b_mid.toString(), - ...base, + const response = await fetch(`/op/vas/create_order`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + mid: selectedUser, + coins: parseInt(value.num, 10), + operator: value.password, + ...base, + }), }); - const response = await fetch( - `/op/vas/create_order?signature=${signature}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - mid: selectedUser, - coins: parseInt(value.num, 10), - operator: base.b_mid.toString(), - ...base, - }), - } - ); const data = await response.json(); - console.log(data); if (data.ret === -1) { alert(data.msg); return; } - setUserInfo(data.data.account); } catch (error) { console.error(error); } @@ -342,6 +326,19 @@ const ManualRechargeAndWithdrawalContent = (props) => { > + + + diff --git a/src/pages/Op/data.jsx b/src/pages/Op/data.jsx new file mode 100644 index 0000000..0376a63 --- /dev/null +++ b/src/pages/Op/data.jsx @@ -0,0 +1,133 @@ +import React, { useState, useEffect } from "react"; +import baseRequest from "../../utils/baseRequest"; +import { DatePicker, Table } from "antd"; + +export default function Data() { + const { RangePicker } = DatePicker; + const [data, setData] = useState(); + + // 获取当前时间戳 + const currentTimestamp = Date.now(); + // 获取前2个小时的时间戳 + const oneHourAgoTimestamp = currentTimestamp - 7200000; // 1小时 = 60分钟 * 60秒 * 1000毫秒 + const [selectTime, setSelectTime] = useState({ + ct_lower_bound: oneHourAgoTimestamp, + ct_upper_bound: currentTimestamp, + }); + + useEffect(() => { + const getData = async () => { + try { + const base = baseRequest(); + const response = await fetch(`/op/daily_statement/list`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + ct_lower_bound: Math.floor(selectTime.ct_lower_bound / 1000), + ct_upper_bound: Math.floor(selectTime.ct_upper_bound / 1000), + offset: 0, + limit: 100, + ...base, + }), + }); + const _data = await response.json(); + const structedData = _data.data.list.map((item, index) => { + return { + key: index, + time: { + start: new Date(item.start_time * 1000).toLocaleString(), + end: new Date(item.end_time * 1000).toLocaleString(), + }, + h5_call_count: item.h5_call_count, + registered_user_count: item.registered_user_count, + order_created_count: item.order_created_count, + order_finished_count: item.order_finished_count, + }; + }); + setData(structedData); + if (_data.ret === -1) { + alert(_data.msg); + return; + } + } catch (error) { + console.error(error); + } + }; + getData(); + }, [selectTime]); + + const onOk = (value) => { + const startTimeStamp = value[0] && value[0].valueOf() - 60000; // 起始时间的时间戳 + const endTimeStamp = value[1] && value[1].valueOf() + 60000; // 结束时间的时间戳 + setSelectTime({ + ct_lower_bound: startTimeStamp, + ct_upper_bound: endTimeStamp, + }); + }; + + //表头 + const columns = [ + { + title: "时段", + dataIndex: "time", + key: "time", + render: (data) => { + return ( +
+

+ 开始时间: + {data.start} +

+

+ 结束时间: + {data.end} +

+
+ ); + }, + }, + { + title: "当日页面访问", + dataIndex: "h5_call_count", + key: "h5_call_count", + }, + { + title: "总注册", + dataIndex: "registered_user_count", + key: "registered_user_count", + }, + { + title: "总订单创建", + dataIndex: "order_created_count", + key: "order_created_count", + }, + { + title: "总订单完成", + dataIndex: "order_finished_count", + key: "order_finished_count", + }, + ]; + + return ( +
+

数据统计

+

请选择时段

+ + + + ); +} diff --git a/src/pages/Op/index.jsx b/src/pages/Op/index.jsx index 0caef2c..a0e4a75 100644 --- a/src/pages/Op/index.jsx +++ b/src/pages/Op/index.jsx @@ -16,6 +16,7 @@ import { import { Menu, Layout } from "antd"; import { Outlet, useNavigate, useLocation } from "react-router-dom"; import { checkAuth, signOut } from "../../utils/auth"; +import Data from "./data"; export default function Op() { const { Content, Sider } = Layout; @@ -92,11 +93,8 @@ export default function Op() { zIndex: 999, }} > -
- +
navigate("/")} className="op-logo"> +

铁粉空间运营

- {location.pathname === "/" &&

好兄弟,辛苦了!加油!奥利给!

} + {location.pathname === "/" && }