Authored by ccbikai

优化用户信息获取

@@ -190,6 +190,12 @@ exports.getFilterData = (params) => { @@ -190,6 +190,12 @@ exports.getFilterData = (params) => {
190 }; 190 };
191 191
192 const getUserProfile = (uid) => { 192 const getUserProfile = (uid) => {
  193 + if (!uid) {
  194 + return Promise.resolve({
  195 + code: 200,
  196 + data: {}
  197 + });
  198 + }
193 return api.get('', sign.apiSign({ 199 return api.get('', sign.apiSign({
194 method: 'app.passport.profile', 200 method: 'app.passport.profile',
195 uid: uid 201 uid: uid
@@ -211,7 +217,7 @@ exports.getSearchData = (params, uid) => { @@ -211,7 +217,7 @@ exports.getSearchData = (params, uid) => {
211 }), 217 }),
212 getUserProfile(uid).then((result) => { 218 getUserProfile(uid).then((result) => {
213 if (result && result.code === 200) { 219 if (result && result.code === 200) {
214 - return camelCase(result.data.vip_info); 220 + return result.data.vip_info ? camelCase(result.data.vip_info) : {};
215 } else { 221 } else {
216 logger.error('获取用户信息返回 code 不是 200'); 222 logger.error('获取用户信息返回 code 不是 200');
217 return {}; 223 return {};