From 96a002dd02c9bd95d4a78fffdae9c43819877a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E5=8D=96=E6=8A=A5=E7=9A=84=E5=B0=8F?= =?UTF-8?q?=E8=A1=8C=E5=AE=B6?= Date: Mon, 15 Jul 2019 13:46:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=BF=85=E8=A6=81console.log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/controller/CommodityController.js | 14 +++---- project/controller/shopping_controller.js | 14 ++++--- project/dao/CommodityDao.js | 38 +++++++++---------- .../js/commodityDetails/commodityDetails.js | 3 -- project/views/XY/commodityDetails.ejs | 2 +- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/project/controller/CommodityController.js b/project/controller/CommodityController.js index 75589a7..64c9000 100644 --- a/project/controller/CommodityController.js +++ b/project/controller/CommodityController.js @@ -2,7 +2,7 @@ const CommodityModel=require("../dao/CommodityDao"); const CommodityController= { commodityDetails (req, resp) { let SPU_code=req.query.SPU_code; - console.log("SPU_code="+SPU_code); + // console.log("SPU_code="+SPU_code); CommodityModel.getcommodityDetails([SPU_code]) .then((data)=>{ // console.log(data); @@ -10,7 +10,7 @@ const CommodityController= { }); }, productList (req, resp) { - console.log(req.query); + // console.log(req.query); let code={ main_type_code:``, sub_type_id:`` @@ -23,7 +23,7 @@ const CommodityController= { code.main_type_code=req.query.main_type_code; } } - console.log(code); + // console.log(code); CommodityModel.getAllGoods(code) .then((data)=>{ // console.log(data); @@ -33,7 +33,7 @@ const CommodityController= { detailGoods(req,resp){ let detailColor=req.body.detailColor; let detailStyle=req.body.detailStyle; - console.log(req.body); + // console.log(req.body); CommodityModel.detailGoods([detailColor,detailStyle]) .then((data)=>{ // console.log("------这里是控制层-------"); @@ -44,7 +44,7 @@ const CommodityController= { datailColor(req,resp){ let detailColor=req.body.detailColor; let SPUcode=req.body.SPUcode; - console.log("这里是颜色控制"+detailColor+SPUcode); + // console.log("这里是颜色控制"+detailColor+SPUcode); CommodityModel.detailColor([SPUcode,detailColor]) .then((data)=>{ // console.log("------这里是控制层-------"); @@ -56,8 +56,8 @@ const CommodityController= { let SKUcode=req.body.SKUcode; let goodsNum=req.body.goodsNum; let userID=req.session.username; - console.log("-------------------------------"); - console.log(userID); + // console.log("-------------------------------"); + // console.log(userID); CommodityModel.joinShoppingCar([SKUcode,goodsNum,userID,]) .then((data)=>{ resp.send("添加成功"); diff --git a/project/controller/shopping_controller.js b/project/controller/shopping_controller.js index 1dbacaa..24fb554 100644 --- a/project/controller/shopping_controller.js +++ b/project/controller/shopping_controller.js @@ -23,11 +23,15 @@ const controller = { }) }, goCheckout(req, resp) { - let params = [req.session.username]; - dao.goCheckout(params) - .then((data) => { - resp.render('TYH/checkout', data); - }) + if (req.query.SKU_code) { + + }else { + let params = [req.session.username]; + dao.goCheckout(params) + .then((data) => { + resp.render('TYH/checkout', data); + }) + } }, sendAddrId(req, resp) { let paramsInsertOrder = [ diff --git a/project/dao/CommodityDao.js b/project/dao/CommodityDao.js index ba7e4aa..2d90a17 100644 --- a/project/dao/CommodityDao.js +++ b/project/dao/CommodityDao.js @@ -133,15 +133,15 @@ const CommodityDao = { sendObj.SKUsize=SKUsize; sendObj.mainData=data; if (err) { - console.log("这里是DAO错误-------"); - console.log(err); + // console.log("这里是DAO错误-------"); + console.error(err.message); } else { - console.log("这里是DAO正确-------"); - console.log(sendObj.SKUsize); + // console.log("这里是DAO正确-------"); + // console.log(sendObj.SKUsize); dbpool.connect(designer,params,(err,data)=>{ if (err) { - console.log("这里是DAO错误-------"); - console.log(err); + // console.log("这里是DAO错误-------"); + console.error(err.message); } else { // console.log("这里是DAO正确-------"); // console.log(data); @@ -178,15 +178,15 @@ const CommodityDao = { `; dbpool.connect(sql, params, (err, data) => { if (err) { - console.log("这里是商品DAO错误-------"); - console.log(err); + console.error("这里是商品DAO错误-------"); + console.error(err.message); } else { - console.log("这里是商品DAO正确-------"); - console.log(data); + // console.log("这里是商品DAO正确-------"); + // console.log(data); } resolve(data); - console.log(params); + // console.log(params); }) }) @@ -207,11 +207,11 @@ const CommodityDao = { `; dbpool.connect(sql,params,(err,data)=>{ if (err) { - console.log("这里是颜色DAO错误-------"); - console.log(err); + console.error("这里是颜色DAO错误-------"); + console.error(err.message); } else { - console.log("这里是颜色DAO正确-------"); - console.log(data); + // console.log("这里是颜色DAO正确-------"); + // console.log(data); } resolve(data); }) @@ -224,11 +224,11 @@ const CommodityDao = { VALUES (null,?,?,?,null)`; dbpool.connect(sql,params,(err,data)=>{ if (err) { - console.log("这里是加入购物车DAO错误-------"); - console.log(err); + console.error("这里是加入购物车DAO错误-------"); + console.error(err.message); } else { - console.log("这里是加入购物车DAO正确-------"); - console.log(data); + // console.log("这里是加入购物车DAO正确-------"); + // console.log(data); } }) }) diff --git a/project/public/js/commodityDetails/commodityDetails.js b/project/public/js/commodityDetails/commodityDetails.js index 09b5cd3..b7f2dbd 100644 --- a/project/public/js/commodityDetails/commodityDetails.js +++ b/project/public/js/commodityDetails/commodityDetails.js @@ -141,9 +141,6 @@ function purchaseNow() { data:{ "SKU_code":$('.detailImg img').eq(0).attr("alt"), }, - success:function (data) { - console.log(data); - }, async: false }) } diff --git a/project/views/XY/commodityDetails.ejs b/project/views/XY/commodityDetails.ejs index 2cc32de..2e2dd8a 100644 --- a/project/views/XY/commodityDetails.ejs +++ b/project/views/XY/commodityDetails.ejs @@ -69,7 +69,7 @@
- 立即购买 + 立即购买
立即下单 - -
@@ -96,4 +94,4 @@ - \ No newline at end of file + -- Gitee