Преглед изворни кода

Merge branch '20250925-wyp-uploadVideo' into test

wangyunpeng пре 3 недеља
родитељ
комит
9a964cf0ca

+ 3 - 1
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/ExceptionEnum.java

@@ -53,7 +53,9 @@ public enum ExceptionEnum {
     THIRD_PART_ROOM_NOT_FOUND(5002, "群不存在"),
 
     // 用户上传内容管理
-    VIDEO_PUBLISH_FAILED(6001, "视频发布失败"),
+    PQ_LOGIN_FAIL(6001, "票圈登录失败"),
+    VIDEO_PUBLISH_FAILED(6002, "视频发布失败"),
+    PQ_ACCOUNT_NOT_BINDING(6003, "票圈账号未绑定"),
 
     // 自动回复
     CGI_REPLY_BUCKET_DATA_NOT_FOUND(10000, "自动回复数据不存在"),

+ 22 - 0
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/contentplatform/UploadVideoAuditStatusEnum.java

@@ -38,5 +38,27 @@ public enum UploadVideoAuditStatusEnum {
         return other;
     }
 
+    public static Integer parsePqAuditStatus(Integer pqAuditStatus) {
+        if (pqAuditStatus == null) {
+            return AUDITING.getVal();
+        }
+        switch (pqAuditStatus) {
+            case 0:
+                return WAIT_AUDIT.getVal();
+            case 1:
+                return AUDITING.getVal();
+            case 2:
+                return AUDIT_REJECT.getVal();
+            case 3:
+                return AUDIT_REJECT.getVal();
+            case 4:
+                return AUDIT_PASS.getVal();
+            case 5:
+                return AUDIT_PASS.getVal();
+            default:
+                return other.getVal();
+        }
+    }
+
 
 }

+ 3 - 3
api-module/src/main/java/com/tzld/piaoquan/api/component/VideoApiService.java

@@ -43,7 +43,7 @@ public class VideoApiService {
                     "&appId=" + appId +
                     "&path=%2F" +
                     "&clientTimestamp=" + System.currentTimeMillis() +
-                    "6&loginUid=" +
+                    "&loginUid=" +
                     "&token=" +
                     "&machineCode=" + machineCode, "application/x-www-form-urlencoded;charset=UTF-8");
             JSONObject res = JSONObject.parseObject(post);
@@ -60,7 +60,7 @@ public class VideoApiService {
             JSONObject param = new JSONObject();
             param.put("uid", uid);
             param.put("phoneNumber", phoneNumber);
-            String post = httpPoolClient.post(url, param.toJSONString());
+            String res = httpPoolClient.post(url, param.toJSONString());
         } catch (Exception e) {
             log.error("saveUserPhoneNumber error", e);
         }
@@ -116,7 +116,7 @@ public class VideoApiService {
             JSONObject param = new JSONObject();
             param.put("loginUid", uid);
             param.put("videoId", videoId);
-            String post = httpPoolClient.post(url, param.toJSONString());
+            String res = httpPoolClient.post(url, param.toJSONString());
         } catch (Exception e) {
             log.error("deleteVideo error", e);
         }

+ 9 - 4
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformSettingServiceImpl.java

@@ -1,5 +1,7 @@
 package com.tzld.piaoquan.api.service.contentplatform.impl;
 
+import com.tzld.piaoquan.api.common.enums.ExceptionEnum;
+import com.tzld.piaoquan.api.common.exception.CommonException;
 import com.tzld.piaoquan.api.component.VideoApiService;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformPqAccountRelMapper;
 import com.tzld.piaoquan.api.model.config.LoginUserContext;
@@ -32,6 +34,9 @@ public class ContentPlatformSettingServiceImpl implements ContentPlatformSetting
         ContentPlatformAccount user = LoginUserContext.getUser();
         // 调用webLogin接口 登录/注册 票圈用户
         WxBaseUserInfoVO wxBaseUserInfoVO = videoApiService.webLogin(param.getCode(), param.getAppType(), param.getAppId(), param.getMachineCode());
