update pay ui

This commit is contained in:
2025-12-13 18:08:48 +08:00
parent 0060911e41
commit 4ccbb09067
3 changed files with 83 additions and 33 deletions

View File

@@ -1,12 +1,12 @@
# ============================================================================
# 110.42.32.207 Nginx 配置
# API 服务- 处理所有后API 和代理请
# API 服务<EFBFBD>?- 处理所有后<EFBFBD>?API 和代理请<EFBFBD>?
#
# 部署步骤
# 部署步骤<EFBFBD>?
# 1. 上传到服务器: scp nginx-110.42.32.207.conf ubuntu@110.42.32.207:/tmp/
# 2. 复制配置: sudo cp /tmp/nginx-110.42.32.207.conf /etc/nginx/sites-available/api.conf
# 3. 启用配置: sudo ln -s /etc/nginx/sites-available/api.conf /etc/nginx/sites-enabled/
# 4. 申请证书: sudo certbot --nginx -d api.valuefrontier.cn (或使用其他方式)
# 4. 申请证书: sudo certbot --nginx -d api.valuefrontier.cn (或使用其他方<EFBFBD>?
# 5. 测试重载: sudo nginx -t && sudo systemctl reload nginx
# ============================================================================
@@ -42,10 +42,10 @@ server {
# SSL 证书配置
# 方式1: 使用 IP 证书(需要购买)
# 方式2: 使用自签名证书CDN 回源可以配置HTTP
# 方式2: 使用自签名证书CDN 回源可以配置<EFBFBD>?HTTP<EFBFBD>?
# 方式3: 如果有域名指向这台服务器,用 Let's Encrypt
#
# 临时使用自签名证书(生产环境建议使用正式证书:
# 临时使用自签名证书(生产环境建议使用正式证书<EFBFBD>?
# sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
# -keyout /etc/nginx/ssl/server.key \
# -out /etc/nginx/ssl/server.crt \
@@ -60,7 +60,7 @@ server {
ssl_session_timeout 1d;
# ============================================
# CORS 配置(允CDN 域名访问
# CORS 配置(允<EFBFBD>?CDN 域名访问<EFBFBD>?
# ============================================
set $cors_origin 'https://valuefrontier.cn';
@@ -71,7 +71,7 @@ server {
# }
# ============================================
# Flask API 代理(本gunicorn
# Flask API 代理(本<EFBFBD>?gunicorn<EFBFBD>?
# ============================================
location /api/ {
# 处理 OPTIONS 预检请求
@@ -84,13 +84,11 @@ server {
add_header 'Content-Length' 0;
return 204;
}
# 隐藏后端返回的 CORS 头(避免重复)
proxy_hide_header 'Access-Control-Allow-Origin';
proxy_hide_header 'Access-Control-Allow-Credentials';
proxy_hide_header 'Access-Control-Allow-Methods';
proxy_hide_header 'Access-Control-Allow-Headers';
proxy_hide_header 'Access-Control-Expose-Headers';
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://127.0.0.1:5001;
proxy_http_version 1.1;
@@ -100,7 +98,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
# 统一添加 CORS
# 统一添加 CORS <EFBFBD>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
@@ -216,6 +214,13 @@ server {
return 204;
}
# 隐藏后端返回<E8BF94>?CORS 头避免重复<E9878D>?
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://222.128.1.157:16801/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -223,6 +228,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 统一添加 CORS <20>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
@@ -233,6 +239,24 @@ server {
# Elasticsearch API
location /es-api/ {
# 处理 OPTIONS 预检请求
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Max-Age' 86400;
add_header 'Content-Length' 0;
return 204;
}
# 隐藏后端返回<E8BF94>?CORS 头避免重复<E9878D>?
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://222.128.1.157:19200/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -240,15 +264,10 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 统一添加 CORS <20>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
if ($request_method = 'OPTIONS') {
return 204;
}
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
@@ -268,6 +287,13 @@ server {
return 204;
}
# 隐藏后端返回<E8BF94>?CORS 头避免重复<E9878D>?
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://222.128.1.157:21891/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -275,6 +301,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 统一添加 CORS <20>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
@@ -296,6 +323,13 @@ server {
return 204;
}
# 隐藏后端返回<E8BF94>?CORS 头避免重复<E9878D>?
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://222.128.1.157:8811/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -303,6 +337,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 统一添加 CORS <20>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
@@ -313,6 +348,24 @@ server {
# 商品分类 API
location /category-api/ {
# 处理 OPTIONS 预检请求
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Max-Age' 86400;
add_header 'Content-Length' 0;
return 204;
}
# 隐藏后端返回<E8BF94>?CORS 头避免重复<E9878D>?
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
proxy_pass http://222.128.1.157:18827/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -320,13 +373,9 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 统一添加 CORS <20>?
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
if ($request_method = 'OPTIONS') {
return 204;
}
add_header 'Access-Control-Allow-Credentials' 'true' always;
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
@@ -553,7 +602,7 @@ server {
}
# ============================================
# 健康检
# 健康检<EFBFBD>?
# ============================================
location /health {
return 200 'ok';

View File

@@ -6,6 +6,7 @@ import React, { useEffect, useRef, useState, useMemo } from 'react';
import { Box, Spinner, Center, Text } from '@chakra-ui/react';
import * as echarts from 'echarts';
import type { ECharts, EChartsOption } from 'echarts';
import { getApiBase } from '@utils/apiConfig';
import type { MiniTimelineChartProps, TimelineDataPoint } from '../types';
@@ -82,8 +83,8 @@ const MiniTimelineChart: React.FC<MiniTimelineChartProps> = ({
try {
const apiPath = isIndex
? `/api/index/${code}/kline?type=minute`
: `/api/stock/${code}/kline?type=minute`;
? `${getApiBase()}/api/index/${code}/kline?type=minute`
: `${getApiBase()}/api/stock/${code}/kline?type=minute`;
const response = await fetch(apiPath);
const result: KLineApiResponse = await response.json();

View File

@@ -180,7 +180,7 @@ const StockOverview = () => {
const fetchTopConcepts = async (date = null) => {
setLoadingConcepts(true);
try {
const url = date ? `/api/concepts/daily-top?limit=6&date=${date}` : '/api/concepts/daily-top?limit=6';
const url = date ? `${getApiBase()}/api/concepts/daily-top?limit=6&date=${date}` : `${getApiBase()}/api/concepts/daily-top?limit=6`;
const response = await fetch(url);
const data = await response.json();
@@ -223,7 +223,7 @@ const StockOverview = () => {
const fetchHeatmapData = async (date = null) => {
setLoadingHeatmap(true);
try {
const url = date ? `/api/market/heatmap?limit=500&date=${date}` : '/api/market/heatmap?limit=500';
const url = date ? `${getApiBase()}/api/market/heatmap?limit=500&date=${date}` : `${getApiBase()}/api/market/heatmap?limit=500`;
const response = await fetch(url);
const data = await response.json();
@@ -255,7 +255,7 @@ const StockOverview = () => {
// 获取市场统计数据
const fetchMarketStats = async (date = null) => {
try {
const url = date ? `/api/market/statistics?date=${date}` : '/api/market/statistics';
const url = date ? `${getApiBase()}/api/market/statistics?date=${date}` : `${getApiBase()}/api/market/statistics`;
const response = await fetch(url);
const data = await response.json();