瀏覽代碼

批量批量2.0支持最大转化创建

yumeng 2 年之前
父節點
當前提交
55145e70e0

+ 36 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -463,6 +463,10 @@ public class BatchController {
             campaignJson.put("campaign_name", requestJson.getString("campaignName"));
             campaignJson.put("type", requestJson.getInteger("type"));
             campaignJson.put("day_budget", requestJson.getLong("dayBudget"));
+            Integer bidType = requestJson.getInteger("bidType");
+            if (!Check.isNull(bidType)) {
+                campaignJson.put("bid_type", requestJson.getLong("bidType"));
+            }
             Map<String, Object> campaignMap = iKuaishouInterfaceService.campaignCreate(oauthToken.getAccessToken(), accountId, campaignJson);
             Integer code = (Integer) campaignMap.get("code");
             if (code != 0) {
@@ -610,7 +614,7 @@ public class BatchController {
         return result;
     }
 
-@PostMapping(value = "/deepTypes")
+    @PostMapping(value = "/deepTypes")
     public Result<JSONObject> deepTypes(@RequestBody JSONObject requestJson) {
         Result result = new Result<JSONObject>();
         try {
@@ -626,7 +630,37 @@ public class BatchController {
             Long appId = requestJson.getLong("appId");
             Integer ocpxActionType = requestJson.getInteger("ocpxActionType");
 
-            JSONObject deepConversionJson = iKuaishouInterfaceService.deepTypes(accountId, token.getAccessToken(), sceneCategory, campaignType, sceneIds, appId,ocpxActionType);
+            JSONObject deepConversionJson = iKuaishouInterfaceService.deepTypes(accountId, token.getAccessToken(), sceneCategory, campaignType, sceneIds, appId, ocpxActionType);
+            if (Check.isNull(deepConversionJson)) {
+                throw new Exception("深度类型数据返回为空");
+            }
+            result.setSuccess(true);
+            result.setResult(deepConversionJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    @PostMapping(value = "/mcbConversionInfos")
+    public Result<JSONObject> mcbConversionInfos(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONObject>();
+        try {
+
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            Integer sceneCategory = requestJson.getInteger("sceneCategory");
+            Integer campaignType = requestJson.getInteger("campaignType");
+            JSONArray sceneIds = requestJson.getJSONArray("sceneIds");
+            Long appId = requestJson.getLong("appId");
+
+            JSONObject deepConversionJson = iKuaishouInterfaceService.mcbConversionInfos(accountId, token.getAccessToken(), sceneCategory, campaignType, sceneIds, appId);
             if (Check.isNull(deepConversionJson)) {
                 throw new Exception("深度类型数据返回为空");
             }

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCampaign.java

@@ -97,6 +97,7 @@ public class KuaiShouCampaign {
     @Excel(name = "广告修改时间", width = 15)
     @ApiModelProperty(value = "广告投放时间")
     private String putUpdateTime;
+    private Integer bidType;
 
 
     /**

+ 5 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCampaignMapper.xml

@@ -15,7 +15,8 @@
         put_create_time,
         put_update_time,
         create_time,
-        update_time)
+        update_time,
+        bid_type)
         values
         <foreach collection="campaigns" item="campaign" separator=",">
             (#{campaign.id},
@@ -30,7 +31,9 @@
             #{campaign.putCreateTime},
             #{campaign.putUpdateTime},
             #{campaign.createTime},
-            #{campaign.updateTime})
+            #{campaign.updateTime},
+            #{campaign.bidType}
+            )
         </foreach>
     </insert>
 

+ 11 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -495,6 +495,17 @@ public interface IKuaishouInterfaceService {
 
     JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds);
 
+    /**
+     * mcb 转化方式
+     * @param accountId
+     * @param accessToken
+     * @param sceneCategory
+     * @param campaignType
+     * @param sceneIds
+     * @param appId
+     * @return
+     */
+    JSONObject mcbConversionInfos(Long accountId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId);
 }
 
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -668,7 +668,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             }
 
         }
-        System.err.println(resultJson);
+    //    System.err.println(resultJson);
         return resultJson;
     }
 

+ 39 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1158,7 +1158,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 campaign.setCreateChannel(detail.getInteger("create_channel"));
                 campaign.setPutCreateTime(detail.getString("create_time"));
                 campaign.setPutUpdateTime(detail.getString("update_time"));
-
+                campaign.setBidType(detail.getInteger("bid_type"));
                 campaigns.add(campaign);
             }
         }
@@ -3484,5 +3484,43 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    @Override
+    public JSONObject mcbConversionInfos(Long accountId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/gw/dsp/v1/ocpc/mcb/ocpx_types";
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        if (!Check.isNull(campaignType)) {
+            param.put("campaign_type", campaignType);
+        }
+        if (!Check.isNull(appId)) {
+            param.put("app_id", appId);
+        }
+        if (!Check.isNull(sceneCategory)) {
+            param.put("scene_category", sceneCategory);
+        }
+
+        if (!Check.isNull(sceneIds)) {
+            param.put("scene_ids", sceneIds);
+        }
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject returnJson = new JSONObject();
+        try {
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            returnJson = JSONObject.parseObject(result);
+            if (Check.isNull(returnJson)) {
+                returnJson.put("code", -1);
+                returnJson.put("message", "返回信息为空");
+            }
+
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", "系统错误");
+
+        }
+        return returnJson;
+    }
+
 
 }