This commit is contained in:
dzl
2025-09-24 15:45:49 +08:00
parent 658ff89c6a
commit 0388f3b0e7
4 changed files with 24 additions and 2 deletions

2
.env
View File

@@ -5,7 +5,7 @@ DB_PASSWORD=5fYhw8z6T62b7heS
DB_NAME=maov2
# JWT密钥
JWT_SECRET=your_jwt_secret_key
JWT_SECRET=NINGBOJURONGkejiyouxiangongsi202
# 阿里云短信服务配置
# 请在阿里云控制台获取以下配置信息:

View File

@@ -43,7 +43,7 @@ router.get('/', async (req, res) => {
// 获取商品列表
const query = `
SELECT id, name, rongdou_price, category, points_price, stock, image_url as image, description, status, payment_methods, created_at, updated_at
SELECT id, name, rongdou_price, category, points_price, stock, sales, image_url as image, description, status, payment_methods, created_at, updated_at
FROM products
${whereClause}
ORDER BY created_at DESC

19
routes/shopbackend.js Normal file
View File

@@ -0,0 +1,19 @@
const express = require('express');
const router = express.Router();
const { auth } = require('../middleware/auth');
router.get('/', auth, async (req, res) => {
try {
res.json({
success: true,
data: {
text: '123'
}
});
console.log(req)
} catch (error) {
res.status(500).json({ error: 'Internal server error' });
}
});
module.exports = router;

View File

@@ -249,6 +249,9 @@ app.use('/api/announcements', require('./routes/announcements')); // 通知公
app.use('/api/wechat-pay', require('./routes/wechatPay')); // 只保留微信支付
app.use('/api/payment', require('./routes/payment'));
// 商城后台相关接口
app.use('/api/shopbackend', require('./routes/shopbackend'));
// 前端路由 - 必须在最后作为fallback
app.get('/', (req, res) => {
res.removeHeader('Origin-Agent-Cluster');