33333333333

This commit is contained in:
777
2025-02-12 23:33:55 +08:00
parent 7dc7f874e4
commit 898c4b2431
4 changed files with 44 additions and 10 deletions

18
doc/2025-02-12.sql Normal file
View File

@@ -0,0 +1,18 @@
drop table cai_batch_add_user;
CREATE TABLE `cai_batch_add_user`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`add_num` int NOT NULL COMMENT '新增用户数',
`gender` tinyint default 1 NOT NULL COMMENT '1-女 2-男',
`invite_user_code` bigint comment '邀请人code',
`phone_prefix` varchar(100) comment '手机前缀(前7位)',
`phone_suffix_start` int(7) comment '手机后缀起点(后4位)',
`password_prefix` varchar(100) comment '密码前缀',
`password_suffix_start` varchar(100) comment '密码后缀起点',
`run_status` tinyint NOT NULL DEFAULT 0 comment '0-未执行 1-执行中 2-执行失败 3-执行成功' COMMENT '执行状态',
`run_fail` text comment '执行失败原因',
`run_result` JSON comment '执行结果',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`run_time` datetime COMMENT '执行时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='批量新增用户脚本';

View File

@@ -20,7 +20,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://124.222.254.188:5306/cai-v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true url: jdbc:mysql://124.222.254.188:5306/cai-v5?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root username: root
password: 383200134 password: 383200134
# 从库数据源 # 从库数据源

View File

@@ -161,9 +161,11 @@ public class CaiLoginManager {
if(!caiUser.getPassword().equals(caiUser.getPasswordCheck())){ if(!caiUser.getPassword().equals(caiUser.getPasswordCheck())){
throw new ServiceException("两次输入密码不一致,请检查"); throw new ServiceException("两次输入密码不一致,请检查");
} }
boolean check = smsVerifyService.check(CodeEnum.REGISTER, caiUser.getUsername(), caiUser.getCode()); if(!caiUser.isSystemOp()){
if(!check){ boolean check = smsVerifyService.check(CodeEnum.REGISTER, caiUser.getUsername(), caiUser.getCode());
throw new ServiceException("验证码错误"); if(!check){
throw new ServiceException("验证码错误");
}
} }
// 加锁 // 加锁
String lockKey = LockManager.getRegisterLockKey(caiUser.getUsername()); String lockKey = LockManager.getRegisterLockKey(caiUser.getUsername());
@@ -178,12 +180,22 @@ public class CaiLoginManager {
}finally { }finally {
lock.unlock(); lock.unlock();
} }
awardManager.giveRegisterAsync(user.getId()); if(!caiUser.isSystemOp()){
awardManager.giveRegisterAsync(user.getId());
}
if(caiUser.getInviteId() != null){ if(caiUser.getInviteId() != null){
User finalUser = user; User finalUser = user;
ExecutorConstant.COMMON_EXECUTOR.execute(() -> dealInviteId(finalUser,caiUser.getInviteId(), true)); if(!caiUser.isSystemOp()){
ExecutorConstant.COMMON_EXECUTOR.execute(() -> dealInviteId(finalUser,caiUser.getInviteId(), true));
}else{
dealInviteId(finalUser,caiUser.getInviteId(), true);
}
}
if(!caiUser.isSystemOp()){
return login(user);
}else{
return null;
} }
return login(user);
} }
@@ -315,7 +327,7 @@ public class CaiLoginManager {
req.setAccid(add.getId()+""); req.setAccid(add.getId()+"");
req.setToken(add.getImToken()); req.setToken(add.getImToken());
req.setName(add.getNickname()); req.setName(add.getNickname());
YxCommonR r = imUserClient.createUser(req); /*YxCommonR r = imUserClient.createUser(req);
if(!r.isSuccess()){ if(!r.isSuccess()){
if(r.getCode() == 414){ if(r.getCode() == 414){
UpdateTokenReq req1 = new UpdateTokenReq(); UpdateTokenReq req1 = new UpdateTokenReq();
@@ -330,8 +342,11 @@ public class CaiLoginManager {
log.error("创建云信账号失败,{}", JSON.toJSONString(r)); log.error("创建云信账号失败,{}", JSON.toJSONString(r));
throw new ServiceException("注册失败,云信异常"); throw new ServiceException("注册失败,云信异常");
} }
}*/
String clientIP = "127.0.0.1";
if(!user.isSystemOp()){
clientIP = ServletUtils.getClientIP();
} }
String clientIP = ServletUtils.getClientIP();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
userInfo.setUserId(add.getId()); userInfo.setUserId(add.getId());
userInfo.setVideoIncomeRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_VIDEO_INCOME_RATE)); userInfo.setVideoIncomeRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_VIDEO_INCOME_RATE));

View File

@@ -8,6 +8,7 @@ import javax.validation.constraints.NotEmpty;
@Data @Data
@Schema(description = "注册模型") @Schema(description = "注册模型")
public class CaiRegisterUser { public class CaiRegisterUser {
private boolean systemOp;
@Schema(description = "手机号登录名") @Schema(description = "手机号登录名")
@NotEmpty(message = "手机号不能为空") @NotEmpty(message = "手机号不能为空")
private String username; private String username;
@@ -20,6 +21,6 @@ public class CaiRegisterUser {
@Schema(description = "验证码") @Schema(description = "验证码")
@NotEmpty(message = "验证码不能为空") @NotEmpty(message = "验证码不能为空")
private String code; private String code;
@Schema(description = "邀请人ID") @Schema(description = "邀请人ID(实际是code)")
private String inviteId; private String inviteId;
} }