1
|
'use strict';
|
1
|
'use strict';
|
2
|
|
2
|
|
3
|
const shopModel = require('../models/shopCollect'),
|
3
|
const shopModel = require('../models/shopCollect'),
|
4
|
- headerModel = require('../../../doraemon/models/header');
|
4
|
+ headerModel = require('../../../doraemon/models/header'),
|
|
|
5
|
+ _ = require('lodash');
|
5
|
|
6
|
|
6
|
const crypto = global.yoho.crypto;
|
7
|
const crypto = global.yoho.crypto;
|
7
|
|
8
|
|
8
|
const shopIndex = (req, res) => {
|
9
|
const shopIndex = (req, res) => {
|
9
|
let isApp = req.query.app_version || req.query.appVersion || false;
|
10
|
let isApp = req.query.app_version || req.query.appVersion || false;
|
10
|
- let uid = req.user.uid;
|
11
|
+ let uid = req.user.uid || req.query.uid;
|
11
|
let parameter = {};
|
12
|
let parameter = {};
|
12
|
|
13
|
|
13
|
if (!isApp) {
|
14
|
if (!isApp) {
|
|
@@ -17,7 +18,7 @@ const shopIndex = (req, res) => { |
|
@@ -17,7 +18,7 @@ const shopIndex = (req, res) => { |
17
|
})
|
18
|
})
|
18
|
};
|
19
|
};
|
19
|
} else {
|
20
|
} else {
|
20
|
- uid = crypto.encryption('', req.query.uid + '');
|
21
|
+ uid = crypto.encryption('', uid + '');
|
21
|
parameter = {
|
22
|
parameter = {
|
22
|
appVersion: true,
|
23
|
appVersion: true,
|
23
|
uid: uid
|
24
|
uid: uid
|
|
@@ -47,7 +48,7 @@ const shopNav = (req, res, next) => { |
|
@@ -47,7 +48,7 @@ const shopNav = (req, res, next) => { |
47
|
|
48
|
|
48
|
|
49
|
|
49
|
const shopList = (req, res, next) => {
|
50
|
const shopList = (req, res, next) => {
|
50
|
- let uid = req.query.uid || req.user.uid || '';
|
51
|
+ let uid = req.query.uid ? _.trim(crypto.decrypt('', req.query.uid)) : req.user.uid;
|
51
|
let tabName = req.query.tabName;
|
52
|
let tabName = req.query.tabName;
|
52
|
|
53
|
|
53
|
shopModel.shopList(uid, tabName).then((result) => {
|
54
|
shopModel.shopList(uid, tabName).then((result) => {
|
|
@@ -57,7 +58,7 @@ const shopList = (req, res, next) => { |
|
@@ -57,7 +58,7 @@ const shopList = (req, res, next) => { |
57
|
|
58
|
|
58
|
// 获取文章收藏状态
|
59
|
// 获取文章收藏状态
|
59
|
const shopFav = (req, res, next) => {
|
60
|
const shopFav = (req, res, next) => {
|
60
|
- let uid = req.query.uid || req.user.uid || '';
|
61
|
+ let uid = req.query.uid ? _.trim(crypto.decrypt('', req.query.uid)) : req.user.uid;
|
61
|
let shopIds = req.query.shopIds;
|
62
|
let shopIds = req.query.shopIds;
|
62
|
|
63
|
|
63
|
shopModel.shopFav(uid, shopIds).then((result) => {
|
64
|
shopModel.shopFav(uid, shopIds).then((result) => {
|