Browse Source

裂变优化-v1.0.4

(cherry picked from commit ecd841ebc79d2ea7b15909900734455a4e106fbf)
MOKASZ\lw12420 2 năm trước cách đây
mục cha
commit
6e7738a8b0

+ 53 - 4
launch-admin/src/main/java/com/webflux/launchadmin/mysql/controller/planNew/PlanNewOutController.java

@@ -310,12 +310,12 @@ public class PlanNewOutController {
             }).switchIfEmpty(Mono.just(getReturnLoop()));
             Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"4"))).collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
             Mono<List<Ad>> bottom = template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"5"))).collectList();
+
+
             Mono<DataLists> dataListsMono = Mono.zip(code, listAudio, retAudioId, returnLoop, arrayListMono, adtop, bottom, wx_user_id).flatMap(f -> {
                 DataLists dataLists = new DataLists();
                 dataLists.setPlanNew(f.getT1());
-                dataLists.setTransferPageBl(f.getT1().transferPageBl());
-                dataLists.setTransferPageDomain(f.getT1().transferPageDomain());
-                dataLists.setBackgroupDomain(f.getT1().backgroupDomain());
+
                 if (Objects.nonNull(f.getT2().id())) {
                     dataLists.setListAudio(f.getT2());
                 }
@@ -344,7 +344,56 @@ public class PlanNewOutController {
                     List<Ad> ads = f.getT7().subList(0, f.getT1().bottomAdvNum());
                     dataLists.setBottomAd(ads);
                 }
-                return Mono.just(dataLists);
+                Mono<String> stringMono;
+                if (f.getT1().transferPageBl() == 1 && Objects.nonNull(f.getT1().transferPageDomain())) {
+                   stringMono = template.select(Query.query(Criteria
+                            .where("group_type_id").is(f.getT1().transferPageDomain())
+                            .and("status").is(1)
+                            .and("type").is(5)
+                            .and("deleted_at").isNull()), DomainSelect.class)
+                            .switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain())))
+                            .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
+                                if (!fff.isEmpty()) {
+                                    DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
+                                    String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
+                                    String domain1 = domainSelect.domain();
+                                    return Mono.just(string+"."+domain1);
+
+                                } else {
+                                    throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain());
+                                }
+                            });
+                }else {
+                    stringMono = Mono.just(" ");
+                }
+                Mono<String> stringMono1;
+                if ( Objects.nonNull(f.getT1().backgroupDomain()) && !"".equals(f.getT1().backgroupDomain().trim()) ) {
+                    stringMono1 = template.select(Query.query(Criteria
+                            .where("group_type_id").is(f.getT1().backgroupDomain())
+                            .and("status").is(1)
+                            .and("type").is(4)
+                            .and("deleted_at").isNull()), DomainSelect.class)
+                            .switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查詢為空 group_type_id" + f.getT1().backgroupDomain())))
+                            .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
+                                if (!fff.isEmpty()) {
+                                    DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
+                                    String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
+                                    String domain1 = domainSelect.domain();
+                                    return Mono.just(string+"."+domain1);
+                                } else {
+                                    throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.getT1().backgroupDomain());
+                                }
+                            });
+                }else {
+                    stringMono1 =  Mono.just(" ");
+                }
+                return   Mono.zip(stringMono,stringMono1,Mono.just(dataLists)).flatMap(fff->{
+                    DataLists t3 = fff.getT3();
+                    t3.setTransferPageBl(f.getT1().transferPageBl());
+                    t3.setTransferPageDomain(fff.getT1());
+                    t3.setBackgroupDomain(fff.getT2());
+                    return Mono.just(t3);
+                });
             });
             return dataListsMono;
         });

+ 1 - 1
launch-admin/src/main/java/com/webflux/launchadmin/mysql/entity/planNew/DomainSelect.java

@@ -11,7 +11,7 @@ public record DomainSelect(
         @Id Long id,
         Integer groupType, //类型 1素材分类2清水分类
         String domain, //域名
-        String type,
+        String type,//1是入口域名,2是落地页域名,4是分享背景组域名,5是中转页域名
         String status,
         Integer groupTypeId,
         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") ZonedDateTime deletedAt