Pārlūkot izejas kodu

fix 平台是否开启双重认证限制

zoujiajian 5 mēneši atpakaļ
vecāks
revīzija
b3dd77b364

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/DoubleVerifyClickRecordMapper.java

@@ -14,5 +14,5 @@ import java.util.List;
  *创建时间:2023/5/19 18:42
  */
 public interface DoubleVerifyClickRecordMapper extends BaseMapper<DoubleVerifyClickRecord> {
-	List<DoubleVerifyCodeView> getDoubleVerifyCodeList(@Param("userId") long userId, @Param("relationId") Long relationId);
+	List<DoubleVerifyCodeView> getDoubleVerifyCodeList(@Param("userIds") List<Long> userIds, @Param("relationId") Long relationId);
 }

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GroupsRelationView.java

@@ -78,6 +78,12 @@ public class GroupsRelationView {
     @DbField("g.title")
     private String title;
 
+    /**
+     * 是否开启双重认证限制
+     */
+    @DbField("g.is_verify_limit")
+    private Boolean isVerifyLimit;
+
     @DbField("gr.user_id")
     private Long userId;
 

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java

@@ -121,6 +121,12 @@ public class RenewalView {
     @DbField("g.show_field_info")
     private String showFieldInfo;
 
+    /**
+     * 是否开启双重认证限制
+     */
+    @DbField("g.is_verify_limit")
+    private Boolean isVerifyLimit;
+
     @DbField("gt.status")
     private String groupsStatus;
 

+ 12 - 5
netflix-dao/src/main/resources/mapper/DoubleVerifyClickRecordMapper.xml

@@ -7,15 +7,22 @@
     <select id="getDoubleVerifyCodeList" resultType="com.cyksj.model.views.DoubleVerifyCodeView">
         select *
         from (select user_id, account_id, relation_id, 1 as `type`, code, if(remain_time = 0,null,remain_time) as remain_time, created_time
-              from double_verify_click_record
-              where user_id = #{userId}
-                and relation_id = #{relationId}
+        from double_verify_click_record
+        where user_id in
+        <foreach collection="userIds" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and relation_id = #{relationId}
               union all
               select dr.user_id, dr.account_id, dr.relation_id, 2 as `type`, dcr.code, if(dcr.remain_time = 0,null,dcr.remain_time) as remain_time, dcr.created_time
               from double_verify_click_record dr
                        inner join double_verify_click_refresh_record dcr
-                                  on dcr.click_id = dr.id and dr.user_id = #{userId} and
-                                     dr.relation_id = #{relationId}) s
+        on dcr.click_id = dr.id
+        and dr.user_id in
+        <foreach collection="userIds" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and dr.relation_id = #{relationId}) s
         order by created_time desc
     </select>
 </mapper>

+ 4 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -328,8 +328,8 @@ public class GroupRelationController {
                 .between(DoubleVerifyClickRecord::getCreatedTime, DateUtil.beginOfMonth(now), DateUtil.endOfMonth(now)));
         //获取双重验证码
         Boolean isHasVerifyCode = StrUtil.isNotBlank(groupsRelationView.getVerifyCode()) ? true : false;
-        //出去亚马逊 获取限制
-        if (groupsRelationView.getGoodsId() != 6) {
+        //是否开启认证限制
+        if (groupsRelationView.getIsVerifyLimit()) {
             Integer num = groupRelationFrontService.getUserCodeNumBySkuId(userId, groupsRelationView.getSkuId(), isHasVerifyCode);
             if (count >= num) throw BusinessRuntimeException.getInstance("获取双重验证码次数上限");
         }
@@ -452,7 +452,8 @@ public class GroupRelationController {
     @GetMapping("/get/doubleVerify/codeList")
     public Result<List<DoubleVerifyCodeView>> getDoubleVerifyCodeList(Long relationId) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userId, relationId);
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+        List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userIdList, relationId);
         return GatewayResponse.SUCCESS.newBuilder().toResult(views);
     }
 

+ 10 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/relation/CorpRelationController.java

@@ -22,6 +22,7 @@ import com.cyksj.model.views.RenewalView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.relation.GroupRelationFrontService;
 import com.cyksj.service.relation.GroupsRelationNetflixService;
+import com.cyksj.service.user.UserBindRelationService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
@@ -54,6 +55,8 @@ public class CorpRelationController {
 
 	private final RedisService redisService;
 
+	private final UserBindRelationService userBindRelationService;
+
 
 	/**
 	 * 车票用户所有购买平台
@@ -120,7 +123,13 @@ public class CorpRelationController {
 	 */
 	@GetMapping("/get/doubleVerify/codeList")
 	public Result<List<DoubleVerifyCodeView>> getDoubleVerifyCodeList(Long relationId, Long userId) {
-		List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userId, relationId);
+		List<Long> userIdList = null;
+		try {
+			userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		} catch (Exception e) {
+			userIdList = List.of(userId);
+		}
+		List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userIdList, relationId);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
 	}