|
@@ -205,6 +205,11 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
boolean save = channelCreateStrategyService.save(strategy);
|
|
boolean save = channelCreateStrategyService.save(strategy);
|
|
//下载链接
|
|
//下载链接
|
|
String url = strategy.getUrl();
|
|
String url = strategy.getUrl();
|
|
|
|
+
|
|
|
|
+ String appIconUrl = strategy.getAppIconUrl();
|
|
|
|
+ if (!Check.isNull(appIconUrl) && !appIconUrl.contains("http")) {
|
|
|
|
+ strategy.setAppIconUrl("https:" + appIconUrl);
|
|
|
|
+ }
|
|
/**==========================范围是 项目==========================*/
|
|
/**==========================范围是 项目==========================*/
|
|
if (usageRange == 2) {
|
|
if (usageRange == 2) {
|
|
String usageLevel = strategy.getUsageLevel();
|
|
String usageLevel = strategy.getUsageLevel();
|
|
@@ -658,6 +663,9 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
return Result.error("解析数据失败,文档中第" + (i + 1) + "行,账户ID列缺失数据");
|
|
return Result.error("解析数据失败,文档中第" + (i + 1) + "行,账户ID列缺失数据");
|
|
} else {
|
|
} else {
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountId));
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountId));
|
|
|
|
+ if (!imageUrl.contains("http")) {
|
|
|
|
+ imageUrl = "https:" + imageUrl;
|
|
|
|
+ }
|
|
JSONObject tokenJson = appInfoService.uploadAppIconImage(imageUrl, token.getAccountId(), token.getAccessToken());
|
|
JSONObject tokenJson = appInfoService.uploadAppIconImage(imageUrl, token.getAccountId(), token.getAccessToken());
|
|
if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
|
|
if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
|
|
log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
|
|
log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
|
|
@@ -810,8 +818,11 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
strategy.setStateDate(DateUtils.getDate(DateUtils.WEB_FORMAT));
|
|
strategy.setStateDate(DateUtils.getDate(DateUtils.WEB_FORMAT));
|
|
|
|
+ String appIconUrl = strategy.getAppIconUrl();
|
|
|
|
+ if (!Check.isNull(appIconUrl) && !appIconUrl.contains("http")) {
|
|
|
|
+ strategy.setAppIconUrl("https:" + appIconUrl);
|
|
|
|
+ }
|
|
channelCreateStrategyService.save(strategy);
|
|
channelCreateStrategyService.save(strategy);
|
|
-
|
|
|
|
/**==========================范围是 项目==========================*/
|
|
/**==========================范围是 项目==========================*/
|
|
if (usageRange == 2) {
|
|
if (usageRange == 2) {
|
|
List<Long> accountList = userAllocationService.getAccountListByProjectId(strategy.getProjectId());
|
|
List<Long> accountList = userAllocationService.getAccountListByProjectId(strategy.getProjectId());
|
|
@@ -970,32 +981,39 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void callBackUpdateChannelRel(String level, String channelCode, Long accountId, Long planId, Long groupId) {
|
|
|
|
|
|
+ public void callBackUpdateChannelRel(String level, String channelCode, Long accountId, Long planId, Long groupId, Integer state) {
|
|
try {
|
|
try {
|
|
QueryWrapper<KuaishouChannel> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouChannel> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("account_id", accountId);
|
|
queryWrapper.eq("account_id", accountId);
|
|
queryWrapper.eq("channel_code", channelCode).last("limit 1");
|
|
queryWrapper.eq("channel_code", channelCode).last("limit 1");
|
|
KuaishouChannel one = this.getOne(queryWrapper);
|
|
KuaishouChannel one = this.getOne(queryWrapper);
|
|
if (!Check.isNull(one)) {
|
|
if (!Check.isNull(one)) {
|
|
- QueryWrapper<KuaishouChannelRel> relqueryWrapper = new QueryWrapper<>();
|
|
|
|
- relqueryWrapper.eq("account_id", accountId);
|
|
|
|
- relqueryWrapper.eq("channel_code", channelCode).orderByAsc("create_time").last("limit 1");
|
|
|
|
- KuaishouChannelRel rel = channelRelService.getOne(relqueryWrapper);
|
|
|
|
- if (!Check.isNull(rel)) {
|
|
|
|
- if (!Check.isNull(rel.getCampaignId())) {
|
|
|
|
- rel.setId(null);
|
|
|
|
- }
|
|
|
|
- rel.setCampaignId(planId);
|
|
|
|
- rel.setUnitId(groupId);
|
|
|
|
- channelRelService.save(rel);
|
|
|
|
- if ("plan".equals(level)) {
|
|
|
|
- Integer usageTimes = channelRelService.queryUsePlanCount(accountId, channelCode);
|
|
|
|
- one.setUsageTimes(usageTimes);
|
|
|
|
- this.saveOrUpdate(one);
|
|
|
|
- } else if ("group".equals(level)) {
|
|
|
|
- Integer usageTimes = channelRelService.queryUseGroupCount(accountId, channelCode);
|
|
|
|
- one.setUsageTimes(usageTimes);
|
|
|
|
- this.saveOrUpdate(one);
|
|
|
|
|
|
+ if (0 == state) {
|
|
|
|
+ one.setChannelLock(1);
|
|
|
|
+ this.saveOrUpdate(one);
|
|
|
|
+ } else {
|
|
|
|
+ QueryWrapper<KuaishouChannelRel> relqueryWrapper = new QueryWrapper<>();
|
|
|
|
+ relqueryWrapper.eq("account_id", accountId);
|
|
|
|
+ relqueryWrapper.eq("channel_code", channelCode).orderByAsc("create_time").last("limit 1");
|
|
|
|
+ KuaishouChannelRel rel = channelRelService.getOne(relqueryWrapper);
|
|
|
|
+ if (!Check.isNull(rel)) {
|
|
|
|
+ if (!Check.isNull(rel.getCampaignId())) {
|
|
|
|
+ rel.setId(null);
|
|
|
|
+ }
|
|
|
|
+ rel.setCampaignId(planId);
|
|
|
|
+ rel.setUnitId(groupId);
|
|
|
|
+ channelRelService.save(rel);
|
|
|
|
+ if ("plan".equals(level)) {
|
|
|
|
+ Integer usageTimes = channelRelService.queryUsePlanCount(accountId, channelCode);
|
|
|
|
+ one.setUsageTimes(usageTimes);
|
|
|
|
+ one.setChannelLock(1);
|
|
|
|
+ this.saveOrUpdate(one);
|
|
|
|
+ } else if ("group".equals(level)) {
|
|
|
|
+ Integer usageTimes = channelRelService.queryUseGroupCount(accountId, channelCode);
|
|
|
|
+ one.setUsageTimes(usageTimes);
|
|
|
|
+ one.setChannelLock(1);
|
|
|
|
+ this.saveOrUpdate(one);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1062,9 +1080,13 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
} else {
|
|
} else {
|
|
channelRel.setAppId(channel.getAppId());
|
|
channelRel.setAppId(channel.getAppId());
|
|
channelRelService.saveOrUpdate(channelRel);
|
|
channelRelService.saveOrUpdate(channelRel);
|
|
|
|
+ channel.setChannelLock(0);
|
|
|
|
+ this.saveOrUpdate(channel);
|
|
return Result.ok(channel);
|
|
return Result.ok(channel);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ channel.setChannelLock(0);
|
|
|
|
+ this.saveOrUpdate(channel);
|
|
channel.setAppId(channelRel.getAppId());
|
|
channel.setAppId(channelRel.getAppId());
|
|
return Result.ok(channel);
|
|
return Result.ok(channel);
|
|
}
|
|
}
|
|
@@ -1115,9 +1137,13 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
} else {
|
|
} else {
|
|
channelRel.setAppId(channel.getAppId());
|
|
channelRel.setAppId(channel.getAppId());
|
|
channelRelService.saveOrUpdate(channelRel);
|
|
channelRelService.saveOrUpdate(channelRel);
|
|
|
|
+ channel.setChannelLock(0);
|
|
|
|
+ this.saveOrUpdate(channel);
|
|
return Result.ok(channel);
|
|
return Result.ok(channel);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ channel.setChannelLock(0);
|
|
|
|
+ this.saveOrUpdate(channel);
|
|
channel.setAppId(channelRel.getAppId());
|
|
channel.setAppId(channelRel.getAppId());
|
|
return Result.ok(channel);
|
|
return Result.ok(channel);
|
|
}
|
|
}
|
|
@@ -1148,6 +1174,10 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
KuaishouChannelAppInfo one = channelAppInfoService.getById(channel.getChannelAppInfoId());
|
|
KuaishouChannelAppInfo one = channelAppInfoService.getById(channel.getChannelAppInfoId());
|
|
|
|
+ String appIconUrl = one.getAppIconUrl();
|
|
|
|
+ if (!Check.isNull(appIconUrl) && !appIconUrl.contains("http")) {
|
|
|
|
+ one.setAppIconUrl("https:" + appIconUrl);
|
|
|
|
+ }
|
|
JSONObject tokenJson = appInfoService.uploadAppIconImage(one.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
|
|
JSONObject tokenJson = appInfoService.uploadAppIconImage(one.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
|
|
if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
|
|
if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
|
|
log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
|
|
log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
|