Authored by 郭成尧

uid-handle

@@ -59,7 +59,7 @@ const collectArticle = (req, res, next) => { @@ -59,7 +59,7 @@ const collectArticle = (req, res, next) => {
59 /* 判断用户是否登录 */ 59 /* 判断用户是否登录 */
60 let id = req.body.id, 60 let id = req.body.id,
61 opt = req.body.opt || 'ok', 61 opt = req.body.opt || 'ok',
62 - uid = req.body.uid; 62 + uid = req.user.uid;
63 63
64 /* 判断是不是登录成功 */ 64 /* 判断是不是登录成功 */
65 if (!uid) { 65 if (!uid) {
@@ -112,7 +112,7 @@ const favoriteBrand = (req, res, next) => { @@ -112,7 +112,7 @@ const favoriteBrand = (req, res, next) => {
112 /* 判断参数是否有效 */ 112 /* 判断参数是否有效 */
113 let id = req.body.id, 113 let id = req.body.id,
114 opt = req.body.opt || 'ok', 114 opt = req.body.opt || 'ok',
115 - uid = req.user.uid || (req.body.uid && parseInt(req.body.uid, 10)) || req.cookies.appUid, 115 + uid = req.user.uid,
116 isBrand = req.body.isBrand; 116 isBrand = req.body.isBrand;
117 117
118 if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) { 118 if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) {
@@ -105,18 +105,12 @@ exports.indexRedirect = (req, res) => { @@ -105,18 +105,12 @@ exports.indexRedirect = (req, res) => {
105 105
106 exports.userSkn = (req, res, next) => { 106 exports.userSkn = (req, res, next) => {
107 let isApp = req.body.app_version || req.body.appVersion || false; 107 let isApp = req.body.app_version || req.body.appVersion || false;
108 - let uid = ''; 108 + let uid = req.user.uid;
109 let param = {}; 109 let param = {};
110 let skns = req.body.skns || ''; 110 let skns = req.body.skns || '';
111 111
112 skns = skns.split(',') || []; 112 skns = skns.split(',') || [];
113 113
114 - if (req.yoho.isApp) {  
115 - uid = req.body.uid;  
116 - } else {  
117 - uid = req.user.uid;  
118 - }  
119 -  
120 if (uid) { 114 if (uid) {
121 param.uid = uid; 115 param.uid = uid;
122 param.content_code = req.body.code || ''; 116 param.content_code = req.body.code || '';
@@ -134,19 +134,11 @@ exports.getDetailData = (req, res, next) => { @@ -134,19 +134,11 @@ exports.getDetailData = (req, res, next) => {
134 * [品牌详情异步数据] 134 * [品牌详情异步数据]
135 */ 135 */
136 exports.getDetailDataAsync = (req, res, next) => { 136 exports.getDetailDataAsync = (req, res, next) => {
137 - let uid; 137 + let uid = req.user.uid;
138 let udid = req.sessionID || 'yoho'; 138 let udid = req.sessionID || 'yoho';
139 let brandId = req.body.brand_id || 0; 139 let brandId = req.body.brand_id || 0;
140 let isApp = req.body.isApp || false; 140 let isApp = req.body.isApp || false;
141 141
142 - if (isApp) {  
143 - if (req.body.uid) {  
144 - uid = parseInt(req.body.uid, 10);  
145 - }  
146 - } else {  
147 - uid = req.user.uid;  
148 - }  
149 -  
150 if (!brandId) { 142 if (!brandId) {
151 return res.json({code: 400, message: '参数错误'}); 143 return res.json({code: 400, message: '参数错误'});
152 } 144 }
@@ -274,13 +274,12 @@ const remind = (req, res) => { @@ -274,13 +274,12 @@ const remind = (req, res) => {
274 on_off: req.body.on_off === 'true' ? true : false, 274 on_off: req.body.on_off === 'true' ? true : false,
275 activity_id: Number.parseInt(req.body.activity_id, 10), 275 activity_id: Number.parseInt(req.body.activity_id, 10),
276 product_skn: Number.parseInt(req.body.product_skn, 10), 276 product_skn: Number.parseInt(req.body.product_skn, 10),
277 - uid: Number.parseInt(req.body.uid, 10), 277 + uid: req.user.uid,
278 sec_kill_id: Number.parseInt(req.body.sec_kill_id, 10), 278 sec_kill_id: Number.parseInt(req.body.sec_kill_id, 10),
279 app_type: 0 279 app_type: 0
280 - })  
281 - .then(result => {  
282 - return res.json(result);  
283 - }); 280 + }).then(result => {
  281 + return res.json(result);
  282 + });
284 }; 283 };
285 284
286 // Middleware:检测 app_version 是否正确 285 // Middleware:检测 app_version 是否正确