diff --git a/backend/config/settings.py b/backend/config/settings.py index 741b25b..b0ceae3 100644 --- a/backend/config/settings.py +++ b/backend/config/settings.py @@ -65,6 +65,7 @@ CORS_ALLOW_ALL_ORIGINS = True CSRF_TRUSTED_ORIGINS = [ "https://market.quant-speed.com", "http://market.quant-speed.com", + "http://localhost:8000", ] ROOT_URLCONF = 'config.urls' @@ -99,7 +100,7 @@ DATABASES = { } # 从环境变量获取数据库配置 (Docker 环境会自动注入这些变量) -DB_HOST = os.environ.get('DB_HOST', '6.6.6.66') +DB_HOST = os.environ.get('DB_HOST', '121.43.104.161') if DB_HOST: DATABASES['default'] = { 'ENGINE': 'django.db.backends.postgresql', @@ -107,7 +108,7 @@ if DB_HOST: 'USER': os.environ.get('DB_USER', 'market'), 'PASSWORD': os.environ.get('DB_PASSWORD', '123market'), 'HOST': DB_HOST, - 'PORT': os.environ.get('DB_PORT', '5432'), + 'PORT': os.environ.get('DB_PORT', '6433'), } @@ -307,6 +308,11 @@ UNFOLD = { "icon": "payment", "link": reverse_lazy("admin:shop_wechatpayconfig_changelist"), }, + { + "title": "管理员通知手机号", + "icon": "contact_phone", + "link": reverse_lazy("admin:shop_adminphonenumber_changelist"), + }, { "title": "用户认证", "icon": "security", diff --git a/backend/shop/sms_utils.py b/backend/shop/sms_utils.py index 80eb105..e6b17aa 100644 --- a/backend/shop/sms_utils.py +++ b/backend/shop/sms_utils.py @@ -95,4 +95,5 @@ def notify_user_order_shipped(order): } print(f"准备发送用户发货通知: {order.phone_number}") - send_sms(order.phone_number, "SMS_501650557", params) + #send_sms(order.phone_number, "SMS_501650557", params) + send_sms(order.phone_number, "SMS_501665569", params) \ No newline at end of file diff --git a/frontend/src/pages/ProductDetail.jsx b/frontend/src/pages/ProductDetail.jsx index bfd2634..edb3151 100644 --- a/frontend/src/pages/ProductDetail.jsx +++ b/frontend/src/pages/ProductDetail.jsx @@ -4,6 +4,7 @@ import { Button, Row, Col, Tag, Statistic, Modal, Form, Input, InputNumber, mess import { ShoppingCartOutlined, SafetyCertificateOutlined, ThunderboltOutlined, EyeOutlined, StarOutlined } from '@ant-design/icons'; import { getConfigs, createOrder, nativePay } from '../api'; import ModelViewer from '../components/ModelViewer'; +import LoginModal from '../components/LoginModal'; import { useAuth } from '../context/AuthContext'; import './ProductDetail.css'; @@ -14,10 +15,11 @@ const ProductDetail = () => { const [product, setProduct] = useState(null); const [loading, setLoading] = useState(true); const [isModalOpen, setIsModalOpen] = useState(false); + const [loginVisible, setLoginVisible] = useState(false); const [submitting, setSubmitting] = useState(false); const [form] = Form.useForm(); - const { user } = useAuth(); + const { user, login } = useAuth(); // 优先从 URL 获取,如果没有则从 localStorage 获取,不再默认绑定 flw666 const refCode = searchParams.get('ref') || localStorage.getItem('ref_code'); @@ -182,7 +184,13 @@ const ProductDetail = () => { type="primary" size="large" icon={} - onClick={() => setIsModalOpen(true)} + onClick={() => { + if (!user) { + setLoginVisible(true); + } else { + setIsModalOpen(true); + } + }} disabled={product.stock === 0} style={{ height: 50, padding: '0 40px', fontSize: 18 }} > @@ -248,6 +256,17 @@ const ProductDetail = () => { )} + {/* Login Modal */} + setLoginVisible(false)} + onLoginSuccess={(userData) => { + login(userData); + setLoginVisible(false); + setIsModalOpen(true); + }} + /> + {/* Order Modal */}