Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3e3cbf84b | ||
|
|
0aee11d824 | ||
|
|
fcf358a768 | ||
|
|
619369104c | ||
|
|
4f1408b9d0 | ||
|
|
029eea70cc | ||
|
|
22b1e65385 | ||
|
|
2170c48763 | ||
|
|
c2d1c48aae | ||
|
|
e14958c643 | ||
|
|
da288338cd | ||
|
|
ea430f2468 | ||
|
|
f76f79744a | ||
|
|
19daaff907 | ||
|
|
db94d8f932 | ||
|
|
53618fe362 | ||
|
|
523edffc4e | ||
|
|
c7ddb1a8b0 | ||
|
|
45c9fc814a | ||
|
|
407dc13ac4 | ||
|
|
0c06bf16c2 | ||
|
|
1db39e77d3 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.15</version>
|
<version>1.0.14</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
@@ -167,16 +167,6 @@
|
|||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>e2ins_nexus</id>
|
|
||||||
<url>https://nexus.e2ins.com/repository/maven-public/</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -235,11 +225,6 @@
|
|||||||
<groupId>org.flywaydb</groupId>
|
<groupId>org.flywaydb</groupId>
|
||||||
<artifactId>flyway-mysql</artifactId>
|
<artifactId>flyway-mysql</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.e2ins.ms.notify</groupId>
|
|
||||||
<artifactId>e2ins-msg-notify-service-sdk</artifactId>
|
|
||||||
<version>0.0.9</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.imyeyu.api.config;
|
package com.imyeyu.api.config;
|
||||||
|
|
||||||
import com.e2ins.ms.notify.SmsNotifyService;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.MapperFeature;
|
import com.fasterxml.jackson.databind.MapperFeature;
|
||||||
@@ -32,12 +31,6 @@ public class BeanConfig {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public SmsNotifyService smsNotifyService() {
|
|
||||||
// TODO
|
|
||||||
return new SmsNotifyService(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Yaml yaml() {
|
public Yaml yaml() {
|
||||||
return new Yaml();
|
return new Yaml();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class GaoUserInviteCache {
|
|||||||
/// 发起邀请的用户 ID
|
/// 发起邀请的用户 ID
|
||||||
private String inviterUserId;
|
private String inviterUserId;
|
||||||
|
|
||||||
/// 门店 ID,GLOBAL_MANAGER 可为空
|
/// 门店 ID
|
||||||
private String storeId;
|
private String storeId;
|
||||||
|
|
||||||
/// 角色 ID
|
/// 角色 ID
|
||||||
|
|||||||
@@ -62,9 +62,7 @@ public class GaoEventController {
|
|||||||
@RequireGaoPermission(GaoPermissionCode.EVENT_READ)
|
@RequireGaoPermission(GaoPermissionCode.EVENT_READ)
|
||||||
@PostMapping("/detail")
|
@PostMapping("/detail")
|
||||||
public GaoEvent detail(@RequestParam String id) {
|
public GaoEvent detail(@RequestParam String id) {
|
||||||
GaoEvent event = service.get(id);
|
return service.get(id);
|
||||||
event.setRoleCodeList(service.listRoleCode(event.getId()));
|
|
||||||
return event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
|
|||||||
+1
-1
@@ -221,7 +221,7 @@ public class GaoEventServiceImplement extends AbstractEntityService<GaoEvent, St
|
|||||||
TimiException.required(event.getValueUnit(), "NUMBER 事件必须配置数值单位");
|
TimiException.required(event.getValueUnit(), "NUMBER 事件必须配置数值单位");
|
||||||
}
|
}
|
||||||
if (TimiJava.isNotEmpty(event.getLimitType()) && event.getLimitType() != GaoEvent.LimitType.NONE) {
|
if (TimiJava.isNotEmpty(event.getLimitType()) && event.getLimitType() != GaoEvent.LimitType.NONE) {
|
||||||
TimiException.requiredTrue(event.getLimitType().getMin() <= event.getLimitValue(), "约束值最低 %s".formatted(event.getLimitType().getMin()));
|
TimiException.requiredTrue(event.getLimitType().getMin() < event.getLimitValue(), "约束值最低 %s".formatted(event.getLimitType().getMin()));
|
||||||
}
|
}
|
||||||
if (event.getBeginAt() != null || event.getEndAt() != null) {
|
if (event.getBeginAt() != null || event.getEndAt() != null) {
|
||||||
TimiException.requiredTrue(event.getBeginAt() == null || event.getEndAt() == null || event.getBeginAt() <= event.getEndAt(), "invalid beginAt or endAt");
|
TimiException.requiredTrue(event.getBeginAt() == null || event.getEndAt() == null || event.getBeginAt() <= event.getEndAt(), "invalid beginAt or endAt");
|
||||||
|
|||||||
+12
-36
@@ -1,6 +1,5 @@
|
|||||||
package com.imyeyu.api.modules.gao.service.implement;
|
package com.imyeyu.api.modules.gao.service.implement;
|
||||||
|
|
||||||
import com.imyeyu.api.bean.CoreRoleCode;
|
|
||||||
import com.imyeyu.api.bean.ModuleCode;
|
import com.imyeyu.api.bean.ModuleCode;
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.modules.gao.bean.GaoUserInviteCache;
|
import com.imyeyu.api.modules.gao.bean.GaoUserInviteCache;
|
||||||
@@ -97,36 +96,30 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
String inviterUserId = userLoginService.getRequireLoginUserId();
|
String inviterUserId = userLoginService.getRequireLoginUserId();
|
||||||
logger.setUserId(inviterUserId);
|
logger.setUserId(inviterUserId);
|
||||||
permissionChecker.checkAny(ModuleCode.GAO, GaoPermissionCode.USER_CREATE.getValue());
|
permissionChecker.checkAny(ModuleCode.GAO, GaoPermissionCode.USER_CREATE.getValue());
|
||||||
Role requestedRole = roleService.get(req.getRoleId());
|
|
||||||
boolean adminInviteGlobalManager = roleChecker.hasAny(ModuleCode.CORE, CoreRoleCode.ADMIN.name())
|
|
||||||
&& isGlobalManagerRole(requestedRole);
|
|
||||||
boolean globalManager = authorizationScopeService.isSystemAdmin(inviterUserId)
|
boolean globalManager = authorizationScopeService.isSystemAdmin(inviterUserId)
|
||||||
|| roleChecker.hasAny(ModuleCode.GAO, GaoRoleCode.GLOBAL_MANAGER.name());
|
|| roleChecker.hasAny(ModuleCode.GAO, GaoRoleCode.GLOBAL_MANAGER.name());
|
||||||
boolean storeManager = !globalManager;
|
boolean storeManager = !globalManager;
|
||||||
GaoStore loginStore = storeManager ? gaoStoreService.getByUserId(inviterUserId) : null;
|
GaoStore loginStore = storeManager ? gaoStoreService.getByUserId(inviterUserId) : null;
|
||||||
String storeId = adminInviteGlobalManager ? null : storeManager ? loginStore == null ? null : loginStore.getId() : req.getStoreId();
|
String storeId = storeManager ? loginStore == null ? null : loginStore.getId() : req.getStoreId();
|
||||||
if (!adminInviteGlobalManager) {
|
|
||||||
TimiException.required(storeId, "not found storeId");
|
TimiException.required(storeId, "not found storeId");
|
||||||
checkStoreScope(inviterUserId, storeId);
|
checkStoreScope(inviterUserId, storeId);
|
||||||
}
|
|
||||||
if (storeId != null) {
|
GaoStore store = requireActiveStore(storeId);
|
||||||
requireActiveStore(storeId);
|
|
||||||
}
|
|
||||||
Role role = requireInvitableRole(inviterUserId, req.getRoleId(), storeId);
|
Role role = requireInvitableRole(inviterUserId, req.getRoleId(), storeId);
|
||||||
long createdAt = Time.now();
|
long createdAt = Time.now();
|
||||||
long expireAt = createdAt + INVITE_TTL;
|
long expireAt = createdAt + INVITE_TTL;
|
||||||
|
|
||||||
GaoUserInviteCache cache = new GaoUserInviteCache();
|
GaoUserInviteCache cache = new GaoUserInviteCache();
|
||||||
cache.setInviterUserId(inviterUserId);
|
cache.setInviterUserId(inviterUserId);
|
||||||
cache.setStoreId(storeId);
|
cache.setStoreId(store.getId());
|
||||||
cache.setRoleId(role.getId());
|
cache.setRoleId(role.getId());
|
||||||
cache.setScene(adminInviteGlobalManager ? "CORE_ADMIN" : storeManager ? "STORE_MANAGER" : "STORE_MANAGEMENT");
|
cache.setScene(storeManager ? "STORE_MANAGER" : "STORE_MANAGEMENT");
|
||||||
cache.setCreatedAt(createdAt);
|
cache.setCreatedAt(createdAt);
|
||||||
cache.setExpireAt(expireAt);
|
cache.setExpireAt(expireAt);
|
||||||
String code = saveInvite(cache);
|
String code = saveInvite(cache);
|
||||||
|
|
||||||
logger.setContent("storeId=%s;roleId=%s;scene=%s;createdAt=%d;expireAt=%d".formatted(
|
logger.setContent("storeId=%s;roleId=%s;scene=%s;createdAt=%d;expireAt=%d".formatted(
|
||||||
storeId, role.getId(), cache.getScene(), createdAt, expireAt));
|
store.getId(), role.getId(), cache.getScene(), createdAt, expireAt));
|
||||||
logger.setResult("created");
|
logger.setResult("created");
|
||||||
return new GaoUserInviteCreateResponse(code, expireAt);
|
return new GaoUserInviteCreateResponse(code, expireAt);
|
||||||
} catch (TimiException e) {
|
} catch (TimiException e) {
|
||||||
@@ -148,7 +141,8 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
TimiException.required(code, "not found code");
|
TimiException.required(code, "not found code");
|
||||||
checkCodeRateLimit(code);
|
checkCodeRateLimit(code);
|
||||||
GaoUserInviteCache cache = requireValidInvite(code);
|
GaoUserInviteCache cache = requireValidInvite(code);
|
||||||
validateInviteTarget(cache);
|
requireActiveStore(cache.getStoreId());
|
||||||
|
requireValidRole(cache.getRoleId(), cache.getStoreId());
|
||||||
return new GaoUserInviteValidateResponse(true, cache.getExpireAt());
|
return new GaoUserInviteValidateResponse(true, cache.getExpireAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +163,8 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
try {
|
try {
|
||||||
cache = requireValidInvite(code);
|
cache = requireValidInvite(code);
|
||||||
logger.setContent(buildLogContent(cache));
|
logger.setContent(buildLogContent(cache));
|
||||||
validateInviteTarget(cache);
|
requireActiveStore(cache.getStoreId());
|
||||||
|
requireValidRole(cache.getRoleId(), cache.getStoreId());
|
||||||
TimiException.requiredNull(userService.getByName(data.getName()), "existed user name");
|
TimiException.requiredNull(userService.getByName(data.getName()), "existed user name");
|
||||||
TimiException.requiredNull(userService.getByPhoneNo(data.getPhoneNo()), "existed phone number");
|
TimiException.requiredNull(userService.getByPhoneNo(data.getPhoneNo()), "existed phone number");
|
||||||
if (!redisInvite.destroy(getInviteKey(code))) {
|
if (!redisInvite.destroy(getInviteKey(code))) {
|
||||||
@@ -181,16 +176,10 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
user.setPhoneNo(data.getPhoneNo());
|
user.setPhoneNo(data.getPhoneNo());
|
||||||
user.setPassword(data.getPassword());
|
user.setPassword(data.getPassword());
|
||||||
|
|
||||||
if (cache.getStoreId() == null) {
|
|
||||||
// TODO 用更好的方式
|
|
||||||
userService.create(user);
|
|
||||||
userService.verifyPhoneNo(user.getId());
|
|
||||||
} else {
|
|
||||||
GaoUser gaoUser = new GaoUser();
|
GaoUser gaoUser = new GaoUser();
|
||||||
gaoUser.setStoreId(cache.getStoreId());
|
gaoUser.setStoreId(cache.getStoreId());
|
||||||
gaoUser.setUser(user);
|
gaoUser.setUser(user);
|
||||||
gaoUserService.create(gaoUser);
|
gaoUserService.create(gaoUser);
|
||||||
}
|
|
||||||
|
|
||||||
UserRole userRole = new UserRole();
|
UserRole userRole = new UserRole();
|
||||||
userRole.setId(UUID.randomUUID().toString());
|
userRole.setId(UUID.randomUUID().toString());
|
||||||
@@ -276,7 +265,7 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
|
|
||||||
private Role requireValidRole(String roleId, String storeId) {
|
private Role requireValidRole(String roleId, String storeId) {
|
||||||
Role role = roleService.get(roleId);
|
Role role = roleService.get(roleId);
|
||||||
if (role == null || role.getModuleCode() != ModuleCode.GAO || (storeId == null && !isGlobalManagerRole(role)) || !isRoleUsableForStore(role, storeId)) {
|
if (role == null || role.getModuleCode() != ModuleCode.GAO || !isRoleUsableForStore(role, storeId)) {
|
||||||
throw invalidInvite();
|
throw invalidInvite();
|
||||||
}
|
}
|
||||||
return role;
|
return role;
|
||||||
@@ -285,20 +274,7 @@ public class GaoUserInviteServiceImplement implements GaoUserInviteService {
|
|||||||
private boolean isRoleUsableForStore(Role role, String storeId) {
|
private boolean isRoleUsableForStore(Role role, String storeId) {
|
||||||
return role.getOwnerType() == null
|
return role.getOwnerType() == null
|
||||||
|| role.getOwnerType() == AuthOwnerType.MODULE && (TimiJava.isEmpty(role.getOwnerId()) || ModuleCode.GAO.name().equals(role.getOwnerId()))
|
|| role.getOwnerType() == AuthOwnerType.MODULE && (TimiJava.isEmpty(role.getOwnerId()) || ModuleCode.GAO.name().equals(role.getOwnerId()))
|
||||||
|| role.getOwnerType() == AuthOwnerType.STORE && storeId != null && storeId.equals(role.getOwnerId());
|
|| role.getOwnerType() == AuthOwnerType.STORE && storeId.equals(role.getOwnerId());
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isGlobalManagerRole(Role role) {
|
|
||||||
return role != null
|
|
||||||
&& role.getModuleCode() == ModuleCode.GAO
|
|
||||||
&& GaoRoleCode.GLOBAL_MANAGER.name().equals(role.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateInviteTarget(GaoUserInviteCache cache) {
|
|
||||||
if (cache.getStoreId() != null) {
|
|
||||||
requireActiveStore(cache.getStoreId());
|
|
||||||
}
|
|
||||||
requireValidRole(cache.getRoleId(), cache.getStoreId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStoreScope(String userId, String storeId) {
|
private void checkStoreScope(String userId, String storeId) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class GaoUserInviteCreateRequest {
|
public class GaoUserInviteCreateRequest {
|
||||||
|
|
||||||
/// 门店管理场景的目标门店 ID,店长场景及 ADMIN 邀请 GLOBAL_MANAGER 时不使用
|
/// 门店管理场景的目标门店 ID,店长场景不使用
|
||||||
private String storeId;
|
private String storeId;
|
||||||
|
|
||||||
/// 目标角色 ID
|
/// 目标角色 ID
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.imyeyu.api.modules.user.service;
|
package com.imyeyu.api.modules.user.service;
|
||||||
|
|
||||||
import com.e2ins.ms.notify.vo.sms.CaptchaVerifyReq;
|
|
||||||
import com.imyeyu.api.modules.user.entity.User;
|
import com.imyeyu.api.modules.user.entity.User;
|
||||||
import com.imyeyu.api.modules.user.vo.LoginRequest;
|
import com.imyeyu.api.modules.user.vo.LoginRequest;
|
||||||
import com.imyeyu.api.modules.user.vo.LoginResponse;
|
import com.imyeyu.api.modules.user.vo.LoginResponse;
|
||||||
@@ -24,8 +23,6 @@ public interface UserLoginService {
|
|||||||
|
|
||||||
LoginResponse login(String token, String userId);
|
LoginResponse login(String token, String userId);
|
||||||
|
|
||||||
LoginResponse loginBySms(CaptchaVerifyReq req);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据令牌获取用户
|
* 根据令牌获取用户
|
||||||
*
|
*
|
||||||
|
|||||||
+2
-24
@@ -1,8 +1,5 @@
|
|||||||
package com.imyeyu.api.modules.user.service.implement;
|
package com.imyeyu.api.modules.user.service.implement;
|
||||||
|
|
||||||
import com.e2ins.ms.notify.SmsNotifyService;
|
|
||||||
import com.e2ins.ms.notify.bean.NotifyDetail;
|
|
||||||
import com.e2ins.ms.notify.vo.sms.CaptchaVerifyReq;
|
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.entity.Setting;
|
import com.imyeyu.api.modules.common.entity.Setting;
|
||||||
@@ -10,13 +7,13 @@ import com.imyeyu.api.modules.common.service.AttachmentService;
|
|||||||
import com.imyeyu.api.modules.common.service.SettingService;
|
import com.imyeyu.api.modules.common.service.SettingService;
|
||||||
import com.imyeyu.api.modules.user.bean.BootstrapData;
|
import com.imyeyu.api.modules.user.bean.BootstrapData;
|
||||||
import com.imyeyu.api.modules.user.entity.User;
|
import com.imyeyu.api.modules.user.entity.User;
|
||||||
|
import com.imyeyu.api.modules.user.service.RoleService;
|
||||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||||
import com.imyeyu.api.modules.user.service.UserRoleService;
|
import com.imyeyu.api.modules.user.service.UserRoleService;
|
||||||
import com.imyeyu.api.modules.user.service.UserService;
|
import com.imyeyu.api.modules.user.service.UserService;
|
||||||
import com.imyeyu.api.modules.user.vo.LoginRequest;
|
import com.imyeyu.api.modules.user.vo.LoginRequest;
|
||||||
import com.imyeyu.api.modules.user.vo.LoginResponse;
|
import com.imyeyu.api.modules.user.vo.LoginResponse;
|
||||||
import com.imyeyu.java.TimiJava;
|
import com.imyeyu.java.TimiJava;
|
||||||
import com.imyeyu.java.bean.timi.TimiCode;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.TimiSpring;
|
import com.imyeyu.spring.TimiSpring;
|
||||||
import com.imyeyu.spring.util.Redis;
|
import com.imyeyu.spring.util.Redis;
|
||||||
@@ -30,7 +27,6 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@@ -48,9 +44,9 @@ public class UserLoginServiceImplement implements UserLoginService, TimiJava {
|
|||||||
private static final long PHONE_VERIFY_CODE_TTL = Time.M * 5;
|
private static final long PHONE_VERIFY_CODE_TTL = Time.M * 5;
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private final RoleService roleService;
|
||||||
private final SettingService settingService;
|
private final SettingService settingService;
|
||||||
private final UserRoleService userRoleService;
|
private final UserRoleService userRoleService;
|
||||||
private final SmsNotifyService smsNotifyService;
|
|
||||||
private final AttachmentService attachmentService;
|
private final AttachmentService attachmentService;
|
||||||
|
|
||||||
private final Redis<String, String> redisUserToken;
|
private final Redis<String, String> redisUserToken;
|
||||||
@@ -102,24 +98,6 @@ public class UserLoginServiceImplement implements UserLoginService, TimiJava {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LoginResponse loginBySms(CaptchaVerifyReq req) {
|
|
||||||
try {
|
|
||||||
NotifyDetail detail = smsNotifyService.captchaVerify(req);
|
|
||||||
// 无报错即成功
|
|
||||||
User user = userService.getByPhoneNo(detail.getSendTo());
|
|
||||||
if (!user.isValidPhone()) {
|
|
||||||
user.setPhoneNoVerifyAt(Time.now());
|
|
||||||
userService.update(user);
|
|
||||||
}
|
|
||||||
return login(UUID.randomUUID().toString(), user.getId());
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("login by sms error", e);
|
|
||||||
throw new TimiException(TimiCode.ERROR, "验证短信失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getLoginUser(String token) {
|
public User getLoginUser(String token) {
|
||||||
if (TimiJava.isEmpty(token)) {
|
if (TimiJava.isEmpty(token)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user