Przeglądaj źródła

平台账户管理

wangyunpeng 3 miesięcy temu
rodzic
commit
5e7f727112

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/config/DataSourceConfig.java

@@ -40,6 +40,8 @@ public class DataSourceConfig {
         final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
         sessionFactoryBean.setDataSource(dataSource);
         sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(DataSourceConfig.MAPPER_LOCATION_MASTER));
+        sessionFactoryBean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
+        sessionFactoryBean.getObject().getConfiguration().setUseGeneratedKeys(true);
         return sessionFactoryBean.getObject();
     }
 

+ 9 - 4
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java

@@ -70,6 +70,8 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
             if (verifyCode.getStatus() == 1) {
                 throw new CommonException(ExceptionEnum.EMAIL_VERIFY_CODE_USED);
             }
+            verifyCode.setStatus(1);
+            verifyCodeMapper.updateByPrimaryKey(verifyCode);
         }
         String token = UUID.randomUUID().toString().replace("-", "");
 
@@ -95,12 +97,15 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
     }
 
     private void saveTokenToRedis(AccountLoginVO loginInfo, String oldToken, String token) {
+        String tokenPrefix = "login.{token}";
         // 清除老token
-        String info = redisUtils.getString(JwtInterceptor.TOKEN_PREFIX.replace("{token}", oldToken));
-        if (StringUtils.hasText(info)) {
-            redisUtils.del(JwtInterceptor.TOKEN_PREFIX.replace("{token}", oldToken));
+        if (StringUtils.hasText(oldToken)) {
+            String info = redisUtils.getString(tokenPrefix.replace("{token}", oldToken));
+            if (StringUtils.hasText(info)) {
+                redisUtils.del(tokenPrefix.replace("{token}", oldToken));
+            }
         }
-        String redisKey = JwtInterceptor.TOKEN_PREFIX.replace("{token}", token);
+        String redisKey = tokenPrefix.replace("{token}", token);
         redisUtils.setValueWithExpire(redisKey, JSON.toJSONString(loginInfo), 7 * 24 * 60 * 60L);
     }
 

+ 1 - 1
api-module/src/main/resources/application.properties

@@ -1,4 +1,4 @@
-spring.profiles.active=test
+spring.profiles.active=dev
 spring.application.name=growth-manager
 
 spring.main.allow-bean-definition-overriding=true

+ 0 - 1
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformAccountMapperExt.xml

@@ -2,7 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformAccountMapperExt">
 
-
     <select id="getTelNumExists"
             resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
         select *