Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
174955a30b

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseReviewServiceImpl.java

@@ -182,8 +182,9 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
             throw new BizException("课程不存在");
         }
 
-        String lockKey = "course_review" + courseSchedule.getId();
-        if (!redisCache.getLocked(lockKey, 1, 10)) {
+        String lockKey = "course_review_" + courseSchedule.getId();
+        long lockVal = Thread.currentThread().getId();
+        if (!redisCache.getLocked(lockKey, lockVal, 20)) {
             throw new BizException("评论提交中,请稍等");
         }
         PracticeGroup practiceGroup = practiceGroupDao.get(Long.parseLong(courseSchedule.getMusicGroupId()));
@@ -259,7 +260,7 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
             }
 
         } finally {
-            redisCache.releaseLocked(lockKey, 1);
+            redisCache.releaseLocked(lockKey, lockVal);
         }