This commit is contained in:
@@ -65,6 +65,7 @@ CORS_ALLOW_ALL_ORIGINS = True
|
|||||||
CSRF_TRUSTED_ORIGINS = [
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
"https://market.quant-speed.com",
|
"https://market.quant-speed.com",
|
||||||
"http://market.quant-speed.com",
|
"http://market.quant-speed.com",
|
||||||
|
"http://localhost:8000",
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'config.urls'
|
ROOT_URLCONF = 'config.urls'
|
||||||
@@ -99,7 +100,7 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# 从环境变量获取数据库配置 (Docker 环境会自动注入这些变量)
|
# 从环境变量获取数据库配置 (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:
|
if DB_HOST:
|
||||||
DATABASES['default'] = {
|
DATABASES['default'] = {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
@@ -107,7 +108,7 @@ if DB_HOST:
|
|||||||
'USER': os.environ.get('DB_USER', 'market'),
|
'USER': os.environ.get('DB_USER', 'market'),
|
||||||
'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
|
'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
|
||||||
'HOST': DB_HOST,
|
'HOST': DB_HOST,
|
||||||
'PORT': os.environ.get('DB_PORT', '5432'),
|
'PORT': os.environ.get('DB_PORT', '6433'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -307,6 +308,11 @@ UNFOLD = {
|
|||||||
"icon": "payment",
|
"icon": "payment",
|
||||||
"link": reverse_lazy("admin:shop_wechatpayconfig_changelist"),
|
"link": reverse_lazy("admin:shop_wechatpayconfig_changelist"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "管理员通知手机号",
|
||||||
|
"icon": "contact_phone",
|
||||||
|
"link": reverse_lazy("admin:shop_adminphonenumber_changelist"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "用户认证",
|
"title": "用户认证",
|
||||||
"icon": "security",
|
"icon": "security",
|
||||||
|
|||||||
@@ -95,4 +95,5 @@ def notify_user_order_shipped(order):
|
|||||||
}
|
}
|
||||||
|
|
||||||
print(f"准备发送用户发货通知: {order.phone_number}")
|
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)
|
||||||
@@ -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 { ShoppingCartOutlined, SafetyCertificateOutlined, ThunderboltOutlined, EyeOutlined, StarOutlined } from '@ant-design/icons';
|
||||||
import { getConfigs, createOrder, nativePay } from '../api';
|
import { getConfigs, createOrder, nativePay } from '../api';
|
||||||
import ModelViewer from '../components/ModelViewer';
|
import ModelViewer from '../components/ModelViewer';
|
||||||
|
import LoginModal from '../components/LoginModal';
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
import './ProductDetail.css';
|
import './ProductDetail.css';
|
||||||
|
|
||||||
@@ -14,10 +15,11 @@ const ProductDetail = () => {
|
|||||||
const [product, setProduct] = useState(null);
|
const [product, setProduct] = useState(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
|
const [loginVisible, setLoginVisible] = useState(false);
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const { user } = useAuth();
|
const { user, login } = useAuth();
|
||||||
|
|
||||||
// 优先从 URL 获取,如果没有则从 localStorage 获取,不再默认绑定 flw666
|
// 优先从 URL 获取,如果没有则从 localStorage 获取,不再默认绑定 flw666
|
||||||
const refCode = searchParams.get('ref') || localStorage.getItem('ref_code');
|
const refCode = searchParams.get('ref') || localStorage.getItem('ref_code');
|
||||||
@@ -182,7 +184,13 @@ const ProductDetail = () => {
|
|||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
icon={<ShoppingCartOutlined />}
|
icon={<ShoppingCartOutlined />}
|
||||||
onClick={() => setIsModalOpen(true)}
|
onClick={() => {
|
||||||
|
if (!user) {
|
||||||
|
setLoginVisible(true);
|
||||||
|
} else {
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
disabled={product.stock === 0}
|
disabled={product.stock === 0}
|
||||||
style={{ height: 50, padding: '0 40px', fontSize: 18 }}
|
style={{ height: 50, padding: '0 40px', fontSize: 18 }}
|
||||||
>
|
>
|
||||||
@@ -248,6 +256,17 @@ const ProductDetail = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Login Modal */}
|
||||||
|
<LoginModal
|
||||||
|
visible={loginVisible}
|
||||||
|
onClose={() => setLoginVisible(false)}
|
||||||
|
onLoginSuccess={(userData) => {
|
||||||
|
login(userData);
|
||||||
|
setLoginVisible(false);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Order Modal */}
|
{/* Order Modal */}
|
||||||
<Modal
|
<Modal
|
||||||
title="填写收货信息"
|
title="填写收货信息"
|
||||||
|
|||||||
Reference in New Issue
Block a user