Authored by OF1706

m

@@ -75,26 +75,26 @@ const cart = (req, res, next) => { @@ -75,26 +75,26 @@ const cart = (req, res, next) => {
75 */ 75 */
76 const cartAdd = () => { 76 const cartAdd = () => {
77 77
78 - co(function * (){ 78 + co(function * () {
79 let uid = req.user.uid; 79 let uid = req.user.uid;
80 let shoppingKey = helper.getShoppingKeyByCookie(req); 80 let shoppingKey = helper.getShoppingKeyByCookie(req);
81 let productSku = req.body.productSku; 81 let productSku = req.body.productSku;
82 let buyNumber = req.body.buyNumber || 1; 82 let buyNumber = req.body.buyNumber || 1;
83 let goodsType = req.body.goodsType || 0; 83 let goodsType = req.body.goodsType || 0;
84 - let promotionId = req.body.promotionId || 0 84 + let promotionId = req.body.promotionId || 0;
85 let isEdit = req.body.isEdit || 0; 85 let isEdit = req.body.isEdit || 0;
86 86
87 let result = yield service.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey); 87 let result = yield service.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey);
88 88
89 // 设置加入购物车凭证到客户端浏览器 89 // 设置加入购物车凭证到客户端浏览器
90 - if(!shoppingKey && result && result.data && result.data.shopping_key) { 90 + if (!shoppingKey && result && result.data && result.data.shopping_key) {
91 // req.cookies['_SPK'] = result.data.shopping_key 91 // req.cookies['_SPK'] = result.data.shopping_key
92 - //$this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360); 92 + // $this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);
93 } 93 }
94 94
95 // 老站购物车需要的COOKIE 95 // 老站购物车需要的COOKIE
96 if (result && result.data && result.data.shopping_key) { 96 if (result && result.data && result.data.shopping_key) {
97 - /*$this->setCookie('_g', json_encode(array( 97 + /* $this->setCookie('_g', json_encode(array(
98 '_k' => $result['data']['shopping_key'], 98 '_k' => $result['data']['shopping_key'],
99 '_nac' => $result['data']['goods_count'], 99 '_nac' => $result['data']['goods_count'],
100 '_ac' => 0, 100 '_ac' => 0,
@@ -111,7 +111,7 @@ const cartAdd = () => { @@ -111,7 +111,7 @@ const cartAdd = () => {
111 */ 111 */
112 const cartTotal = () => { 112 const cartTotal = () => {
113 113
114 - co(function * (){ 114 + co(function * () {
115 115
116 let uid = req.user.uid; 116 let uid = req.user.uid;
117 let shoppingKey = helper.getShoppingKeyByCookie(req); 117 let shoppingKey = helper.getShoppingKeyByCookie(req);
@@ -169,7 +169,7 @@ const modifyProduct = (req, res) => { @@ -169,7 +169,7 @@ const modifyProduct = (req, res) => {
169 */ 169 */
170 const removeProduct = (req, res) => { 170 const removeProduct = (req, res) => {
171 171
172 - co(function * (){ 172 + co(function * () {
173 let uid = req.user.uid; 173 let uid = req.user.uid;
174 let shoppingKey = helper.getShoppingKeyByCookie(req); 174 let shoppingKey = helper.getShoppingKeyByCookie(req);
175 let skuList = req.body.skuList; 175 let skuList = req.body.skuList;
@@ -177,7 +177,7 @@ const removeProduct = (req, res) => { @@ -177,7 +177,7 @@ const removeProduct = (req, res) => {
177 177
178 let ret = yield service.removeFromCart(uid, shoppingKey, skuList, hasPromotion); 178 let ret = yield service.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
179 179
180 - if(ret && ret.code === 200) { 180 + if (ret && ret.code === 200) {
181 yield setShoppingCookie(); 181 yield setShoppingCookie();
182 } 182 }
183 183
@@ -191,15 +191,16 @@ const removeProduct = (req, res) => { @@ -191,15 +191,16 @@ const removeProduct = (req, res) => {
191 */ 191 */
192 const moveToFav = (req, res) => { 192 const moveToFav = (req, res) => {
193 193
194 - co(function * (){ 194 + co(function * () {
195 let uid = req.user.uid; 195 let uid = req.user.uid;
  196 +
196 // let shoppingKey = helper.getShoppingKeyByCookie(req); 197 // let shoppingKey = helper.getShoppingKeyByCookie(req);
197 let skuList = req.body.skuList; 198 let skuList = req.body.skuList;
198 let hasPromotion = req.body.hasPromotion || false; 199 let hasPromotion = req.body.hasPromotion || false;
199 200
200 let ret = yield service.addToFav(uid, skuList, hasPromotion); 201 let ret = yield service.addToFav(uid, skuList, hasPromotion);
201 202
202 - if(ret && ret.code === 200) { 203 + if (ret && ret.code === 200) {
203 yield setShoppingCookie(); 204 yield setShoppingCookie();
204 } 205 }
205 206
@@ -212,7 +213,7 @@ const moveToFav = (req, res) => { @@ -212,7 +213,7 @@ const moveToFav = (req, res) => {
212 */ 213 */
213 const checkFav = (req, res) => { 214 const checkFav = (req, res) => {
214 215
215 - co(function * (){ 216 + co(function * () {
216 217
217 let uid = req.user.uid; 218 let uid = req.user.uid;
218 let pids = req.body.pidList; 219 let pids = req.body.pidList;
@@ -233,10 +234,11 @@ const checkFav = (req, res) => { @@ -233,10 +234,11 @@ const checkFav = (req, res) => {
233 */ 234 */
234 const getTogetherProduct = (req, res) => { 235 const getTogetherProduct = (req, res) => {
235 236
236 - co(function * (){ 237 + co(function * () {
237 238
238 let page = req.query.page; 239 let page = req.query.page;
239 - /*let ret = { 240 +
  241 + /* let ret = {
240 code: 200, 242 code: 200,
241 message: '凑单商品' 243 message: '凑单商品'
242 };*/ 244 };*/
@@ -252,14 +254,14 @@ const getTogetherProduct = (req, res) => { @@ -252,14 +254,14 @@ const getTogetherProduct = (req, res) => {
252 */ 254 */
253 const getRecommendProductAction = (req, res) => { 255 const getRecommendProductAction = (req, res) => {
254 256
255 - co(function * (){ 257 + co(function * () {
256 258
257 let channel = req.yoho.channel; 259 let channel = req.yoho.channel;
258 let uid = req.user.uid; 260 let uid = req.user.uid;
259 let udid = ghelper.getUdid(req, res); 261 let udid = ghelper.getUdid(req, res);
260 let page = req.query.page; 262 let page = req.query.page;
261 263
262 - if(page === '6') { 264 + if (page === '6') {
263 page = 1; 265 page = 1;
264 } 266 }
265 267