Authored by 李奇

第三方登录头像修改

@@ -31,7 +31,7 @@ class expModel extends global.yoho.BaseModel { @@ -31,7 +31,7 @@ class expModel extends global.yoho.BaseModel {
31 }); 31 });
32 } 32 }
33 33
34 - friendHelp({ uid, source, openId, nickname, headIco }) { 34 + friendHelp({ uid, source, openId, nickname, headIcon }) {
35 return this.get({ 35 return this.get({
36 data: { 36 data: {
37 method: 'app.activity.friendhelp', 37 method: 'app.activity.friendhelp',
@@ -39,7 +39,7 @@ class expModel extends global.yoho.BaseModel { @@ -39,7 +39,7 @@ class expModel extends global.yoho.BaseModel {
39 source, 39 source,
40 open_id: openId, 40 open_id: openId,
41 nick_name: nickname, 41 nick_name: nickname,
42 - head_ico: headIco 42 + head_ico: headIcon
43 }, 43 },
44 api: global.yoho.API 44 api: global.yoho.API
45 }); 45 });
@@ -9,11 +9,12 @@ const utils = global.yoho.utils; @@ -9,11 +9,12 @@ const utils = global.yoho.utils;
9 const AuthHelper = require('../models/auth-helper'); 9 const AuthHelper = require('../models/auth-helper');
10 const loginPage = `${config.siteUrl}/signin.html`; 10 const loginPage = `${config.siteUrl}/signin.html`;
11 11
12 -function doPassportCallback(openId, nickname, source, req, res) { // eslint-disable-line 12 +function doPassportCallback(openId, nickname, headIcon, source, req, res) { // eslint-disable-line
13 if (openId && nickname && source) { 13 if (openId && nickname && source) {
14 req.session._THIRD_LOGIN_INFO = { 14 req.session._THIRD_LOGIN_INFO = {
15 openId, 15 openId,
16 nickname, 16 nickname,
  17 + headIcon,
17 source 18 source
18 }; 19 };
19 20
@@ -154,8 +155,9 @@ const wechat = { @@ -154,8 +155,9 @@ const wechat = {
154 callback: (req, res) => { 155 callback: (req, res) => {
155 const openId = req.query.openId; 156 const openId = req.query.openId;
156 const nickname = req.query.nickname; 157 const nickname = req.query.nickname;
  158 + const headIcon = req.query.headImg;
157 159
158 - doPassportCallback(openId, nickname, 'wechat', req, res); 160 + doPassportCallback(openId, nickname, headIcon, 'wechat', req, res);
159 } 161 }
160 }; 162 };
161 163
@@ -172,8 +174,9 @@ const sina = { @@ -172,8 +174,9 @@ const sina = {
172 callback: (req, res) => { 174 callback: (req, res) => {
173 const openId = req.query.openId; 175 const openId = req.query.openId;
174 const nickname = req.query.nickname; 176 const nickname = req.query.nickname;
  177 + const headIcon = req.query.headImg;
175 178
176 - doPassportCallback(openId, nickname, 'sina', req, res); 179 + doPassportCallback(openId, nickname, headIcon, 'sina', req, res);
177 } 180 }
178 }; 181 };
179 182
@@ -201,8 +204,9 @@ const qq = { @@ -201,8 +204,9 @@ const qq = {
201 204
202 let nickname = user.nickname; 205 let nickname = user.nickname;
203 let openId = user.id; 206 let openId = user.id;
  207 + let headIcon = user._json.figureurl_qq_2 || user._json.figureurl_2;
204 208
205 - doPassportCallback(openId, nickname, 'qq', req, res); 209 + doPassportCallback(openId, nickname, headIcon, 'qq', req, res);
206 })(req, res, next); 210 })(req, res, next);
207 } else { 211 } else {
208 log.error('Auth State Mismatch:' + req.originalUrl); 212 log.error('Auth State Mismatch:' + req.originalUrl);