瀏覽代碼

行动号召字段内容获取

yangzian 4 年之前
父節點
當前提交
727f8dde57

+ 2 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingService.java

@@ -64,4 +64,6 @@ public interface MarketingService {
     JSONObject imageUpload(CtopOauthToken token, String imageUrl);
 
     JSONObject getSuggestImageId(CtopOauthToken token, String vid);
+
+    Result getActionText(CtopOauthToken token, String landing_type,String advanced_creative_type);
 }

+ 38 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingServiceImpl.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.bytedance.advertise.dockapi;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -938,7 +939,7 @@ public class MarketingServiceImpl implements MarketingService{
         //小程序app_schema
         params.put("app_schema", convertQueryVo.getAppSchema());
         //附加创意类型
-        params.put("advanced_creative_type", convertQueryVo.getAdvancedCreativeType() == null ? "ATTACHED_CREATIVE_NONE" : convertQueryVo.getAdvancedCreativeType());
+        params.put("advanced_creative_type", convertQueryVo.getAdvancedCreativeType() == null ? "NORMAL" : convertQueryVo.getAdvancedCreativeType());
         //游戏预约场景
         params.put("marketing_scene",convertQueryVo.getMarketingScene());
         params = Check.jsonRemoveEmpty(params);
@@ -1039,4 +1040,40 @@ public class MarketingServiceImpl implements MarketingService{
         data.put("video_id", vid);
         return HttpUtils.bytedanceGetRequest(token.getAccessToken(),url,data);
     }
+
+
+    /**
+     *
+     * @description: 行动号召字段内容获取
+     *
+     * @param token
+     * @param landingType  推广类型
+     * @param advancedCreativeType 附加创意类型
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public  Result getActionText(CtopOauthToken token, String landingType,String advancedCreativeType) {
+
+        JSONObject data = new JSONObject();
+        data.put("advertiser_id", token.getAccountId());
+        data.put("landing_type", landingType);
+        data.put("advanced_creative_type", advancedCreativeType);
+        //data.put("industry", "");
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_tools_action_text_get"),data);
+
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+
+        if (null == code || !code.equals(0)) {
+            log.info("行动号召字段内容获取接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONArray dataList = jsonObject.getJSONArray("data");
+        if (null == dataList || dataList.isEmpty()) {
+            log.info("行动号召字段内容获取不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("行动号召字段内容获取");
+        }
+        return Result.successMsg("获取行动号召成功",dataList);
+    }
 }

+ 3 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IAiBytedanceAdvertiserStrategyService.java

@@ -96,4 +96,7 @@ public interface IAiBytedanceAdvertiserStrategyService extends IService<AiByteda
     List<AiBytedanceAdvertiserStrategy> getByAccountId(Long accountId,Integer status);
 
     void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour,String openUrl);
+
+    Result getAdActionText(String accountId,String landingType,String advancedCreativeType) throws Exception;
+
 }

+ 22 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
@@ -1226,4 +1227,25 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             this.createCreative(strategy, 4, remindCnt,openUrl);
         }
     }
+
+
+
+    /**
+     *
+     * @description:获取行动号召
+     *
+     * @param accountId
+     * @param landingType
+     * @param advancedCreativeType
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public Result getAdActionText(String accountId,String landingType,String advancedCreativeType) throws Exception{
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
+       return marketingService.getActionText(token,landingType,advancedCreativeType);
+    }
+
+
+
+
 }

+ 3 - 3
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/utils/Check.java

@@ -83,9 +83,9 @@ public class Check {
     public static JSONObject jsonRemoveEmpty(JSONObject jsonObject){
         JSONObject jsonResult = new JSONObject();
         for (Object key :jsonObject.keySet() ) {
-            String value =(String) jsonObject.get(key);
-            if (!Check.isNull(value)){
-                jsonResult.put(key.toString(), value);
+            String k = (String) jsonObject.get(key);
+            if (!Check.isNull(k)){
+                jsonResult.put(key.toString(), k);
             }
         }
         return jsonResult;

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

@@ -76,6 +76,12 @@ bytedance_v2_tools_ad_convert_query=/2/tools/ad_convert/query/
 bytedance_v2_tools_video_cover_suggest=/2/tools/video_cover/suggest/
 
 
+#\u884C\u52A8\u53F7\u53EC\u5B57\u6BB5\u5185\u5BB9\u83B7\u53D6
+bytedance_v2_tools_action_text_get=/2/tools/action_text/get/
+
+
+
+
 bytedance_v2_advertiser_report_get=/2/report/advertiser/get/
 bytedance_v2_campaign_report_get=/2/report/campaign/get/
 bytedance_v2_ad_report_get=/2/report/ad/get/

+ 20 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -124,7 +124,6 @@ public class AiBytedanceAdvertiserStrategyController {
 	@ApiOperation(value="头条智能投放账户配置信息表-编辑", notes="头条智能投放账户配置信息表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<AiBytedanceAdvertiserStrategy> edit(@RequestBody AiBytedanceAdvertiserStrategy aiBytedanceAdvertiserStrategy) {
-		Result<AiBytedanceAdvertiserStrategy> result = new Result<AiBytedanceAdvertiserStrategy>();
 		//商品卖点
 		aiBytedanceAdvertiserStrategy.setCreativeProductSellingPoints(org.apache.commons.lang3.StringUtils.join(aiBytedanceAdvertiserStrategy.getProductSellingPoints(), ","));
 		//广告位置
@@ -133,16 +132,16 @@ public class AiBytedanceAdvertiserStrategyController {
 		aiBytedanceAdvertiserStrategy.setCreativeAdKeywords(org.apache.commons.lang3.StringUtils.join(aiBytedanceAdvertiserStrategy.getAdKeywords(), ","));
 
 		AiBytedanceAdvertiserStrategy aiBytedanceAdvertiserStrategyEntity = aiBytedanceAdvertiserStrategyService.getById(aiBytedanceAdvertiserStrategy.getId());
-		if(aiBytedanceAdvertiserStrategyEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
+		if (aiBytedanceAdvertiserStrategyEntity == null) {
+			return Result.errorMsg("未找到对应实体");
+		} else {
 			boolean ok = aiBytedanceAdvertiserStrategyService.updateById(aiBytedanceAdvertiserStrategy);
-			if(ok) {
-				result.success("修改成功!");
+			if (!ok) {
+				return Result.errorMsg("修改失败!");
 			}
 		}
+		return Result.successMsg("修改成功!", null);
 
-		return result;
 	}
 
 	/**
@@ -371,6 +370,20 @@ public class AiBytedanceAdvertiserStrategyController {
 	}
 
 
+	@ApiOperation(value="获取行动号召", notes="获取行动号召")
+	@GetMapping(value = "/getAdActionText")
+	public Result getAdActionText(@RequestParam("accountId") String accountId,
+								  @RequestParam("landingType") String landingType,
+								  @RequestParam(value = "advancedCreativeType",required = false) String advancedCreativeType) {
+		try {
+			return aiBytedanceAdvertiserStrategyService.getAdActionText(accountId,landingType,advancedCreativeType);
+		}catch (Exception e){
+			log.error("获取行动号召异常",e.getMessage());
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+