auth登录接口
parent
f21632aeda
commit
9b30e365ca
|
@ -2,6 +2,7 @@ package doctor.auth.controller;
|
|||
|
||||
import doctor.auth.service.HealthService;
|
||||
import doctor.auth.vo.DoctorUserVo;
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.common.security.service.TokenService;
|
||||
import doctor.system.api.model.LoginUser;
|
||||
|
@ -21,9 +22,13 @@ public class HealthController {
|
|||
private HealthService healthService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public R<?> login(@RequestParam String email,String pwd) {
|
||||
public HealthR<?> login(@RequestParam String email, @RequestParam String pwd) {
|
||||
DoctorUserVo userInfo = healthService.login(email,pwd);
|
||||
return R.ok(userInfo);
|
||||
if (userInfo!=null){
|
||||
return HealthR.ok(userInfo);
|
||||
}else {
|
||||
return HealthR.fail();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ public class HealthService {
|
|||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (s.equals(data.getSysUser().getPassword())){
|
||||
Map<String, Object> token = tokenService.createToken(data);
|
||||
String accessToken = (String) token.get("access_token");
|
||||
doctorUserVo.setSessionId(accessToken);
|
||||
|
@ -44,4 +45,6 @@ public class HealthService {
|
|||
}
|
||||
return doctorUserVo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/doctor")
|
||||
@DS("slave")
|
||||
@DS("master")
|
||||
public class SysDoctorController {
|
||||
|
||||
@Autowired
|
||||
|
|
Loading…
Reference in New Issue