+        if (Objects.isNull(wxBaseUserInfoVO)) {
+            throw new CommonException(ExceptionEnum.PQ_LOGIN_FAIL);
+        }
         ContentPlatformPqAccountRel pqAccountRel = getPqAccountRel(user.getId());
         if (Objects.nonNull(pqAccountRel)) {
             wxBaseUserInfoVO = new WxBaseUserInfoVO();
@@ -61,12 +66,12 @@ public class ContentPlatformSettingServiceImpl implements ContentPlatformSetting
     @Override
     public ContentPlatformPqAccountRel getPqAccountRel(Long accountId) {
         ContentPlatformPqAccountRelExample example = new ContentPlatformPqAccountRelExample();
-        example.createCriteria().andAccountIdEqualTo(accountId);
-        List<ContentPlatformPqAccountRel> pqAccountRels = pqAccountRelMapper.selectByExample(example);
-        if (CollectionUtils.isEmpty(pqAccountRels)) {
+        example.createCriteria().andAccountIdEqualTo(accountId).andStatusEqualTo(1);
+        List<ContentPlatformPqAccountRel> pqAccountRelList = pqAccountRelMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(pqAccountRelList)) {
             return null;
         }
-        return pqAccountRels.get(0);
+        return pqAccountRelList.get(0);
     }
 
     @Override

+ 23 - 5
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformUploadContentServiceImpl.java

@@ -42,8 +42,12 @@ public class ContentPlatformUploadContentServiceImpl implements ContentPlatformU
     @Override
     public UploadVideoItemVO publishVideo(PublishVideoParam param) {
         ContentPlatformAccount user = LoginUserContext.getUser();
+        ContentPlatformPqAccountRel pqAccountRel = settingService.getPqAccountRel(user.getId());
+        if (pqAccountRel == null) {
+            throw new CommonException(ExceptionEnum.PQ_ACCOUNT_NOT_BINDING);
+        }
         // 调用视频发布 获取videoId
-        Long videoId = videoApiService.publishVideo(user.getId(), param.getVideoUrl(), param.getCoverUrl(), param.getTitle());
+        Long videoId = videoApiService.publishVideo(pqAccountRel.getPqUid(), param.getVideoUrl(), param.getCoverUrl(), param.getTitle());
         if (videoId == null) {
             throw new CommonException(ExceptionEnum.VIDEO_PUBLISH_FAILED);
         }
@@ -110,14 +114,28 @@ public class ContentPlatformUploadContentServiceImpl implements ContentPlatformU
         if (uploadVideo == null) {
             return;
         }
-        // todo uploadVideo 转化审核状态
-        uploadVideo.setAuditStatus(param.getAuditStatus());
-        // todo uploadVideo 更改审核失败原因
-        uploadVideo.setAuditReason(param.getAuditReason());
+        // 转化审核状态
+        Integer auditStatus = UploadVideoAuditStatusEnum.parsePqAuditStatus(param.getAuditStatus());
+        uploadVideo.setAuditStatus(auditStatus);
+        // 更改审核失败原因
+        if (auditStatus.equals(UploadVideoAuditStatusEnum.AUDIT_REJECT.getVal())) {
+            String auditReason = parseAuditReason(param.getAuditReason());
+            uploadVideo.setAuditReason(auditReason);
+        }
         uploadVideo.setUpdateTimestamp(System.currentTimeMillis());
         uploadVideoMapper.updateByPrimaryKeySelective(uploadVideo);
     }
 
+    private String parseAuditReason(String auditReason) {
+        if (auditReason.contains("标题")) {
+            return "标题违规";
+        } else if (auditReason.contains("封面")) {
+            return "封面违规";
+        } else {
+            return "内容违规";
+        }
+    }
+
     @Override
     public Page<UploadVideoItemVO> uploadVideoList(UploadVideoListParam param) {
         ContentPlatformAccount user = LoginUserContext.getUser();