Forráskód Böngészése

调整三方授权

yumeng 5 éve
szülő
commit
50dc0aad44

+ 0 - 48
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java

@@ -1,48 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.service.IBindAccountAuthService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.UUID;
-
-/**
- * TODO 可以删除
- */
-@Controller
-@RequestMapping("/auth")
-public class AuthController {
-    private static final Logger logger = LoggerFactory.getLogger(AuthController.class);
-
-    @Autowired
-    private IBindAccountAuthService bindAccountAuthService;
-
-
-    @RequestMapping("/begin")
-    public String authBegin(HttpServletRequest request,
-                            HttpServletResponse response,
-                            @RequestParam("auth_type") String authType) {
-        try {
-            String codeUrl = "";
-            switch (authType) {
-                case "bytedance":
-                    codeUrl = bindAccountAuthService.getByteDanceCodeUrl(UUID.randomUUID().toString());
-                    return "redirect:" + codeUrl;
-                case "kuaishou":
-                    codeUrl = bindAccountAuthService.getKuaishouCodeUrl(UUID.randomUUID().toString());
-                    return "redirect:" + codeUrl;
-                default:
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        return "auth_error";
-    }
-}

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java

@@ -69,9 +69,10 @@ public class BindAccountAuthController {
             }
 
             String authorizationType = json.getString("authorizationType");
+            Integer agentType = json.getInteger("agentType"); // 0 三方代理商 1 本代理商
 
             if ("kuaishou".equals(authorizationType)) {
-                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(JSONObject.toJSONString(json));
+                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(JSONObject.toJSONString(json), agentType);
             }
             if ("bytedance".equals(authorizationType)) {
                 codeUrl = bindAccountAuthService.getByteDanceCodeUrl(JSONObject.toJSONString(json));

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -132,8 +132,9 @@ public class CallbackController {
             if (Check.isNull(json)) {
                 throw new Exception("回调信息为空");
             }
+            Integer agentType = json.getInteger("agentType");
             if (StringUtils.isNotBlank(authCode)) {
-                KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode);
+                KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode, agentType);
                 if (accessToken.getCode() != 0) {
                     throw new Exception("快手回调token返回错误");
                 }
@@ -144,7 +145,6 @@ public class CallbackController {
                         return "授权绑定失败!";
                     }
 
-
                     String advertiserId = json.getString("advertiserId");
                     //指定分配人姓名
                     String userName = json.getString("userName");
@@ -164,6 +164,7 @@ public class CallbackController {
                     topOauthToken.setAccountId(accountId);
                     topOauthToken.setMediaId("2");
                     topOauthToken.setAdvertiserId(advertiserId);
+                    topOauthToken.setAgentType(agentType);
                     topOauthToken.setAccessToken(token.getAccessToken());
                     long accessTokenExpireIn = token.getAccessTokenExpiresIn() * 1000L;
                     long now = System.currentTimeMillis();

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java

@@ -73,6 +73,10 @@ public class CtopOauthToken {
     @Excel(name = "刷新令牌", width = 15)
     @ApiModelProperty(value = "刷新令牌")
     private String refreshToken;
+
+
+    private Integer agentType;
+
     /**
      * 刷新令牌有效期
      */

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountAuthService.java

@@ -20,7 +20,7 @@ public interface IBindAccountAuthService extends IService<BindAccountAuth> {
      * @return
      * @throws UnsupportedEncodingException
      */
-    String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException;
+    String getKuaishouCodeUrl(String state,Integer  agentType ) throws UnsupportedEncodingException;
 
     /**
      * 获取头条url

+ 19 - 8
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java

@@ -6,7 +6,6 @@ import cn.com.ctop.common.module.service.IBindAccountAuthService;
 import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,20 +56,32 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
 
 
     @Override
-    public String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException {
+    public String getKuaishouCodeUrl(String state, Integer agentType) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();
-        sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
-                .append(KuaishouInterfaceConstant.AUTH_PATH)
-                .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_appid"))
-                .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
-                .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
-                .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
+        if (agentType == 1) {
+            sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
+                    .append(KuaishouInterfaceConstant.AUTH_PATH)
+                    .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_appid"))
+                    .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
+                    .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
+                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
+        } else if (agentType == 0) {
+            sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
+                    .append(KuaishouInterfaceConstant.AUTH_PATH)
+                    .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_third_appid"))
+                    .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
+                    .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
+                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
+        }
+
         return sb.toString();
     }
 
     @Override
     public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();
+
+
         sb.append(PropertiesUtils.getValue("bytedance_config", "bytedance_auth_url"))
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -130,7 +130,7 @@ public class KuaiShouGroup {
      */
     @Excel(name = "创意展现方式  0:未知, 1:轮播,", width = 15)
     @ApiModelProperty(value = "创意展现方式  0:未知, 1:轮播,")
-    private Integer showModel;
+    private Integer showMode;
     private Integer unitType;
     /**
      * url类型

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -24,7 +24,7 @@
         end_time,
         schedule_time,
         scene_id,
-        show_model,
+        show_mode,
         unit_type,
         url_type,
         url,
@@ -59,7 +59,7 @@
             #{getGroup.endTime},
             #{getGroup.scheduleTime},
             #{getGroup.sceneId},
-            #{getGroup.showModel},
+            #{getGroup.showMode},
             #{getGroup.unitType},
             #{getGroup.urlType},
             #{getGroup.url},

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -171,7 +171,7 @@ public interface IKuaishouInterfaceService {
      * @param authCode
      * @return
      */
-    KuaishouResultToken getAccessToken(String authCode);
+    KuaishouResultToken getAccessToken(String authCode,Integer agentType);
 
 
     /**

+ 372 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -5,13 +5,12 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.RandomUtil;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.mapper.BatchMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
 import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
@@ -25,6 +24,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -358,16 +358,32 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
+
                 Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), accountId, unitJson);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
                         JSONObject successJson = new JSONObject();
-                        successJson.put("unitId", returnUnitMap.get("unitId"));
+                        Long unitId = (Long) returnUnitMap.get("unitId");
+
+                        successJson.put("unitId", unitId);
                         successJson.put("unitName", unitName);
                         successJson.put("sceneId", scene_id);
                         successJson.put("ocpxActionType", ocpx_action_type);
                         successArr.add(successJson);
+
+
+                        String type = requestJson.getString("type");
+                        if (!Check.isNull(type) && "copy".equals(type)) {
+                            Long copyUnitId = requestJson.getLong("copyUnitId");
+                            if (!Check.isNull(unitId) && !Check.isNull(copyUnitId)) {
+                                copyCreative(accountId, unitId, copyUnitId);
+                            }
+
+
+                        }
+
+
                     } else {
                         JSONObject failJson = new JSONObject();
                         failJson.put("unitName", unitName);
@@ -386,6 +402,357 @@ public class BatchServiceImpl implements IBatchService {
         return returnJson;
     }
 
+
+    /**
+     * 复制组
+     *
+     * @param
+     * @throws Exception
+     */
+
+    @Autowired
+    private KuaiShouGroupTargetMapper targetMapper;
+
+    private JSONObject copyUnit(Long accountId, Long campaignId, Long unitId) throws Exception {
+        JSONObject returnJson = new JSONObject();
+
+        try {
+
+            QueryWrapper<KuaiShouGroup> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("unit_id", unitId);
+            KuaiShouGroup group = groupMapper.selectOne(queryWrapper);
+            if (Check.isNull(group)) {
+                throw new Exception("未获取到广告组信息");
+
+            }
+
+
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到token信息");
+            }
+
+
+            JSONObject unitJson = new JSONObject();
+            unitJson.put("campaign_id", campaignId);
+
+            // 资源位置
+            JSONArray scene_id = JSONArray.parseArray(group.getSceneId());
+            if (!Check.isNull(scene_id)) {
+                unitJson.put("scene_id", scene_id);
+            }
+
+            // 资源创作方式
+            if (!Check.isNull(group.getUnitType())) {
+                unitJson.put("unit_type", group.getUnitType());
+            }
+
+            //投放开始时间
+            if (!Check.isNull(group.getBeginTime())) {
+                unitJson.put("begin_time", group.getBeginTime());
+            }
+            // 投放结束时间
+            if (!Check.isNull(group.getEndTime())) {
+                unitJson.put("end_time", group.getEndTime());
+            }
+            // 投放时间段
+            if (!Check.isNull(group.getScheduleTime())) {
+                unitJson.put("schedule_time", group.getScheduleTime());
+            }
+            // 广告组单日预算
+            if (!Check.isNull(group.getDayBudget())) {
+                unitJson.put("day_budget", group.getDayBudget());
+            }
+            // url类型
+            if (!Check.isNull(group.getUrlType())) {
+                unitJson.put("url_type", group.getUrlType());
+            }
+            // url
+            if (!Check.isNull(group.getUrl())) {
+                unitJson.put("url", group.getUrl());
+            }
+            // appId
+            if (!Check.isNull(group.getAppId())) {
+                unitJson.put("app_id", group.getAppId());
+            }
+            // 创意展现方式
+            if (!Check.isNull(group.getShowMode())) {
+                unitJson.put("show_mode", group.getShowMode());
+            }
+            if (!Check.isNull(group.getSpeed())) {
+                unitJson.put("speed", group.getSpeed());
+            }
+
+
+            QueryWrapper<KuaiShouGroupTarget> targetQueryWrapper = new QueryWrapper<>();
+            targetQueryWrapper.eq("account_id", accountId);
+            targetQueryWrapper.eq("unit_id", unitId);
+            targetQueryWrapper.last("limit 1");
+            KuaiShouGroupTarget groupTarget = targetMapper.selectOne(targetQueryWrapper);
+            if (!Check.isNull(groupTarget)) {
+                // -----------------用户定向-----------
+                JSONObject targetJson = new JSONObject();
+
+                // 地域
+                if (!Check.isNull(groupTarget.getRegion())) {
+                    targetJson.put("region", groupTarget.getRegion());
+                }
+
+                // 自定义年龄段
+                Integer ageMin = groupTarget.getAgeMin();
+                Integer ageMax = groupTarget.getAgeMax();
+
+
+                JSONObject ageJson = new JSONObject();
+                if (!Check.isNull(ageMin)) {
+                    ageJson.put("min", ageMin);
+
+                }
+                if (!Check.isNull(ageMax)) {
+                    ageJson.put("max", ageMax);
+
+                }
+
+                targetJson.put("age", ageJson);
+
+                // 固定年龄段
+                if (!Check.isNull(groupTarget.getAgesRange())) {
+                    targetJson.put("ages_range", groupTarget.getAgesRange());
+                }
+                // 性别
+                if (!Check.isNull(groupTarget.getGender())) {
+                    targetJson.put("gender", groupTarget.getGender());
+                }
+                //操作系统
+                if (!Check.isNull(groupTarget.getPlatformOs())) {
+                    targetJson.put("platform_os", groupTarget.getPlatformOs());
+                }
+                //Android版本
+                if (!Check.isNull(groupTarget.getAndroidOsv())) {
+                    targetJson.put("android_osv", groupTarget.getAndroidOsv());
+                }
+                // iOS版本
+                if (!Check.isNull(groupTarget.getIosOsv())) {
+                    targetJson.put("ios_osv", groupTarget.getIosOsv());
+                }
+                //网络环境
+                if (!Check.isNull(groupTarget.getNetwork())) {
+                    targetJson.put("network", groupTarget.getNetwork());
+                }
+                //设备品牌
+                if (!Check.isNull(groupTarget.getDeviceBrand())) {
+                    targetJson.put("device_brand", groupTarget.getDeviceBrand());
+                }
+                //设备价格
+                if (!Check.isNull(groupTarget.getDevicePrice())) {
+                    targetJson.put("device_price", groupTarget.getDevicePrice());
+                }
+                //商业兴趣类型
+                if (!Check.isNull(groupTarget.getBusinessInterestType())) {
+                    targetJson.put("business_interest_type", groupTarget.getBusinessInterestType());
+                }
+                // 商业兴趣
+                if (!Check.isNull(groupTarget.getBusinessInterest())) {
+                    targetJson.put("business_interest", groupTarget.getBusinessInterest());
+                }
+                //网红粉丝
+                if (!Check.isNull(groupTarget.getFansStar())) {
+                    targetJson.put("fans_star", groupTarget.getFansStar());
+                }
+                //兴趣视频用户
+                if (!Check.isNull(groupTarget.getInterestVideo())) {
+                    targetJson.put("interest_video", groupTarget.getInterestVideo());
+                }
+                // APP行为-按分类
+                if (!Check.isNull(groupTarget.getAppInterest())) {
+                    targetJson.put("app_interest", groupTarget.getAppInterest());
+                }
+                // APP行为-按APP名称
+                if (!Check.isNull(groupTarget.getAppIds())) {
+                    targetJson.put("app_ids", groupTarget.getAppIds());
+                }
+                // 人群包定向
+                if (!Check.isNull(groupTarget.getPopulation())) {
+                    targetJson.put("population", groupTarget.getPopulation());
+                }
+                // 人群包排除
+                if (!Check.isNull(groupTarget.getExcludePopulation())) {
+                    targetJson.put("exclude_population", groupTarget.getExcludePopulation());
+                }
+
+                JSONObject intelliExtendJson = new JSONObject();
+
+                // 开启智能扩量
+                if (!Check.isNull(groupTarget.getIsOpen())) {
+                    intelliExtendJson.put("is_open", groupTarget.getIsOpen());
+                }
+                //不可突破年龄
+                if (!Check.isNull(groupTarget.getNoAgeBreak())) {
+                    intelliExtendJson.put("no_age_break", groupTarget.getNoAgeBreak());
+                }
+                //不可突破性别
+                if (!Check.isNull(groupTarget.getNoGenderBreak())) {
+                    intelliExtendJson.put("no_gender_break", groupTarget.getNoGenderBreak());
+                }
+                // 不可突破地域
+                if (!Check.isNull(groupTarget.getNoAreaBreak())) {
+                    intelliExtendJson.put("no_area_break", groupTarget.getNoAreaBreak());
+                }
+                if (!Check.isNull(intelliExtendJson)) {
+                    targetJson.put("intelli_extend", intelliExtendJson);
+                }
+
+                unitJson.put("target", targetJson);
+
+
+            }
+
+
+            // 出价
+            if (!Check.isNull(group.getBid())) {
+                unitJson.put("bid", group.getBid());
+            }
+            // 出价类型
+            Integer bidType = group.getBidType();
+            if (!Check.isNull(bidType)) {
+                unitJson.put("bid_type", bidType);
+            }
+            // 深度转化出价
+            if (!Check.isNull(group.getCpaBid())) {
+                unitJson.put("cpa_bid", group.getCpaBid());
+            }
+            // 深度转化目标出价
+            if (!Check.isNull(group.getDeepConversionBid())) {
+                unitJson.put("deep_conversion_bid", group.getDeepConversionBid());
+            }
+            // 深度转化目标
+            if (!Check.isNull(group.getDeepConversionType())) {
+                unitJson.put("deep_conversion_type", group.getDeepConversionType());
+            }
+            // 优化目标
+            Integer ocpx_action_type = group.getOcpxActionType();
+            if (!Check.isNull(ocpx_action_type)) {
+                unitJson.put("ocpx_action_type", ocpx_action_type);
+            }
+            String unitName = group.getUnitName();
+            if (!Check.isNull(unitName)) {
+                unitJson.put("unit_name", unitName);
+            }
+
+
+            Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), accountId, unitJson);
+            if (!Check.isNullMap(returnUnitMap)) {
+                Integer code = (Integer) returnUnitMap.get("code");
+                if (code == 0) {
+                    JSONObject successJson = new JSONObject();
+                    successJson.put("unitId", returnUnitMap.get("unitId"));
+                    successJson.put("unitName", unitName);
+                    successJson.put("sceneId", scene_id);
+                    successJson.put("ocpxActionType", ocpx_action_type);
+                    //  successArr.add(successJson);
+
+
+                    // String type = requestJson.getString("type");
+                    //   if (Check.isNull(type) && "copy".equals(type)) {
+                    // Long copyUnitId = requestJson.getLong("copyUnitId");
+                    //   copyCreative(accountId, copyUnitId);
+
+                    // }
+
+
+                } else {
+                    JSONObject failJson = new JSONObject();
+                    failJson.put("unitName", unitName);
+                    failJson.put("failMessage", returnUnitMap.get("message"));
+                    // failArr.add(failJson);
+                }
+
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+
+        }
+
+        return returnJson;
+    }
+
+
+
+
+    /**
+     * 复制创意
+     *
+     * @param accountId
+     * @param unitId
+     */
+    private void copyCreative(Long accountId, Long unitId, Long copyUnitId) throws Exception {
+        // 查询当前复制组下的所有非程序化创意
+
+        QueryWrapper<KuaiShouCreative> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("unit_id", copyUnitId);
+        //   queryWrapper.eq("status", 52);
+        List<KuaiShouCreative> creativeList = creativeMapper.selectList(queryWrapper);
+        if (!Check.isNull(creativeList)) {
+            for (KuaiShouCreative creative : creativeList) {
+                if (Check.isNull(creative.getPhotoId())) {
+                    continue;
+                }
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+                if (Check.isNull(oauthToken)) {
+                    throw new Exception("未获取到账户信息");
+                }
+                JSONObject creativeJson = new JSONObject();
+                creativeJson.put("advertiser_id", accountId);
+                creativeJson.put("unit_id", unitId);
+
+                // 素材类型
+                if (!Check.isNull(creative.getCreativeMaterialType())) {
+                    creativeJson.put("creative_material_type", creative.getCreativeMaterialType());
+                }
+                String action_bar_text = creative.getActionBarText();
+                // 视频id
+                String click_track_url = creative.getClickTrackUrl();
+                JSONArray successArr = new JSONArray();
+                JSONArray failArr = new JSONArray();
+                String description = creative.getDescription();
+                String photo_id = creative.getPhotoId();
+                String image = creative.getImageToken();
+                String name = creative.getCreativeName();
+                creativeJson.put("action_bar_text", action_bar_text);
+                creativeJson.put("description", description);
+                creativeJson.put("image_token", image);
+                creativeJson.put("creative_name", name + RandomUtil.verifyCode());
+                creativeJson.put("photo_id", photo_id);
+                creativeJson.put("click_track_url", click_track_url);
+
+                Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson);
+                if (!Check.isNullMap(returnCreativeMap)) {
+                    Integer code = (Integer) returnCreativeMap.get("code");
+                    if (code == 0) {
+                        JSONObject successJson = new JSONObject();
+                        successJson.put("creativeName", name);
+                        successArr.add(successJson);
+                    } else {
+                        JSONObject failJson = new JSONObject();
+                        failJson.put("creativeName", name);
+                        failJson.put("failMessage", returnCreativeMap.get("message"));
+                        failArr.add(failJson);
+                    }
+                }
+
+
+            }
+
+
+        }
+    }
+
     /**
      * 获取广告组信息
      *

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

@@ -1268,7 +1268,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setEndTime(detail.getString("end_time"));
                     group.setScheduleTime(detail.getString("schedule_time"));
                     group.setSceneId(detail.getJSONArray("scene_id") + "");
-                    group.setShowModel(detail.getInteger("show_mode"));
+                    group.setShowMode(detail.getInteger("show_mode"));
                     group.setUnitType(detail.getInteger("unit_type"));
                     group.setUrlType(detail.getInteger("url_type"));
                     group.setUrl(detail.getString("url"));
@@ -1685,12 +1685,19 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @return
      */
     @Override
-    public KuaishouResultToken getAccessToken(String authCode) {
+    public KuaishouResultToken getAccessToken(String authCode, Integer agentType) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AUTH_TOKEN;
         JSONObject requestJson = new JSONObject();
         requestJson.put("auth_code", authCode);
-        requestJson.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
-        requestJson.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+
+        if (agentType == 1) { // 本代理商开户
+            requestJson.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
+            requestJson.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+        } else if (agentType == 0) {
+            requestJson.put("app_id", PropertiesUtils.getConfig("kuaishou_third_appid"));
+            requestJson.put("secret", PropertiesUtils.getConfig("kuaishou_third_secret"));
+        }
+
 
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", " application/json");

+ 3 - 3
module-kuaishou/src/main/resources/kuaishou_config.properties

@@ -1,11 +1,11 @@
 kuaishou_api_url=https://ad.e.kuaishou.com
 kuaishou_auth_url=https://ad.e.kuaishou.com
 kuaishou_appid=27
+kuaishou_third_appid=328
 oauth_type=agent
-kuaishou_secret=QovprB1tNhXptgDc
+kuaishou_secret=1iFTBiMdohkyEQQs
+kuaishou_third_secret=QovprB1tNhXptgDc
 kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
-
-
 apk_sava_path=/mnt/file/apk
 image_sava_path=/mnt/file/image
 video_sava_path=/mnt/file/video

+ 2 - 0
moudule-eureca/src/main/java/cn/com/ctop/eureca/server/ServerApplication.java

@@ -1,3 +1,4 @@
+/*
 package cn.com.ctop.eureca.server;
 
 import org.springframework.boot.SpringApplication;
@@ -12,3 +13,4 @@ public class ServerApplication {
         SpringApplication.run(ServerApplication.class, args);
     }
 }
+*/