| | |
| | | import com.jilongda.optometrist.authority.dto.VerificationCodeDTO; |
| | | import com.jilongda.optometrist.authority.model.SecUser; |
| | | import com.jilongda.optometrist.authority.service.SecUserService; |
| | | import com.jilongda.optometrist.model.TOptometrist; |
| | | import com.jilongda.optometrist.security.SecurityUserDetails; |
| | | import com.jilongda.optometrist.service.TOptometristService; |
| | | import com.jilongda.optometrist.utils.MsgUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private final RedisAutoTemplate redisAutoTemplate; |
| | | private final MsgUtils msgUtils; |
| | | private final SecUserService secUserService; |
| | | @Autowired |
| | | private TOptometristService optometristService; |
| | | |
| | | @Autowired |
| | | public LoginController(AuthenticationManager authenticationManager, SecurityUtils securityUtils, PasswordEncoder passwordEncoder, RedisAutoTemplate redisAutoTemplate, MsgUtils msgUtils, SecUserService secUserService) { |
| | |
| | | @ApiOperation("验光师短信登录") |
| | | @PostMapping(value = "code/login") |
| | | public ApiResult<Map<String, Object>> loginByCode(@Validated @RequestBody LoginCodeDTO dto) { |
| | | SecUser one = secUserService.lambdaQuery().eq(SecUser::getPhone, dto.getPhone()) |
| | | .eq(SecUser::getUserType, 2).one(); |
| | | TOptometrist one = optometristService.lambdaQuery().eq(TOptometrist::getPhone, dto.getPhone()).one(); |
| | | if (one==null){ |
| | | return ApiResult.failed(500, "手机号未注册"); |
| | | } |
| | | SecUser two = secUserService.lambdaQuery().eq(SecUser::getPhone, dto.getPhone()) |
| | | .eq(SecUser::getUserType, 2) |
| | | .eq(SecUser::getState,0) |
| | | TOptometrist two = optometristService.lambdaQuery().eq(TOptometrist::getPhone, dto.getPhone()) |
| | | .eq(TOptometrist::getStatus, 2) |
| | | .one(); |
| | | if (two==null){ |
| | | if (two!=null){ |
| | | return ApiResult.failed(500, "账号已被禁用"); |
| | | } |
| | | // 先检验是否登录 |