Authored by zhangxiaoru

shop uid

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');
  6 +const crypto = global.yoho.crypto;
5 7
6 const shopIndex = (req, res) => { 8 const shopIndex = (req, res) => {
7 let isApp = req.query.app_version || req.query.appVersion || false; 9 let isApp = req.query.app_version || req.query.appVersion || false;
8 -  
9 - // let uid = req.user.uid; 10 + let uid = req.user.uid;
10 let parameter = {}; 11 let parameter = {};
11 12
12 if (!isApp) { 13 if (!isApp) {
@@ -15,6 +16,12 @@ const shopIndex = (req, res) => { @@ -15,6 +16,12 @@ const shopIndex = (req, res) => {
15 navTitle: '店铺收藏' 16 navTitle: '店铺收藏'
16 }) 17 })
17 }; 18 };
  19 + } else {
  20 + uid = crypto.encryption('', req.query.uid + ''),
  21 + parameter = {
  22 + appVersion: true,
  23 + uid: uid
  24 + };
18 } 25 }
19 26
20 shopModel.banner().then((result) => { 27 shopModel.banner().then((result) => {
@@ -39,7 +46,7 @@ const shopNav = (req, res, next) => { @@ -39,7 +46,7 @@ const shopNav = (req, res, next) => {
39 46
40 47
41 const shopList = (req, res, next) => { 48 const shopList = (req, res, next) => {
42 - let uid = req.user.uid; 49 + let uid = req.query.uid || req.user.uid || '';
43 let tabName = req.query.tabName; 50 let tabName = req.query.tabName;
44 51
45 shopModel.shopList(uid, tabName).then((result) => { 52 shopModel.shopList(uid, tabName).then((result) => {
@@ -11,4 +11,6 @@ @@ -11,4 +11,6 @@
11 11
12 </div> 12 </div>
13 {{/ shopCollect}} 13 {{/ shopCollect}}
  14 +<input type="hidden" name="app_version" value="{{appVersion}}">
  15 +<input type="hidden" name="uid" value="{{uid}}">
14 </div> 16 </div>
@@ -10,7 +10,10 @@ var searching, @@ -10,7 +10,10 @@ var searching,
10 shopId, 10 shopId,
11 stoping, 11 stoping,
12 navSwiper, 12 navSwiper,
13 - navType; 13 + bannerSwiper,
  14 + navType,
  15 + appVersion = $('input[name="app_version"]').val(),
  16 + uid = $('input[name="uid"]').val();
14 17
15 var shopNav = require('shopCollect/shop-nav.hbs'), 18 var shopNav = require('shopCollect/shop-nav.hbs'),
16 shopList = require('shopCollect/shop-list.hbs'); 19 shopList = require('shopCollect/shop-list.hbs');
@@ -31,7 +34,8 @@ function shopListData(tabName, stoping) { @@ -31,7 +34,8 @@ function shopListData(tabName, stoping) {
31 method: 'get', 34 method: 'get',
32 url: '/activity/shopList', 35 url: '/activity/shopList',
33 data: { 36 data: {
34 - tabName: tabName 37 + tabName: tabName,
  38 + uid: window.queryString.uid
35 }, 39 },
36 success: function(data) { 40 success: function(data) {
37 41
@@ -68,6 +72,8 @@ function shopListData(tabName, stoping) { @@ -68,6 +72,8 @@ function shopListData(tabName, stoping) {
68 id: shopId, 72 id: shopId,
69 opt: opt, 73 opt: opt,
70 type: 'shop', 74 type: 'shop',
  75 + uid: uid,
  76 + appVersion: appVersion
71 }, 77 },
72 xhrFields: { 78 xhrFields: {
73 withCredentials: true 79 withCredentials: true
@@ -100,7 +100,7 @@ function inputAction() { @@ -100,7 +100,7 @@ function inputAction() {
100 var i; 100 var i;
101 101
102 if (data.length > 0) { 102 if (data.length > 0) {
103 - console.log(data.length); 103 +
104 for (i = 0; i < data.length; i++) { 104 for (i = 0; i < data.length; i++) {
105 ajaxHtml += '<li><span class="keyword">' + data[i].keyword + '</span><span class="count">' + 105 ajaxHtml += '<li><span class="keyword">' + data[i].keyword + '</span><span class="count">' +
106 data[i].count + ' items<i class="iconfont">&#xe614;</i></span></li>'; 106 data[i].count + ' items<i class="iconfont">&#xe614;</i></span></li>';