diff --git a/.env b/.env index 067bfb4..39e2c22 100644 --- a/.env +++ b/.env @@ -5,7 +5,7 @@ DB_PASSWORD=5fYhw8z6T62b7heS DB_NAME=maov2 # JWT密钥 -JWT_SECRET=your_jwt_secret_key +JWT_SECRET=NINGBOJURONGkejiyouxiangongsi202 # 阿里云短信服务配置 # 请在阿里云控制台获取以下配置信息: diff --git a/routes/products.js b/routes/products.js index a06b7d2..4ca7751 100644 --- a/routes/products.js +++ b/routes/products.js @@ -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 diff --git a/routes/shopbackend.js b/routes/shopbackend.js new file mode 100644 index 0000000..715a647 --- /dev/null +++ b/routes/shopbackend.js @@ -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; \ No newline at end of file diff --git a/server.js b/server.js index 240399a..61eeb6c 100644 --- a/server.js +++ b/server.js @@ -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');