Jelajahi Sumber

Merge branch 'test'

lyhzzz 1 bulan lalu
induk
melakukan
1013a744e4

+ 1 - 1
src/main/java/com/fdkankan/ucenter/service/IMailTemplateService.java

@@ -56,5 +56,5 @@ public interface IMailTemplateService extends IService<MailTemplate> {
 
     Boolean sendContactUs(String email,String callBackUrl);
 
-    void sendContactUs2(String email);
+    void sendContactUs2(String email,Integer type);
 }

+ 3 - 7
src/main/java/com/fdkankan/ucenter/service/impl/ContactUsServiceImpl.java

@@ -71,15 +71,16 @@ public class ContactUsServiceImpl extends ServiceImpl<IContactUsMapper, ContactU
 
         User user = userService.getByUserName(contactUs.getEmail());
         contactUs.setCountry(IPUtils.getCountry(contactUs.getIpAddress()));
+        redisUtil.set(redisKey,"1",60 *5);
         if(user !=null){
-            mailTemplateService.sendContactUs2(contactUs.getEmail());
+            mailTemplateService.sendContactUs2(contactUs.getEmail(),13);
             this.save(contactUs);
             return;
         }
+
         String callBackUrl = ucenterConfig.getContactUsCallBackUrl() + uuid;
         Boolean b = mailTemplateService.sendContactUs(contactUs.getEmail(),callBackUrl);
         if(b){
-            redisUtil.set(redisKey, uuid,ucenterConfig.getEmailExTime());
             redisUtil.set(redisKey2, JSONObject.toJSONString(contactUs),ucenterConfig.getEmailExTime());
         }
         this.save(contactUs);
@@ -88,7 +89,6 @@ public class ContactUsServiceImpl extends ServiceImpl<IContactUsMapper, ContactU
     @Override
     public LoginVo callBack(String uuid) {
         String rediskey = String.format(RedisKeyUtil.CONTACT_US_KEY,uuid);
-        String rediskey2 = null;
         if(!redisUtil.hasKey(rediskey)){
             throw new BusinessException(ResultCode.url_exprix);
         }
@@ -96,7 +96,6 @@ public class ContactUsServiceImpl extends ServiceImpl<IContactUsMapper, ContactU
         try {
             if(redisUtil.hasKey(rediskey) ){
                 ContactUs contactUs = JSONObject.parseObject( redisUtil.get(rediskey),ContactUs.class);
-                rediskey2 = String.format(RedisKeyUtil.CONTACT_US_KEY,contactUs.getEmail());
                 User userEntity = userService.getByUserName(contactUs.getEmail());
                 if(userEntity == null){
                     userEntity = new User();
@@ -121,9 +120,6 @@ public class ContactUsServiceImpl extends ServiceImpl<IContactUsMapper, ContactU
             log.info("contact-us-callback-error:{}",e);
         }finally {
             redisUtil.del(rediskey);
-            if(rediskey2 != null){
-                redisUtil.del(rediskey2);
-            }
         }
         return null;
     }

+ 2 - 2
src/main/java/com/fdkankan/ucenter/service/impl/MailTemplateServiceImpl.java

@@ -265,8 +265,8 @@ public class MailTemplateServiceImpl extends ServiceImpl<IMailTemplateMapper, Ma
     }
 
     @Override
-    public void sendContactUs2(String email) {
-        MailTemplate mailTemplate = this.getTemplateEn(13);
+    public void sendContactUs2(String email,Integer type) {
+        MailTemplate mailTemplate = this.getTemplateEn(type);
         sendMail(email,mailTemplate,null);
     }