package com.panzhihua.service_user.api;
|
|
import com.panzhihua.common.model.vos.LoginUserInfoVO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.common.model.vos.user.ChangePasswordVO;
|
import com.panzhihua.service_user.service.UserService;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @program: springcloud_k8s_panzhihuazhihuishequ
|
* @description: 用户
|
* @author: huang.hongfa weixin hhf9596 qq 959656820
|
* @create: 2020-11-24 09:00
|
**/
|
@RestController("/")
|
public class UserApi {
|
@Resource
|
private UserService userService;
|
|
/**
|
* 新增微信用户
|
* @param openid 微信小程序标志
|
* @param sessionKey 会话密钥
|
* @param unionid 微信平台唯一ID
|
* @return 新增结果
|
*/
|
@PostMapping("/addOrUpdate")
|
public R addOrUpdate(@RequestParam("openid") String openid, @RequestParam("sessionKey")String sessionKey, @RequestParam("unionid")String unionid){
|
return userService.updateInsertUser(openid,sessionKey,unionid);
|
}
|
|
/**
|
* 维护小程序用户基本信息 头像 昵称 性别
|
* @param userId 数据库用户ID
|
* @param nickName 昵称
|
* @param gender 性别
|
* @param avatarUrl 头像
|
* @return 维护结果
|
*/
|
@PostMapping("/updateUserWeiXinInfo")
|
public R updateUserWeiXinInfo(@RequestParam("userId")Long userId, @RequestParam("nickName")String nickName, @RequestParam("gender")int gender, @RequestParam("avatarUrl")String avatarUrl){
|
return userService.updateUserWeiXinInfo(userId,nickName,gender,avatarUrl);
|
}
|
|
/**
|
* 维护微信用户手机号
|
* @param userId 数据库ID
|
* @param purePhoneNumber 没有区号的手机号
|
* @return 维护结果
|
*/
|
@PostMapping("/updateUserWeiXinPhone")
|
public R updateUserWeiXinPhone(@RequestParam("userId")Long userId, @RequestParam("purePhoneNumber")String purePhoneNumber){
|
return userService.updateUserWeiXinPhone(userId,purePhoneNumber);
|
}
|
|
/**
|
* 获取平台用户
|
* @param userName 登录账户+_type
|
* @return 平台用户信息
|
*/
|
@PostMapping("/getUserInfo")
|
public R<LoginUserInfoVO> getUserInfo(@RequestParam("userName") String userName){
|
int index = userName.indexOf("_");
|
String type = userName.substring(index+1, userName.length());
|
String name = userName.substring(0, userName.indexOf("_"));
|
return userService.getUserInfo(name,Integer.parseInt(type));
|
}
|
|
/**
|
* 获取平台用户
|
* @param userId 用户ID
|
* @return 平台用户信息
|
*/
|
@PostMapping("/getUserInfoUserId")
|
public R<LoginUserInfoVO> getUserInfoByUserId(@RequestParam("userId") String userId){
|
return userService.getUserInfo(userId);
|
}
|
|
/**
|
* 修改用户登录密码
|
* @param changePasswordVO 新密码
|
* @return 修改结果
|
*/
|
@PostMapping("changepassword")
|
public R changePassword(@RequestBody ChangePasswordVO changePasswordVO){
|
return userService.changePassword(changePasswordVO);
|
}
|
|
/**
|
* 某社区后台人员查询
|
* @param param 名字
|
* @param communityId 社区id
|
* @return 人员集合
|
*/
|
@PostMapping("listactivitymanager")
|
public R listActivityManager(@RequestParam("param") String param, @RequestParam("communityId")Long communityId){
|
return userService.listActivityManager(param,communityId);
|
}
|
|
|
}
|