Преглед изворни кода

违规广告 入库+发微信消息 youhua

zhaoxian пре 1 година
родитељ
комит
30837e1b40

+ 1 - 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -162,7 +162,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
         filterChainDefinitionMap.put("/sys/dictItem/list", "anon");
         //头条接口
-        filterChainDefinitionMap.put("/bytedance", "anon");
+        filterChainDefinitionMap.put("/bytedance/**", "anon");
         filterChainDefinitionMap.put("/toutiao/loadAllData", "anon");
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
         filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");

+ 17 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java

@@ -7,6 +7,7 @@ import cn.com.ctop.common.module.service.ISendMessageService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceVideoInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.ByteDanceVideoInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceVideoInfoService;
@@ -58,8 +59,12 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
 
     @Override
     public void getIllegalVideosPushInfo(Long agentId, List<Long> list, Long promotionId) {
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(73970348172l);
-        String url = "https://api.oceanengine.com/open_api/2/agent/query/risk_promotion_list/";
+        String adid = PropertiesUtils.getValue("bytedance_config", "admin_account_id");
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(Long.valueOf(adid));
+
+        //广告违规素材推送
+        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_rapi_url") +
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_risk_promotion_list");
         Map<String, Object> param = new HashMap<>();
         param.put("agent_id", agentId);
         param.put("business_type", "AD");
@@ -69,8 +74,6 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
         param.put("end_date", today);
 
         JSONObject filtering = new JSONObject();
-//        JSONArray arr = new JSONArray();
-//        arr.add(7361676756829896740l);
         filtering.put("illegal_material_ids", list);
         param.put("filtering", filtering);
 
@@ -89,6 +92,8 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
         }
     }
 
+    private static Map<String, String> sendMap = new HashMap<>();
+
     //违规信息入库
     private void storageIllegalInfo(JSONArray array, Long promotionId) {
         try {
@@ -113,8 +118,14 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
                     JSONObject info = getmaterialData(data, materialObj);
                     list.add(info);
                     if (promotionId.equals(promotion_id)) {
-                        //发送企业微信提醒  obj
-                        sendMsg(info);
+                        //发送企业微信提醒
+                        //素材ID+计划
+                        String key = info.getString("materialId") + promotion_id;
+                        String val = sendMap.get(key);
+                        if (Check.isNull(val)) {
+                            sendMsg(info);
+                            sendMap.put(key, "send");
+                        }
                     }
                 }
             }

+ 6 - 0
jeecg-boot-module-system/src/main/resources/bytedance_config.properties

@@ -5,6 +5,7 @@ bytedance_secret=0c51523e90d6166418fc8421a4896808e90e26f4
 # bytedance_secret=34bc59f53955c66871ce111a1f15a6051cfa3f12
 #release
 bytedance_api_url=https://ad.oceanengine.com/open_api
+bytedance_rapi_url=https://api.oceanengine.com/open_api
 bytedance_auth_url=https://ad.oceanengine.com/openapi
 #sandbox
 #bytedance_api_url=https://test-ad.toutiao.com/open_api
@@ -33,3 +34,8 @@ bytedance_v2_campaign_report_get=/2/report/campaign/get/
 bytedance_v2_ad_report_get=/2/report/ad/get/
 bytedance_v2_ad_creative_get=/2/report/creative/get/
 bytedance_v2_creative_word_select=/2/tools/creative_word/select/
+#广告违规素材推送↓
+bytedance_v2_risk_promotion_list=/2/agent/query/risk_promotion_list/
+#转账-查询账户转账余额(代理)↓
+bytedance_v3_query_transfer_balance=/v3.0/cg_transfer/query_transfer_balance/
+admin_account_id=73970348172