浏览代码

广告模块 补充远程弹窗控制逻辑

songfuqiang 1 年之前
父节点
当前提交
e0eaac4ad3

+ 4 - 2
backend-core/src/main/java/cn/kdan/pdf/backend/core/params/AddAdvertisementParam.java

@@ -2,6 +2,8 @@ package cn.kdan.pdf.backend.core.params;
 
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * @author sfq
  * @description
@@ -52,12 +54,12 @@ public class AddAdvertisementParam {
     /**
      * 开始日期
      */
-    private String startDate;
+    private Date startDate;
 
     /**
      * 结束日期
      */
-    private String endDate;
+    private Date endDate;
 
     /**
      * 展示类型

+ 5 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/pojo/app/AdvertisementVo.java

@@ -23,4 +23,9 @@ public class AdvertisementVo {
     private Map<String, String> imageUrls;
     private Map<String,String> extraInfo;
 
+    /**
+     * 版本号
+     */
+    private String version;
+
 }

+ 16 - 2
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AdvertisementServiceImpl.java

@@ -31,6 +31,11 @@ public class AdvertisementServiceImpl implements AdvertisementService {
     @Autowired
     private OssProperties ossProperties;
 
+    /**
+     * 远程弹窗控制
+     */
+    private static final String POPUP_CONTROL = "popup control";
+
     @Override
     public List<AdvertisementVo> list(QueryAdvertisementParam param) {
         List<AdvertisementVo> result = new ArrayList<>();
@@ -45,7 +50,7 @@ public class AdvertisementServiceImpl implements AdvertisementService {
         if(!StringUtils.isEmpty(slug)) {
             criteria.andSlugEqualTo(slug);
         }
-        if(!StringUtils.isEmpty(slug)) {
+        if(!StringUtils.isEmpty(language)) {
             criteria.andLanguageEqualTo(LanguageEnum.getCodeByName(language));
         }
         //获取访问域名
@@ -55,9 +60,13 @@ public class AdvertisementServiceImpl implements AdvertisementService {
             AdvertisementVo vo = new AdvertisementVo();
             Advertisements adv = advertisementList.get(0);
             BeanUtils.copyProperties(adv,vo);
-            vo.setImageUrl(viewUrl + adv.getImage());
             setExtraInfo(vo,adv);
             increaseHit(adv);
+            if(POPUP_CONTROL.equals(slug)){
+                vo.setImageUrl("");
+            } else{
+                vo.setImageUrl(viewUrl + adv.getImage());
+            }
             result.add(vo);
         }else{
             for (Advertisements adv : advertisementList) {
@@ -109,9 +118,14 @@ public class AdvertisementServiceImpl implements AdvertisementService {
         Advertisements adv = new Advertisements();
         adv.setId(CommonUtils.generateId());
         BeanUtils.copyProperties(param, adv);
+        String language = param.getLanguage();
+        if(!StringUtils.isEmpty(language)) {
+            adv.setLanguage(LanguageEnum.getCodeByName(language));
+        }
         Date now = new Date();
         adv.setCreatedAt(now);
         adv.setUpdatedAt(now);
+        adv.setTotalHits(0);
         advertisementsMapper.insert(adv);
         return "增加广告成功";
     }

+ 1 - 1
backend-core/src/main/resources/application.yml

@@ -79,7 +79,7 @@ cors:
   allow-origins: "*"
   allow-max-age: "3600"
 httpMatchers:
-  request: "/login,/logout,/members/resetPassword,/members/checkResetPasswordValid,/oauth/**,/auth/**,/members/register,/order/syncOrder,/order/alipaySyncOrder,/alipayRedirect/callback,/pricing/list,/setPricing/listForVisitor,/mission/saasCallback,/members/checkExists,/advertisement/list,/members/appResetPassword,/missionFile/getTotalConvertFile"
+  request: "/login,/logout,/members/resetPassword,/members/checkResetPasswordValid,/oauth/**,/auth/**,/members/register,/order/syncOrder,/order/alipaySyncOrder,/alipayRedirect/callback,/pricing/list,/setPricing/listForVisitor,/mission/saasCallback,/members/checkExists,/advertisement/**,/members/appResetPassword,/missionFile/getTotalConvertFile"
   web: "/hystrix.stream,/webjars/**,/resources/**,/swagger-ui.html,/swagger-resources/**,/v2/api-docs"