|
@@ -394,12 +394,13 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
}
|
|
|
//获取图片MD5
|
|
|
JSONObject dataJson = kuaishouAppPackageService.getImageToken(md5, token.getAccountId(), token);
|
|
|
- String imageToken = dataJson.getString("image_token");
|
|
|
- if (Check.isNull(imageToken)) {
|
|
|
- throw new Exception("获取图片token失败:" + dataJson.getString("message"));
|
|
|
+ if (Check.isNull(dataJson)) {
|
|
|
+ obj.put("message", "通过账户ID(" + token.getAccountId() + ")获取图片token,返回结果为空");
|
|
|
+ return obj;
|
|
|
}
|
|
|
obj.put("md5", md5);
|
|
|
- obj.put("imageToken", imageToken);
|
|
|
+ obj.put("imageToken", dataJson.getString("image_token"));
|
|
|
+ obj.put("message", "通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + dataJson.getString("message"));
|
|
|
LoadFileUtil.delFile(newFileUrl);
|
|
|
return obj;
|
|
|
} catch (Exception e) {
|
|
@@ -626,7 +627,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
imageToken = tokenJson.getString("imageToken");
|
|
|
md5 = tokenJson.getString("md5");
|
|
|
if (Check.isNull(imageToken)) {
|
|
|
- return Result.error("通过账户ID(" + accountId + ")获取图片Token失败");
|
|
|
+ return Result.error(tokenJson.getString("message"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -718,8 +719,8 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
}
|
|
|
}
|
|
|
if (!list.isEmpty()) {
|
|
|
- for (JSONObject object : list) {
|
|
|
- customizedCreate(object, 2);
|
|
|
+ for (JSONObject request : list) {
|
|
|
+ customizedCreate(request, 2);
|
|
|
}
|
|
|
}
|
|
|
return Result.ok("文件导入成功");
|
|
@@ -858,10 +859,10 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
|
|
|
} else {
|
|
|
/**============================项目范围============================*/
|
|
|
- if ("account".equals(usageLevel)) {
|
|
|
- //---------------------账户层级---------------------
|
|
|
- return doProjectRangeAccountLevel(accountId, strategys);
|
|
|
- } else if ("plan".equals(usageLevel) && usageLevel.equals(level)) {
|
|
|
+ if ("account".equals(usageLevel)) {
|
|
|
+ //---------------------账户层级---------------------
|
|
|
+ return doProjectRangeAccountLevel(accountId, strategys);
|
|
|
+ } else if ("plan".equals(usageLevel) && usageLevel.equals(level)) {
|
|
|
//---------------------计划层级---------------------
|
|
|
return doProjectRangePlanLevel(accountId, strategys);
|
|
|
} else if ("group".equals(usageLevel)) {
|
|
@@ -877,45 +878,45 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
for (KuaishouChannelCreateStrategy strategy : strategys) {
|
|
|
boolean flag = false;
|
|
|
Integer cycleTimes = strategy.getCycleTimes();//可循环次数
|
|
|
- if (strategy.getCreateType() == 1) {
|
|
|
- /**---------------------组、计划 批量 创建逻辑--------------------------*/
|
|
|
- Integer numberMin = strategy.getNumberMin();
|
|
|
- Integer numberMax = strategy.getNumberMax(); //编号最大值
|
|
|
- //查询所有该策略下创建的渠道号
|
|
|
- List<KuaishouChannel> builtChannel = channelMapper.queryMaxChannelNumber(strategy.getId());
|
|
|
- if (!Check.isNull(builtChannel)) {
|
|
|
- for (KuaishouChannel maxChannel : builtChannel) {
|
|
|
- Integer haveCycleTimes = maxChannel.getHaveCycleTimes();//已用次数
|
|
|
- Long channelNumber = maxChannel.getChannelNumber();//已建最大编码
|
|
|
- //判断可循环次数>已循环次数
|
|
|
- if (cycleTimes >= haveCycleTimes) {
|
|
|
- //判断已建的编码,是否最大值,是,就跳过
|
|
|
- if (channelNumber >= numberMax) {
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- //本次可用编码
|
|
|
- int number = channelNumber.intValue() + 1;
|
|
|
- //查询到计划或者组级未被分配给账户的渠道号
|
|
|
- //获取token
|
|
|
- CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
- //获取应用图片token
|
|
|
- JSONObject tokenJson = getAccountImgToken(strategy.getAppIconUrl(), token);
|
|
|
- strategy.setImageToken(tokenJson.getString("imageToken"));
|
|
|
- //使用范围是账户时,查询旧app来做匹配
|
|
|
- List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(accountId);
|
|
|
- strategy.setAccountId(accountId);
|
|
|
- KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, number);
|
|
|
+ if (strategy.getCreateType() == 1) {
|
|
|
+ /**---------------------组、计划 批量 创建逻辑--------------------------*/
|
|
|
+ Integer numberMin = strategy.getNumberMin();
|
|
|
+ Integer numberMax = strategy.getNumberMax(); //编号最大值
|
|
|
+ //查询所有该策略下创建的渠道号
|
|
|
+ List<KuaishouChannel> builtChannel = channelMapper.queryMaxChannelNumber(strategy.getId());
|
|
|
+ if (!Check.isNull(builtChannel)) {
|
|
|
+ for (KuaishouChannel maxChannel : builtChannel) {
|
|
|
+ Integer haveCycleTimes = maxChannel.getHaveCycleTimes();//已用次数
|
|
|
+ Long channelNumber = maxChannel.getChannelNumber();//已建最大编码
|
|
|
+ //判断可循环次数>已循环次数
|
|
|
+ if (cycleTimes >= haveCycleTimes) {
|
|
|
+ //判断已建的编码,是否最大值,是,就跳过
|
|
|
+ if (channelNumber >= numberMax) {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ //本次可用编码
|
|
|
+ int number = channelNumber.intValue() + 1;
|
|
|
+ //查询到计划或者组级未被分配给账户的渠道号
|
|
|
+ //获取token
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
+ //获取应用图片token
|
|
|
+ JSONObject tokenJson = getAccountImgToken(strategy.getAppIconUrl(), token);
|
|
|
+ strategy.setImageToken(tokenJson.getString("imageToken"));
|
|
|
+ //使用范围是账户时,查询旧app来做匹配
|
|
|
+ List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(accountId);
|
|
|
+ strategy.setAccountId(accountId);
|
|
|
+ KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, number);
|
|
|
// createApp(strategy, token, oldAppList);
|
|
|
// createChannel(strategy, number, 1);
|
|
|
- flag = true;
|
|
|
- break;
|
|
|
- }
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
-
|
|
|
}
|
|
|
+ } else {
|
|
|
+
|
|
|
}
|
|
|
+ }
|
|
|
if (flag) {
|
|
|
break;
|
|
|
}
|