退出登录

master
yechenhao 6 years ago
parent 10ba37d477
commit a25b7bc43c

@ -120,8 +120,8 @@ public class LoginServiceImpl implements LoginService {
if (!isMD5){
password = MD5FileUtil.getMD5String(password);
}
UsernamePasswordToken token = new UsernamePasswordToken(login, password, false);
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(login, password, true);
try {
subject.login(token);

@ -7,9 +7,12 @@ import com.kiisoo.ic.store.entity.PoiStoreStaff;
import com.kiisoo.ic.store.entity.StoreUserDTO;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
import com.kiisoo.ic.webappmy.service.WebAppService;
import com.kiisoo.ic.webappmy.vo.StafferInfoVO;
import com.kiisoo.ic.webappmy.vo.UserParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -32,6 +35,9 @@ public class WebAppMyController extends BaseController {
@Autowired
private PrivilageCpUserStoreDOMapper privilageCpUserStoreDOMapper;
@Autowired
private WebAppService webAppService;
/**
*
*/
@ -102,6 +108,9 @@ public class WebAppMyController extends BaseController {
@PostMapping(value = "/login/quit")
public Map<String,Object> webAppUserQuitLogin(@RequestBody UserParam param){
try {
Subject subject = SecurityUtils.getSubject();
webAppService.unbindAccount(param.getUserId());
subject.logout();
return data(param.getUserId());
}catch (Exception e){
log.error("退出登入异常",e);

@ -0,0 +1,27 @@
package com.kiisoo.ic.webappmy.service;
import com.kiisoo.ic.system.enums.AccountEnum;
import com.kiisoo.ic.system.mapper.PrivilageAccountDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* -service
* Created by hc on 2020/4/26
*/
@Service
public class WebAppService {
@Autowired
private PrivilageAccountDOMapper privilageAccountDOMapper;
public void unbindAccount(long userId) {
Map<String,Object> params = new HashMap<>();
params.put("user_id",userId);
params.put("type", AccountEnum.ACCOUNT_TYPE_QYWX.getType());
privilageAccountDOMapper.deleteByMap(params);
}
}

@ -243,7 +243,7 @@ public class QWMailListManageService {
* @throws WxErrorException
*/
public String getCpUserIdByCode(String code) throws WxErrorException {
wxCpService = WxCpConfiguration.getCpService(1000043);
wxCpService = WxCpConfiguration.getCpService(1);
WxCpMaJsCode2SessionResult wxCpMaJsCode2SessionResult = wxCpService.jsCode2Session(code);
return wxCpMaJsCode2SessionResult.getUserId();
}

Loading…
Cancel
Save