|
@@ -1,9 +1,8 @@
|
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.Yard;
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.YardComment;
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.YardPhoto;
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.YardVideo;
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
+import cn.com.ctop.manage.modules.actor.entity.*;
|
|
|
import cn.com.ctop.manage.modules.actor.service.IYardCommentService;
|
|
|
import cn.com.ctop.manage.modules.actor.service.IYardPhotoService;
|
|
|
import cn.com.ctop.manage.modules.actor.service.IYardService;
|
|
@@ -49,7 +48,31 @@ public class YardController {
|
|
|
public Result<Yard> add(@RequestBody Yard yard) {
|
|
|
Result<Yard> result = new Result<>();
|
|
|
try {
|
|
|
+ String coverUrl = yard.getCoverUrl();
|
|
|
+ if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ yard.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
|
|
|
+ }
|
|
|
yardService.save(yard);
|
|
|
+ if (null != yard.getImageUrl() && !yard.getImageUrl().isEmpty()) {
|
|
|
+ for (String url : yard.getImageUrl()) {
|
|
|
+ YardPhoto photo = new YardPhoto();
|
|
|
+ photo.setYardId(yard.getId());
|
|
|
+ if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
|
|
|
+ }
|
|
|
+ yardPhotoService.save(photo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (yard.getVideoUrl() != null && !yard.getVideoUrl().isEmpty()) {
|
|
|
+ for (String url : yard.getVideoUrl()) {
|
|
|
+ YardVideo video = new YardVideo();
|
|
|
+ video.setYardId(yard.getId());
|
|
|
+ if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
|
|
|
+ }
|
|
|
+ yardVideoService.save(video);
|
|
|
+ }
|
|
|
+ }
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|