1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package com.fdkankan.ucenter.controller.app;
- import com.alibaba.fastjson.JSONObject;
- import com.fdkankan.ucenter.common.Result;
- import com.fdkankan.ucenter.service.IUserService;
- import com.fdkankan.ucenter.service.impl.AppService;
- import com.fdkankan.ucenter.service.impl.AppUserService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- @RestController
- @RequestMapping("/ucenter/app/user")
- public class AppUserController {
- @Autowired
- AppUserService appUserService;
- /**
- * 获取用户信息
- * phoneNum 用户名
- * cameraType 相机类型
- */
- @PostMapping("/getUserInfo")
- public Result getUserInfo(@RequestBody JSONObject param){
- String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
- Integer cameraType = param.get("cameraType") == null ? 4 : param.getInteger("cameraType");
- if(cameraType == 4){
- cameraType = 1;
- }
- return Result.success( appUserService.getUserInfo(phoneNum,cameraType));
- }
- /**
- * 修改昵称
- * phoneNum 用户名
- * nickName 昵称
- */
- @PostMapping("/updateNickName")
- public Result updateNickName(@RequestBody JSONObject param){
- String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
- String nickName = param.get("nickName") == null ? null : param.getString("nickName");
- appUserService.updateNickName(nickName,phoneNum);
- return Result.success(nickName );
- }
- /**
- * 修改用户头像
- * phoneNum 用户名
- * head 头像
- */
- @PostMapping("/uploadHead")
- public Result uploadHead(@RequestBody JSONObject param) throws Exception {
- String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
- String head = param.get("head") == null ? null : param.getString("head");
- appUserService.uploadHead(phoneNum,head);
- return Result.success();
- }
- }
|