Parcourir la source

fix telphone_login

he2802 il y a 2 ans
Parent
commit
e8e8c3a864

+ 2 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -931,7 +931,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
     @Override
     public Map<String, Object> telphone_login(UserAppTelphoneLoginBo bo) {
-        Object cacheObject = redisCache.getCacheObjectNoTenant(bo.getSign());
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        Object cacheObject = redisCache.getCacheObjectNoTenant(tenantId+":"+bo.getSign());
         if (ObjectUtil.isNull(cacheObject)){
             throw new CustomException("该账号不存在!");
         }

+ 22 - 16
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1005,6 +1005,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         if (CollectionUtils.isEmpty(voList)) {
             return new ArrayList<>();
         }
+        //当前时间戳
+        Long nowTime = DateUtils.getNowTime();
         voList.forEach(goodsVo -> {
             User user = users.stream().filter(x -> x.getTenantId().equals(goodsVo.getTenantId())).findFirst().orElse(null);
             //已学和未学
@@ -1016,6 +1018,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             subjectStudyRecordQueryBo.setOrderGoodsId(goodsVo.getOrderGoodsId());
             subjectStudyRecordQueryBo.setGradeId(goodsVo.getGradeId());
             subjectStudyRecordQueryBo.setTenantId(goodsVo.getTenantId());
+            Long tenantId = goodsVo.getTenantId();
             List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubjectTenant(subjectStudyRecordQueryBo);
             for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
                 secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
@@ -1055,22 +1058,25 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
                 goodsVo.setCourseId(courseIds.get(0));
             }
-
             if (goodsVo.getCourseType() == 2) {
                 //题库
-                goodsVo.setToWeAppPagePath("/pages/questionBank/index");
+                goodsVo.setToWeAppPagePath("/pages/questionBank/index?skipPort="+nowTime);
             } else if (goodsVo.getCourseType() == 6) {
                 //直播
-                goodsVo.setToWeAppPagePath(String.format("/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s",
-                        goodsVo.getOrderGoodsId(), goodsVo.getGoodsId(), goodsVo.getCourseId()));
+                goodsVo.setToWeAppPagePath(String.format("/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s&skipPort=%s",
+                        goodsVo.getOrderGoodsId(), goodsVo.getGoodsId(), goodsVo.getCourseId(),nowTime));
             } else {
                 //视频
-                goodsVo.setToWeAppPagePath(String.format("/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s",
-                        goodsVo.getCourseId(), goodsVo.getGoodsId(), goodsVo.getOrderGoodsId(), goodsVo.getGradeId()));
+                goodsVo.setToWeAppPagePath(String.format("/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s&skipPort=%s",
+                        goodsVo.getCourseId(), goodsVo.getGoodsId(), goodsVo.getOrderGoodsId(), goodsVo.getGradeId(),nowTime));
             }
+            UserPhoneBo phoneBo = new UserPhoneBo();
+            phoneBo.setTelphone(bo.getTelphone());
+            phoneBo.setTenantId(tenantId);
+            //缓存用户手机号码 30分钟失效
+            redisCache.setCacheObjectTenant(tenantId+":"+nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
 
         });
-
         return voList;
     }
 
@@ -1220,7 +1226,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         phoneBo.setTenantId(bo.getTenantId());
         log.info(String.format("旧系统获取商品学习中心路径:%s(url),%s(tenantId)",url,bo.getTenantId()));
         //缓存用户手机号码 30分钟失效
-        redisCache.setCacheObjectTenant(nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
+        redisCache.setCacheObjectTenant(bo.getTenantId()+":"+nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
         return url;
     }
 
@@ -2454,7 +2460,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 copyRecordList.add(record);
             });
         }
-        
+
         //9 业务层次
         List<CourseBusiness> businessList = iCourseBusinessService.list();
         if (CollectionUtils.isNotEmpty(businessList)){
@@ -2515,7 +2521,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //关联表不需要记录(后续修改ID)
             iCourseChapterBusinessService.saveBatch(newChapterBusinesseList);
         }
-        
+
         //12 课程章节关联
         List<CourseChapterSection> chapterSectionList = iCourseChapterSectionService.list();
         if (CollectionUtils.isNotEmpty(chapterSectionList)){
@@ -2528,7 +2534,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //关联表不需要记录(后续修改ID)
             iCourseChapterSectionService.saveBatch(newChapterSectionList);
         }
-        
+
         //13 教育类型关联
         List<CourseEducationTier> educationTiers = iCourseEducationTierService.list();
         if (CollectionUtils.isNotEmpty(educationTiers)){
@@ -2652,7 +2658,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 copyRecordList.add(record);
             });
         }
-        
+
         //20 课程模块业务关联
         List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService.list();
         if (CollectionUtils.isNotEmpty(moduleBusinessList)){
@@ -2739,7 +2745,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //关联表不需要记录(后续修改ID)
             iCourseSectionBusinessService.saveBatch(newSectionBusinessList);
         }
-        
+
         //25 课程节观看权限关联
         List<CourseSectionWatchPer> sectionWatchPerList = iCourseSectionWatchPerService.list();
         if (CollectionUtils.isNotEmpty(sectionWatchPerList)){
@@ -2887,7 +2893,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //关联表不需要记录(后续修改ID)
             iMajorProjectService.saveBatch(newMajorProjectList);
         }
-        
+
         //33 服务
         List<PayServe> serveList = iPayServeService.list();
         if (CollectionUtils.isNotEmpty(serveList)){
@@ -3068,7 +3074,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 copyRecordList.add(record);
             });
         }
-        
+
         //41 资料模板业务层次关联
         List<ProfileTpBusiness> tpBusinessList = iProfileTpBusinessService.list();
         if (CollectionUtils.isNotEmpty(tpBusinessList)){
@@ -3155,7 +3161,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             //关联表不需要记录(后续修改ID)
             iQuestionChapterExamService.saveBatch(newQuestionChapterExamList);
         }
-        
+
         //46 题库模块
         List<QuestionModule> questionModuleList = iQuestionModuleService.list();
         if (CollectionUtils.isNotEmpty(questionModuleList)){