Пример #1
0
 @RequestMapping("save")
 @ResponseBody
 public Object save(String friendId) {
   if (StringUtils.isEmpty(friendId)) {
     return new Result(500);
   }
   return friendService.saveFriend(friendId);
 }
Пример #2
0
 @ResponseBody
 @RequestMapping("list")
 public Object listAll() {
   Friend friend = new Friend();
   Account account = new Account(AccountUtils.getAccount().getId());
   friend.setOwner(account);
   List<Friend> list = friendService.findList(friend, false, "owner");
   return list;
 }
Пример #3
0
  @ResponseBody
  @RequestMapping("checkfriend")
  public Object checkFriend(String friendId) {
    Account account = new Account(AccountUtils.getAccount().getId());
    if (friendId.equals(account.getId())) {
      return "{\"type\":0}"; // 自己
    }
    Friend friend = new Friend();
    friend.setOwner(account);
    friend.setFriend(new Account(friendId));
    List<Friend> list = friendService.findList(friend, false, "owner", "friend");
    if (list != null && list.size() > 0) {
      return "{\"type\":1}"; // 自己的好友
    }

    return "{\"type\":2}"; // 不是好友
  }