Skip to content

Commit

Permalink
添加清除位置信息功能
Browse files Browse the repository at this point in the history
  • Loading branch information
weiyuc committed May 7, 2018
1 parent 6c57eff commit 23b4402
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ public WebChatResponse<?> getNearbyPeoples(@RequestBody Point location) {
List<CoordinateEntity> nearbyPeoples = userService.getNearbyPeoples(location);
return WebChatResponse.success(nearbyPeoples);
}


@PostMapping("/clearLocation")
public WebChatResponse<?> clearLocation() {
userService.clearLocation();
return WebChatResponse.success();
}

@GetMapping("/getProfilePhoto/{username}")
public void getProfilePhoto(@PathVariable("username") String username, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ public interface CoordinateRepository extends CrudRepository<CoordinateEntity, S

CoordinateEntity findByUsername(String username);

int deleteByUsername(String username);

}
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,12 @@ public List<CoordinateEntity> getNearbyPeoples(Point location) {

}

/**
* 清除位置信息
*/
public void clearLocation() {
String username = UserService.getCurrentUsername();
coordinateRepository.deleteByUsername(username);
}

}

0 comments on commit 23b4402

Please sign in to comment.