| | |
| | | return loginResponse; |
| | | } |
| | | |
| | | public LoginResponse wxOpenIdLogin(String wxOpenId, String phone, CustomerUserTypeEnum userType) { |
| | | public LoginResponse wxOpenIdLogin(String wxOpenId, String phone, String workerNo, CustomerUserTypeEnum userType) { |
| | | // 查询用户信息 |
| | | Wrapper wrapper = Wrappers.<Customer>lambdaQuery() |
| | | .eq(Customer::getUserType, userType.getCode()) |
| | | .eq(Customer::getWxOpenId, wxOpenId); |
| | | Customer customer = customerService.getOne(wrapper, false); |
| | | |
| | | if (customer == null && StrUtil.isNotBlank(phone)) { |
| | | // 判断手机号是否注册 |
| | | Wrapper phonewrapper = Wrappers.<Customer>lambdaQuery() |
| | | .eq(Customer::getUserType, userType.getCode()) |
| | | .eq(Customer::getAccount, phone) |
| | | .last("LIMIT 1"); |
| | | customer = customerService.getOne(phonewrapper, false); |
| | | if (customer != null) { |
| | | // 更新微信openId |
| | | customerService.update( |
| | | Wrappers.<Customer>lambdaUpdate() |
| | | .set(Customer::getWxOpenId, wxOpenId) |
| | | .eq(Customer::getCustomerId, customer.getCustomerId()) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 账号不存在时,判断是否去注册 |
| | | assertAccountNoExistToReg(customer, userType, phone, wxOpenId); |
| | |
| | | // 可能已经注册的用户,再获取一次用户 |
| | | customer = customerService.getOne(wrapper, false); |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(workerNo)) { |
| | | // 绑定顾问岗位ID数据 |
| | | customerService.userBindClassConsultWorkerId(customer.getCustomerId(), workerNo); |
| | | } |
| | | |
| | | // 用户登录信息 |
| | | LoginResponse loginResponse = customerService.wrapperLoginResponse(customer, new LoginRequest()); |
| | | return loginResponse; |