Authored by zhangxiaoru

shop

'use strict';
const shopModel = require('../models/shopCollect'),
headerModel = require('../../../doraemon/models/header');
headerModel = require('../../../doraemon/models/header'),
_ = require('lodash');
const crypto = global.yoho.crypto;
const shopIndex = (req, res) => {
let isApp = req.query.app_version || req.query.appVersion || false;
let uid = req.user.uid;
let uid = req.user.uid || req.query.uid;
let parameter = {};
if (!isApp) {
... ... @@ -17,7 +18,7 @@ const shopIndex = (req, res) => {
})
};
} else {
uid = crypto.encryption('', req.query.uid + '');
uid = crypto.encryption('', uid + '');
parameter = {
appVersion: true,
uid: uid
... ... @@ -47,7 +48,7 @@ const shopNav = (req, res, next) => {
const shopList = (req, res, next) => {
let uid = req.query.uid || req.user.uid || '';
let uid = req.query.uid ? _.trim(crypto.decrypt('', req.query.uid)) : req.user.uid;
let tabName = req.query.tabName;
shopModel.shopList(uid, tabName).then((result) => {
... ... @@ -57,7 +58,7 @@ const shopList = (req, res, next) => {
// 获取文章收藏状态
const shopFav = (req, res, next) => {
let uid = req.query.uid || req.user.uid || '';
let uid = req.query.uid ? _.trim(crypto.decrypt('', req.query.uid)) : req.user.uid;
let shopIds = req.query.shopIds;
shopModel.shopFav(uid, shopIds).then((result) => {
... ...
... ... @@ -390,8 +390,11 @@ const favoriteBrand = (req, res, next) => {
let url = helpers.urlFormat('/signin.html') + '?refer=' + refer;
if (appVersion && appVersion !== 'false') {
uid = req.query.uid ? crypto.decrypt('', req.query.uid) : req.cookies.appUid;
uid = _.trim(uid);
if (!uid || uid === 'undefined') {
uid = _getUidFromUserAgent(req);
... ...
... ... @@ -119,7 +119,7 @@ function shopListData(tabName, stoping) {
id: shopId,
opt: opt,
type: 'shop',
uid: uid,
uid: window.queryString.uid || uid,
appVersion: appVersion
},
xhrFields: {
... ...