添加一个查询用户主页信息的接口

This commit is contained in:
daihh
2022-10-28 17:07:48 +08:00
parent 5afd363c94
commit 51241e6347

View File

@@ -86,6 +86,37 @@ public class UserApi extends ApiBaseController {
return success(page);
}
/**
* 用户主页信息
* @param aid
* @return
*/
@RequestMapping(value="/home",method = {RequestMethod.POST,RequestMethod.GET})
public JsonResponse<Map<String,Object>> home(String aid) {
if(StringUtils.isBlank(aid)) {
aid=getCurrent().getAccountId();
}
if(StringUtils.isBlank(aid)) {
return badRequest("无查询参数");
}
Map<String,Object> map=new HashMap<String,Object>();
//map.put("aid", aid);
try {
User u = userService.get(aid);
if(u!=null) {
map.put("showHome",u.getShowHome()==null ? true: u.getShowHome());
}else {
return badRequest("用户不存在");
}
return success(map);
}catch(Exception e) {
log.error("查询用户错误",e);
return error("查询用户失败",e.getMessage());
}
}
@RequestMapping(value="/find",method = {RequestMethod.POST,RequestMethod.GET})
public JsonResponse<List<User>> findByNameOrCode(String word) {
if(StringUtils.isBlank(word)) {