验证码改为6位数

This commit is contained in:
wuchunlei
2024-07-24 09:53:05 +08:00
parent d41a69f176
commit 01d4b80b56
3 changed files with 109 additions and 89 deletions

View File

@@ -27,26 +27,27 @@ public class DataMigrationUtil extends Thread {
public static void main(String[] args){
// catalogue();
// courseCatalogue();
// course("2024-05-19");//运行时间2024-07-11
// courseCatalogue("2024-05-19");
// courseCatalogueChapter("2024-05-19");
// courseCatalogueChapterVideo("2024-05-19");
// userCourse();
// courseCatalogueChapter();
// courseCatalogueChapterVideo();
//用的都是copy表里的数据
// truncate();
}
public static void catalogue(){
public static void course(String createTime){
try {
Connection yljkconn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
// PreparedStatement statement = yljkconn.prepareStatement("select * from t_curriculum_catalogue where valid = 1" +
// " and poid in (select oid from t_curriculum_catalogue where valid = 1 and poid is null) " +
// "and (courseFee like '%,%' or courseFee = '0' or courseFee = '' or poid = '00000000000000000000000000000070' )");
// " and poid in (select oid from t_curriculum_catalogue where valid = 1 and poid is null)" +
// " and (courseFee like '%,%' or courseFee = '0' or courseFee = '' or poid = '00000000000000000000000000000070')" +
// " and createDate > '"+createTime+"'");
PreparedStatement statement = yljkconn.prepareStatement("select * from t_curriculum_catalogue " +
"where oid = 'ee9d5e16845a43b5933ecc111ee52052' ");
"where oid = '71f55cff46494791b839d0d8c17e1f2b' ");
ResultSet resultSet = statement.executeQuery();
List<Map> list = new ArrayList();
while(resultSet.next()){
@@ -104,13 +105,16 @@ public class DataMigrationUtil extends Thread {
public static void courseCatalogue(){
public static void courseCatalogue(String createTime){
try {
Connection fzdsconn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select id,uid from course ");
PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select id,uid from course where id = 183 ");
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
// "select id,uid from course where uid != '' and create_time > '"+createTime+"'");
PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
"select id,uid from course where id = 195 ");
ResultSet fzdsresultSet = fzdsstatement.executeQuery();
List<Map> fzdslist = new ArrayList();
while(fzdsresultSet.next()){
@@ -192,77 +196,19 @@ public class DataMigrationUtil extends Thread {
}
}
public static void userCourse(){
try {
Connection yljkconn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
// PreparedStatement statement = yljkconn.prepareStatement("select oid,cellPhone,nameCN,nickName,icons,superVIP,point,pointByJF,payStatus,paydate,payValidDate from t_customer where valid = 1 and cellphone != '' and cellphone is not null ");
// ResultSet resultSet = statement.executeQuery();
// while(resultSet.next()){
// PreparedStatement fzdsstatement = connection.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'");
// ResultSet fzdsresultSet = fzdsstatement.executeQuery();
// if (!fzdsresultSet.next()){
// user(yljkconn,connection,resultSet.getString("oid"));
// }
// }
List list = new ArrayList();
list.add("137a4c15dad741f1b8bdcf3f1ed29bb2");
list.add("4f50a94045994dafb16c337f9b590d3d");
for (int i=0;i<list.size(); i++){
user(yljkconn,connection,list.get(i).toString());
}
System.out.println("完成---");
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void userCourseBuy(){
try {
Connection yljkconn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection fzdsconn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement statement = yljkconn.prepareStatement("select oid,superVIP,paydate,payValidDate " +
"from t_customer where valid = 1 and cellphone != '' and cellphone is not null " +
"and superVIP in ('1','2')");
ResultSet resultSet = statement.executeQuery();
int k=0;
while(resultSet.next()){
k++;
System.out.println(k);
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'");
// ResultSet fzdsresultSet = fzdsstatement.executeQuery();
// if (fzdsresultSet.next()){
// String sql = "update user set " +
// "vip= '"+resultSet.getString("superVIP")+"' " +
// "where yljk_oid = "+resultSet.getString("oid")+"";
// PreparedStatement oidUpdateStatement = fzdsconn.prepareStatement(sql);
// oidUpdateStatement.execute();
//
// }
}
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void courseCatalogueChapter(){
public static void courseCatalogueChapter(String createTime){
try {
Connection fzdsconn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
// "select c.id,c.uid,cc.id ccid,cc.title cctitle from course c left join course_catalogue cc on c.id = cc.course_id ");
// "select c.id,c.uid,cc.id ccid,cc.title cctitle from course c " +
// " left join course_catalogue cc on c.id = cc.course_id " +
// " where c.create_time > '"+createTime+"'");
PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
"select c.id,c.uid,cc.id ccid,cc.title cctitle from course c left join course_catalogue cc on c.id = cc.course_id " +
"where c.id = 183");
"select c.id,c.uid,cc.id ccid,cc.title cctitle from course c " +
" left join course_catalogue cc on c.id = cc.course_id " +
" where c.id = 195");
ResultSet fzdsresultSet = fzdsstatement.executeQuery();
List<Map> fzdslist = new ArrayList();
while(fzdsresultSet.next()){
@@ -326,16 +272,19 @@ public class DataMigrationUtil extends Thread {
}
}
public static void courseCatalogueChapterVideo(){
public static void courseCatalogueChapterVideo(String createTime){
try {
Connection fzdsconn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
// "select c.uid,ccc.id as cccid,ccc.title from course c left join course_catalogue_chapter ccc on c.id = ccc.course_id");
// "select c.uid,ccc.id as cccid,ccc.title from course c" +
// " left join course_catalogue_chapter ccc on c.id = ccc.course_id" +
// " where c.create_time > '"+createTime+"'");
PreparedStatement fzdsstatement = fzdsconn.prepareStatement(
"select c.uid,ccc.id as cccid,ccc.title from course c left join course_catalogue_chapter ccc on c.id = ccc.course_id " +
"where c.id = 183");
"select c.uid,ccc.id as cccid,ccc.title from course c" +
" left join course_catalogue_chapter ccc on c.id = ccc.course_id" +
" where c.id = 195 ");
ResultSet fzdsresultSet = fzdsstatement.executeQuery();
List<Map> fzdslist = new ArrayList();
while(fzdsresultSet.next()){
@@ -410,6 +359,67 @@ public class DataMigrationUtil extends Thread {
}
}
public static void userCourse(){
try {
Connection yljkconn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
// PreparedStatement statement = yljkconn.prepareStatement("select oid,cellPhone,nameCN,nickName,icons,superVIP,point,pointByJF,payStatus,paydate,payValidDate from t_customer where valid = 1 and cellphone != '' and cellphone is not null ");
// ResultSet resultSet = statement.executeQuery();
// while(resultSet.next()){
// PreparedStatement fzdsstatement = connection.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'");
// ResultSet fzdsresultSet = fzdsstatement.executeQuery();
// if (!fzdsresultSet.next()){
// user(yljkconn,connection,resultSet.getString("oid"));
// }
// }
List list = new ArrayList();
list.add("137a4c15dad741f1b8bdcf3f1ed29bb2");
list.add("4f50a94045994dafb16c337f9b590d3d");
for (int i=0;i<list.size(); i++){
user(yljkconn,connection,list.get(i).toString());
}
System.out.println("完成---");
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void userCourseBuy(){
try {
Connection yljkconn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection fzdsconn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement statement = yljkconn.prepareStatement("select oid,superVIP,paydate,payValidDate " +
"from t_customer where valid = 1 and cellphone != '' and cellphone is not null " +
"and superVIP in ('1','2')");
ResultSet resultSet = statement.executeQuery();
int k=0;
while(resultSet.next()){
k++;
System.out.println(k);
// PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'");
// ResultSet fzdsresultSet = fzdsstatement.executeQuery();
// if (fzdsresultSet.next()){
// String sql = "update user set " +
// "vip= '"+resultSet.getString("superVIP")+"' " +
// "where yljk_oid = "+resultSet.getString("oid")+"";
// PreparedStatement oidUpdateStatement = fzdsconn.prepareStatement(sql);
// oidUpdateStatement.execute();
//
// }
}
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void truncate(){
try {
Connection fzdsconn = DriverManager.getConnection(

View File

@@ -204,11 +204,11 @@ public class MyUserController {
}
}
//生成随机位数
//生成随机位数
Random random = new Random();
String i = random.nextInt(99999) + "";
String i = random.nextInt(999999) + "";
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 5 - i.length(); j++) {
for (int j = 0; j < 6 - i.length(); j++) {
sb.append("0");
}
i = sb.toString() + i;
@@ -237,9 +237,14 @@ public class MyUserController {
return R.error(500,"验证码频率过高,请稍后再试!");
}
}
//生成随机位数
//生成随机位数
Random random = new Random();
String code = random.nextInt(99999) + "";
String code = random.nextInt(999999) + "";
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 6 - code.length(); j++) {
sb.append("0");
}
code = sb.toString() + code;
String timeCode = code + "_"+System.currentTimeMillis();
//redis 缓存验证码
redisTemplate.opsForValue().set("RegistCode"+email,timeCode,5, TimeUnit.MINUTES);

View File

@@ -61,11 +61,11 @@ public class UserController {
return R.error(500,"短信验证码频率过高,请稍后再试!");
}
}
//生成随机位数
//生成随机位数
Random random = new Random();
String i = random.nextInt(99999) + "";
String i = random.nextInt(999999) + "";
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 5 - i.length(); j++) {
for (int j = 0; j < 6 - i.length(); j++) {
sb.append("0");
}
i = sb.toString() + i;
@@ -91,9 +91,14 @@ public class UserController {
return R.error(500,"验证码频率过高,请稍后再试!");
}
}
//生成随机位数
//生成随机位数
Random random = new Random();
String code = random.nextInt(99999) + "";
String code = random.nextInt(999999) + "";
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 6 - code.length(); j++) {
sb.append("0");
}
code = sb.toString() + code;
String timeCode = code + "_"+System.currentTimeMillis();
//redis 缓存验证码
redisTemplate.opsForValue().set("RegistCode"+email,timeCode,5, TimeUnit.MINUTES);