Просмотр исходного кода

创建快手广告组——添加广告组和定向模板绑定关系

zhaoxian 4 лет назад
Родитель
Сommit
fddc744f78

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CrossAccountBatchServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSON;
@@ -35,6 +36,8 @@ public class CrossAccountBatchServiceImpl implements ICrossAccountBatchService {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
+    @Autowired
+    private IKuaishouDirectionalPackageService directionalPackageService;
 
     /**
      * 组装数据  jason
@@ -457,6 +460,24 @@ public class CrossAccountBatchServiceImpl implements ICrossAccountBatchService {
                         returnJson.put("ocpxActionType", requestJson.getLong("ocpx_action_type"));
                         returnJson.put("bidType", requestJson.getLong("bid_type"));
                         returnJson.put("unitType", requestJson.getInteger("unit_type"));
+
+                        //添加广告组和定向模板绑定关系
+                        if (!Check.isNull(requestJson.getLong("templateId"))) {
+                            Thread thread2 = new Thread() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        JSONObject request = new JSONObject();
+                                        request.put("unitId", unitId);
+                                        request.put("templateId", requestJson.getLong("templateId"));
+                                        directionalPackageService.createUnitAndTemplate(request);
+                                    } catch (Exception e) {
+                                        log.error(e.getMessage());
+                                    }
+                                }
+                            };
+                            thread2.start();
+                        }
                     }
 
                 } else {

+ 20 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -10,6 +10,7 @@ import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
@@ -119,6 +120,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private IWarningOperationService warningOperationService;
 
+    @Autowired
+    private IKuaishouDirectionalPackageService directionalPackageService;
 
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
@@ -971,6 +974,23 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnMap.put("message", "success");
                         returnMap.put("unitId", unitId);
                         returnMap.put("success", true);
+                        //添加广告组和定向模板绑定关系
+                        if (!Check.isNull(requestJson.getLong("templateId"))) {
+                            Thread thread2 = new Thread() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        JSONObject request = new JSONObject();
+                                        request.put("unitId", unitId);
+                                        request.put("templateId", requestJson.getLong("templateId"));
+                                        directionalPackageService.createUnitAndTemplate(request);
+                                    } catch (Exception e) {
+                                        log.error(e.getMessage());
+                                    }
+                                }
+                            };
+                            thread2.start();
+                        }
                     }
 
                 } else {