|
@@ -657,13 +657,6 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
}
|
|
|
|
|
|
JSONArray descriptionList = JSONArray.parseArray(template.getDescription());
|
|
|
- String description = null;
|
|
|
- if (!Check.isNull(descriptionList)) {
|
|
|
- int number = new Random().nextInt(descriptionList.size());
|
|
|
- description = descriptionList.getString(number);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
JSONArray creatives = new JSONArray();
|
|
|
Integer createType = template.getCreateType();
|
|
|
if (createType == 0) { // 单品
|
|
@@ -685,13 +678,14 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
json.put("photo_id", template.getPhotoId());
|
|
|
json.put("creative_material_type", materialType);
|
|
|
json.put("action_bar_text", template.getActionBarText());
|
|
|
- json.put("description", description);
|
|
|
+ json.put("description", getOneDescription(descriptionList));
|
|
|
if (!Check.isNull(template.getSiteId())) {
|
|
|
json.put("site_id", template.getSiteId());
|
|
|
}
|
|
|
creatives.add(json);
|
|
|
} else {
|
|
|
for (int i = 0; i < imageList.size(); i++) {
|
|
|
+
|
|
|
JSONObject imageJson = imageList.get(i);
|
|
|
if (Check.isNull(imageJson)) {
|
|
|
continue;
|
|
@@ -707,7 +701,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
json.put("photo_id", template.getPhotoId());
|
|
|
json.put("creative_material_type", materialType);
|
|
|
json.put("action_bar_text", template.getActionBarText());
|
|
|
- json.put("description", description);
|
|
|
+ json.put("description", getOneDescription(descriptionList));
|
|
|
if (!Check.isNull(template.getSiteId())) {
|
|
|
json.put("site_id", template.getSiteId());
|
|
|
}
|
|
@@ -746,7 +740,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
json.put("photo_id", photoId);
|
|
|
json.put("creative_material_type", materialType);
|
|
|
json.put("action_bar_text", template.getActionBarText());
|
|
|
- json.put("description", description);
|
|
|
+ json.put("description", getOneDescription(descriptionList));
|
|
|
if (!Check.isNull(template.getSiteId())) {
|
|
|
json.put("site_id", template.getSiteId());
|
|
|
}
|
|
@@ -767,6 +761,13 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
this.updateById(updateTemplate);
|
|
|
}
|
|
|
|
|
|
+ private String getOneDescription(JSONArray descriptionList) {
|
|
|
+ if (!Check.isNull(descriptionList)) {
|
|
|
+ int number = new Random().nextInt(descriptionList.size());
|
|
|
+ return descriptionList.getString(number);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
private void createProgramCreative(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
|
|
|
KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
|