AppUserController.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package com.fdkankan.ucenter.controller.app;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.fdkankan.ucenter.common.Result;
  4. import com.fdkankan.ucenter.service.IUserService;
  5. import com.fdkankan.ucenter.service.impl.AppService;
  6. import com.fdkankan.ucenter.service.impl.AppUserService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. @RestController
  13. @RequestMapping("/ucenter/app/user")
  14. public class AppUserController {
  15. @Autowired
  16. AppUserService appUserService;
  17. /**
  18. * 获取用户信息
  19. * phoneNum 用户名
  20. * cameraType 相机类型
  21. */
  22. @PostMapping("/getUserInfo")
  23. public Result getUserInfo(@RequestBody JSONObject param){
  24. String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
  25. Integer cameraType = param.get("cameraType") == null ? 4 : param.getInteger("cameraType");
  26. if(cameraType == 4){
  27. cameraType = 1;
  28. }
  29. return Result.success( appUserService.getUserInfo(phoneNum,cameraType));
  30. }
  31. /**
  32. * 修改昵称
  33. * phoneNum 用户名
  34. * nickName 昵称
  35. */
  36. @PostMapping("/updateNickName")
  37. public Result updateNickName(@RequestBody JSONObject param){
  38. String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
  39. String nickName = param.get("nickName") == null ? null : param.getString("nickName");
  40. appUserService.updateNickName(nickName,phoneNum);
  41. return Result.success(nickName );
  42. }
  43. /**
  44. * 修改用户头像
  45. * phoneNum 用户名
  46. * head 头像
  47. */
  48. @PostMapping("/uploadHead")
  49. public Result uploadHead(@RequestBody JSONObject param) throws Exception {
  50. String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
  51. String head = param.get("head") == null ? null : param.getString("head");
  52. appUserService.uploadHead(phoneNum,head);
  53. return Result.success();
  54. }
  55. }