@@ -123,6 +123,7 @@ public static void register() {
123123 Dispatcher .get ("/api/user/exists/{user}" , apiProcessor ::userExists );
124124 Dispatcher .post ("/api/getKey" , apiProcessor ::getKey );
125125 Dispatcher .get ("/api/user" , apiProcessor ::getUser );
126+ Dispatcher .get ("/api/user/getInfoById" , apiProcessor ::getUserInfoById );
126127 Dispatcher .get ("/api/user/recentReg" , apiProcessor ::getRecentReg );
127128
128129 final RewardQueryService rewardQueryService = beanManager .getReference (RewardQueryService .class );
@@ -399,6 +400,32 @@ public void getUser(final RequestContext context) {
399400 }
400401 }
401402
403+
404+ /**
405+ * 根据用户id查询信息
406+ */
407+ public void getUserInfoById (final RequestContext context ) {
408+ JSONObject ret = new JSONObject ();
409+ try {
410+ JSONObject user = userQueryService .getUser (context .param ("userId" ));
411+ final JSONObject filteredUserProfile = new JSONObject ();
412+ filteredUserProfile .put (User .USER_NAME , user .optString (User .USER_NAME ));
413+ filteredUserProfile .put (UserExt .USER_NICKNAME , user .optString (UserExt .USER_NICKNAME ));
414+ filteredUserProfile .put (UserExt .USER_AVATAR_URL , user .optString (UserExt .USER_AVATAR_URL ));
415+
416+ ret .put (Keys .CODE , StatusCodes .SUCC );
417+ ret .put (Keys .MSG , "" );
418+ ret .put (Keys .DATA , filteredUserProfile );
419+ context .renderJSON (ret );
420+ } catch (Exception e ) {
421+ ret .put (Keys .CODE , StatusCodes .ERR );
422+ ret .put (Keys .MSG , "Query user error" );
423+ context .renderJSON (ret );
424+ }
425+ }
426+
427+
428+
402429 /**
403430 * 获取最近注册的20个鱼油 只需要用户名和昵称吧
404431 * @param context
0 commit comments