新增注销接口
This commit is contained in:
parent
ae3520859d
commit
5438a82f8d
|
|
@ -56,6 +56,15 @@ public class UsersAction {
|
|||
}
|
||||
return userService.register(registerParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注销
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/v3/deregister.do","deregister.do"},method=RequestMethod.POST)
|
||||
public JsonResult<?> deregister(Integer userId) {
|
||||
return userService.deregister(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
|
|
|
|||
|
|
@ -137,6 +137,10 @@ public class User implements Serializable{
|
|||
@Column(name = "wechat_unionid")
|
||||
private String wechatUnionid;
|
||||
|
||||
//状态 0正常 1注销
|
||||
@Column(name = "status")
|
||||
private int status;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
|
|
@ -302,4 +306,12 @@ public class User implements Serializable{
|
|||
public void setWechatUnionid(String wechatUnionid) {
|
||||
this.wechatUnionid = wechatUnionid;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import java.time.Instant;
|
|||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.criterion.Criterion;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
|
@ -92,6 +94,12 @@ public class UserHelper implements UserHelperI {
|
|||
@Autowired
|
||||
private Destination ifish7PushQueueDestination;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String pwd = "366b8eb3ba593f627567a06ebe0279e2";
|
||||
|
||||
System.out.println(DigestUtils.md5Hex(pwd));
|
||||
}
|
||||
|
||||
/**
|
||||
* 登陆接口
|
||||
*
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SmsNumSend {
|
|||
public static void main(String[] args) {
|
||||
Integer code = (int) (Math.random() * 9000 + 1000);
|
||||
SmsNumSend smsNumSend = new SmsNumSend();
|
||||
boolean b = smsNumSend.sendSmsNum("17520491562", String.valueOf(code), "注册验证", "SMS_720018");
|
||||
boolean b = smsNumSend.sendSmsNum("18521303581", String.valueOf(code), "身份验证", "SMS_720016");
|
||||
System.out.println(b);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,9 @@ public interface UserService {
|
|||
* @return
|
||||
*/
|
||||
public JsonResult<?> register(RegisterParam registerParam);
|
||||
|
||||
|
||||
JsonResult<?> deregister(Integer userId);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param user
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class BaseServiceImpl implements BaseService {
|
|||
else if (sendType.equals(SendTypeEnum.findpwd.getKey())) {
|
||||
if (user != null) {
|
||||
//手机号存在,获取验证码
|
||||
return sendSecurityCode(phoneNumber, SmsSignEnum.sign5.getValue(), SmsTemplateEnum.SMS_720021.getKey());
|
||||
return sendSecurityCode(phoneNumber, SmsSignEnum.sign5.getValue(), SmsTemplateEnum.SMS_720016.getKey());
|
||||
} else {
|
||||
//手机号不存在,发送错误码
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ public class UserServiceImpl implements UserService {
|
|||
//手机号
|
||||
String phoneNumber = loginParam.getPhoneNumber();
|
||||
//用户信息
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("phoneNumber",phoneNumber));
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("phoneNumber",phoneNumber), Restrictions.eq("status", 0));
|
||||
//用户不存在
|
||||
if(user==null){
|
||||
throw new IfishException(ResultEnum.warn202);
|
||||
|
|
@ -311,7 +311,7 @@ public class UserServiceImpl implements UserService {
|
|||
//微信头像
|
||||
String headimgurl = wechatUserInfo.getString("headimgurl");
|
||||
//用户信息
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",wechatUserInfo.getString("unionid")));
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",wechatUserInfo.getString("unionid")), Restrictions.eq("status", 0));
|
||||
if (user == null) {
|
||||
user = new User();
|
||||
user.setWechatUnionid(wechatUserInfo.getString("unionid"));
|
||||
|
|
@ -408,7 +408,7 @@ public class UserServiceImpl implements UserService {
|
|||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
//用户信息
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",unionId));
|
||||
User user = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",unionId), Restrictions.eq("status", 0));
|
||||
if (user == null) {
|
||||
throw new IfishException(ResultEnum.fail101);
|
||||
}
|
||||
|
|
@ -482,11 +482,11 @@ public class UserServiceImpl implements UserService {
|
|||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
//用户信息
|
||||
User userWechat = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",unionId));
|
||||
User userWechat = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",unionId), Restrictions.eq("status", 0));
|
||||
if (userWechat == null) {
|
||||
throw new IfishException(ResultEnum.fail101);
|
||||
}
|
||||
User userPhone = userDao.findUniqueByProperty(Restrictions.eq("phoneNumber",phone));
|
||||
User userPhone = userDao.findUniqueByProperty(Restrictions.eq("phoneNumber",phone), Restrictions.eq("status", 0));
|
||||
if (userPhone == null) {
|
||||
userWechat.setPhoneNumber(phone);
|
||||
userWechat.setUserPassword(password);
|
||||
|
|
@ -776,7 +776,18 @@ public class UserServiceImpl implements UserService {
|
|||
return new JsonResult<String>(ResultEnum.success.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JsonResult<?> deregister(Integer userId) {
|
||||
//用户信息
|
||||
User user = userDao.get(userId);
|
||||
if(user==null){
|
||||
throw new IfishException(ResultEnum.error402);
|
||||
}
|
||||
user.setStatus(1);
|
||||
return new JsonResult<String>(ResultEnum.success.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResult<?> updateInfo(User user){
|
||||
//用户ID
|
||||
|
|
|
|||
Loading…
Reference in New Issue