...
|
...
|
@@ -75,26 +75,26 @@ const cart = (req, res, next) => { |
|
|
*/
|
|
|
const cartAdd = () => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
let uid = req.user.uid;
|
|
|
let shoppingKey = helper.getShoppingKeyByCookie(req);
|
|
|
let productSku = req.body.productSku;
|
|
|
let buyNumber = req.body.buyNumber || 1;
|
|
|
let goodsType = req.body.goodsType || 0;
|
|
|
let promotionId = req.body.promotionId || 0
|
|
|
let promotionId = req.body.promotionId || 0;
|
|
|
let isEdit = req.body.isEdit || 0;
|
|
|
|
|
|
let result = yield service.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey);
|
|
|
|
|
|
// 设置加入购物车凭证到客户端浏览器
|
|
|
if(!shoppingKey && result && result.data && result.data.shopping_key) {
|
|
|
if (!shoppingKey && result && result.data && result.data.shopping_key) {
|
|
|
// req.cookies['_SPK'] = result.data.shopping_key
|
|
|
//$this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);
|
|
|
// $this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);
|
|
|
}
|
|
|
|
|
|
// 老站购物车需要的COOKIE
|
|
|
if (result && result.data && result.data.shopping_key) {
|
|
|
/*$this->setCookie('_g', json_encode(array(
|
|
|
/* $this->setCookie('_g', json_encode(array(
|
|
|
'_k' => $result['data']['shopping_key'],
|
|
|
'_nac' => $result['data']['goods_count'],
|
|
|
'_ac' => 0,
|
...
|
...
|
@@ -111,7 +111,7 @@ const cartAdd = () => { |
|
|
*/
|
|
|
const cartTotal = () => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
|
|
|
let uid = req.user.uid;
|
|
|
let shoppingKey = helper.getShoppingKeyByCookie(req);
|
...
|
...
|
@@ -169,7 +169,7 @@ const modifyProduct = (req, res) => { |
|
|
*/
|
|
|
const removeProduct = (req, res) => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
let uid = req.user.uid;
|
|
|
let shoppingKey = helper.getShoppingKeyByCookie(req);
|
|
|
let skuList = req.body.skuList;
|
...
|
...
|
@@ -177,7 +177,7 @@ const removeProduct = (req, res) => { |
|
|
|
|
|
let ret = yield service.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
|
|
|
|
|
|
if(ret && ret.code === 200) {
|
|
|
if (ret && ret.code === 200) {
|
|
|
yield setShoppingCookie();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -191,15 +191,16 @@ const removeProduct = (req, res) => { |
|
|
*/
|
|
|
const moveToFav = (req, res) => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
let uid = req.user.uid;
|
|
|
|
|
|
// let shoppingKey = helper.getShoppingKeyByCookie(req);
|
|
|
let skuList = req.body.skuList;
|
|
|
let hasPromotion = req.body.hasPromotion || false;
|
|
|
|
|
|
let ret = yield service.addToFav(uid, skuList, hasPromotion);
|
|
|
|
|
|
if(ret && ret.code === 200) {
|
|
|
if (ret && ret.code === 200) {
|
|
|
yield setShoppingCookie();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -212,7 +213,7 @@ const moveToFav = (req, res) => { |
|
|
*/
|
|
|
const checkFav = (req, res) => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
|
|
|
let uid = req.user.uid;
|
|
|
let pids = req.body.pidList;
|
...
|
...
|
@@ -233,10 +234,11 @@ const checkFav = (req, res) => { |
|
|
*/
|
|
|
const getTogetherProduct = (req, res) => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
|
|
|
let page = req.query.page;
|
|
|
/*let ret = {
|
|
|
|
|
|
/* let ret = {
|
|
|
code: 200,
|
|
|
message: '凑单商品'
|
|
|
};*/
|
...
|
...
|
@@ -252,14 +254,14 @@ const getTogetherProduct = (req, res) => { |
|
|
*/
|
|
|
const getRecommendProductAction = (req, res) => {
|
|
|
|
|
|
co(function * (){
|
|
|
co(function * () {
|
|
|
|
|
|
let channel = req.yoho.channel;
|
|
|
let uid = req.user.uid;
|
|
|
let udid = ghelper.getUdid(req, res);
|
|
|
let page = req.query.page;
|
|
|
|
|
|
if(page === '6') {
|
|
|
if (page === '6') {
|
|
|
page = 1;
|
|
|
}
|
|
|
|
...
|
...
|
|