reghao 5 days ago
parent
commit
dd440ca4d1
36 changed files with 393 additions and 400 deletions
  1. 7 21
      admin/src/main/resources/application-dev.yml
  2. 44 0
      admin/src/main/resources/application-dev0.yml
  3. 1 1
      admin/src/main/resources/application-test.yml
  4. 1 1
      auth/auth-service/src/main/resources/mapper/UserRegistryMapper.xml
  5. 2 2
      auth/auth-service/src/test/java/UserAccountTest.java
  6. 1 1
      content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/VideoPublishSbt.java
  7. 5 5
      content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatMessageService.java
  8. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatRecordService.java
  9. 2 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/AudioPostController.java
  10. 0 102
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/AudioPostService.java
  11. 11 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ImagePostService.java
  12. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/PhotoMapService.java
  13. 4 5
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/service/ProductService.java
  14. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/rpc/AdminVideoServiceImpl.java
  15. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/AdminVodService.java
  16. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/AlbumService.java
  17. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/CrawledDataService.java
  18. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoService.java
  19. 5 3
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPlayServiceImpl.java
  20. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostQueryImpl.java
  21. 24 28
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostServiceImpl.java
  22. 15 16
      file/file-api/src/main/java/cn/reghao/file/api/iface/OssService.java
  23. 30 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/config/ClientAvailabilityAspect.java
  24. 43 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/AdminFileController.java
  25. 30 8
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/FileOssController.java
  26. 14 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/dto/OssConfigDto.java
  27. 10 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/OssConfig.java
  28. 37 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/OssClientManager.java
  29. 46 121
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/StoreServiceWrapperRouter.java
  30. 37 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/AdminFileService.java
  31. 4 6
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/AvatarService.java
  32. 0 32
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/StoreConfigService.java
  33. 2 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/CamRecordService.java
  34. 2 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/DiskAlbumService.java
  35. 3 3
      file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/DiskFileService.java
  36. 2 1
      file/file-service/src/test/java/DiskUnitTest.java

+ 7 - 21
admin/src/main/resources/application-dev.yml

@@ -9,36 +9,22 @@ spring:
       discovery:
       discovery:
         server-addr: 127.0.0.1:8848
         server-addr: 127.0.0.1:8848
         username: nacos
         username: nacos
-        password: E4B2M7W8Dx
+        password: Test_123456
   data:
   data:
     mongodb:
     mongodb:
-      uri: mongodb://test:Test_123456@192.168.0.214:27017,192.168.0.215:27017,192.168.0.216:27017/tnb_content_rdb?replicaSet=mymongo&authSource=admin&readPreference=secondaryPreferred&connectTimeoutMS=300000
+      uri: mongodb://test:Test_123456@127.0.0.1:27017/tnb_content_rdb?replicaSet=mymongo&authSource=admin&readPreference=secondaryPreferred&connectTimeoutMS=300000
     redis:
     redis:
       database: 0
       database: 0
+      host: 192.168.0.209
+      port: 6379
       password: Test_123456
       password: Test_123456
-      lettuce:
-        pool:
-          # 最大连接数
-          max-active: 20
-          # 连接池中获取连接时最大等待时间ms
-          max-wait: 300
-          # 最大空闲连接数
-          max-idle: 5
-          # 最小空闲连接数
-          min-idle: 1
-      sentinel:
-        master: mymaster
-        password: Test_123456
-        nodes:
-          - 192.168.0.214:26379
-          - 192.168.0.215:26379
-          - 192.168.0.216:26379
   rabbitmq:
   rabbitmq:
-    addresses: 192.168.0.211:5672,192.168.0.212:5672,192.168.0.213:5672
+    host: 192.168.0.209
+    port: 5672
     virtual-host: /
     virtual-host: /
     username: test
     username: test
     password: Test_123456
     password: Test_123456
   datasource:
   datasource:
-    url: jdbc:mysql://192.168.0.215:3306,192.168.0.216:3306/testdb?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8
+    url: jdbc:mysql://192.168.0.209:3306/tnb_account_tdb?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8
     username: test
     username: test
     password: Test_123456
     password: Test_123456

+ 44 - 0
admin/src/main/resources/application-dev0.yml

@@ -0,0 +1,44 @@
+dubbo:
+  registry:
+    address: N/A
+spring:
+  cloud:
+    discovery:
+      enabled: true
+    nacos:
+      discovery:
+        server-addr: 127.0.0.1:8848
+        username: nacos
+        password: Test_123456
+  data:
+    mongodb:
+      uri: mongodb://test:Test_123456@192.168.0.214:27017,192.168.0.215:27017,192.168.0.216:27017/tnb_content_rdb?replicaSet=mymongo&authSource=admin&readPreference=secondaryPreferred&connectTimeoutMS=300000
+    redis:
+      database: 0
+      password: Test_123456
+      lettuce:
+        pool:
+          # 最大连接数
+          max-active: 20
+          # 连接池中获取连接时最大等待时间ms
+          max-wait: 300
+          # 最大空闲连接数
+          max-idle: 5
+          # 最小空闲连接数
+          min-idle: 1
+      sentinel:
+        master: mymaster
+        password: Test_123456
+        nodes:
+          - 192.168.0.214:26379
+          - 192.168.0.215:26379
+          - 192.168.0.216:26379
+  rabbitmq:
+    addresses: 192.168.0.211:5672,192.168.0.212:5672,192.168.0.213:5672
+    virtual-host: /
+    username: test
+    password: Test_123456
+  datasource:
+    url: jdbc:mysql://192.168.0.215:3306,192.168.0.216:3306/testdb?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8
+    username: test
+    password: Test_123456

+ 1 - 1
admin/src/main/resources/application-test.yml

@@ -10,7 +10,7 @@ spring:
       discovery:
       discovery:
         server-addr: 192.168.0.209:8848
         server-addr: 192.168.0.209:8848
         username: nacos
         username: nacos
-        password: E4B2M7W8Dx
+        password: Test_123456
   data:
   data:
     redis:
     redis:
       database: 0
       database: 0

+ 1 - 1
auth/auth-service/src/main/resources/mapper/UserRegistryMapper.xml

@@ -11,7 +11,7 @@
     
     
     <update id="update">
     <update id="update">
         update account_user_registry
         update account_user_registry
-        set update_time=now(),enabled=#{enabled},captcha_code=#{captchaCode},verify_code=#{verifyCode},enable_code=#{enableCode}
+        set update_time=now(),enabled=#{enabled},captcha_code=#{captchaCode},verify_code=#{verifyCode},enable_verify=#{enableVerify}
         where id=#{id}
         where id=#{id}
     </update>
     </update>
     
     

+ 2 - 2
auth/auth-service/src/test/java/UserAccountTest.java

@@ -40,8 +40,8 @@ public class UserAccountTest {
 
 
     @Test
     @Test
     public void setUserPassword() {
     public void setUserPassword() {
-        long userId = 1;
-        String password = "0123456789";
+        long userId = 10001;
+        String password = "ecUgpUeIX2ub84EYPsiQ";
 
 
         String salt = RandomString.getSalt(64);
         String salt = RandomString.getSalt(64);
         String encodedPassword = passwordEncoder.encode(password + salt);
         String encodedPassword = passwordEncoder.encode(password + salt);

+ 1 - 1
content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/VideoPublishSbt.java

@@ -26,7 +26,7 @@ public class VideoPublishSbt implements Serializable {
     private String videoId;
     private String videoId;
     @NotBlank
     @NotBlank
     private String coverFileId;
     private String coverFileId;
-    @NotNull
+    //@NotNull
     private Integer coverChannelCode;
     private Integer coverChannelCode;
     @NotBlank
     @NotBlank
     private String title;
     private String title;

+ 5 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatMessageService.java

@@ -89,12 +89,12 @@ public class ChatMessageService {
 
 
         try {
         try {
             int channelCode = 110;
             int channelCode = 110;
-            ObjectInfo objectInfo = ossService.getObjectInfo(channelCode, uploadId);
+            ObjectInfo objectInfo = ossService.getObjectInfo(uploadId);
             if (objectInfo == null) {
             if (objectInfo == null) {
                 return;
                 return;
             }
             }
 
 
-            String signedUrl = ossService.getSignedUrl(channelCode, uploadId);
+            String signedUrl = ossService.getSignedUrl(uploadId);
             String filename = objectInfo.getFilename();
             String filename = objectInfo.getFilename();
             String suffix = getSuffix(filename);
             String suffix = getSuffix(filename);
             int fileType = objectInfo.getFileType();
             int fileType = objectInfo.getFileType();
@@ -138,7 +138,7 @@ public class ChatMessageService {
 
 
         try {
         try {
             int channelCode = 110;
             int channelCode = 110;
-            ObjectInfo objectInfo = ossService.getObjectInfo(channelCode, uploadId);
+            ObjectInfo objectInfo = ossService.getObjectInfo(uploadId);
             if (objectInfo == null) {
             if (objectInfo == null) {
                 return;
                 return;
             }
             }
@@ -154,7 +154,7 @@ public class ChatMessageService {
             chatRecordMapper.save(chatRecord);
             chatRecordMapper.save(chatRecord);
             fileMessageMapper.save(fileMessage);
             fileMessageMapper.save(fileMessage);
 
 
-            String signedUrl = ossService.getSignedUrl(channelCode, uploadId);
+            String signedUrl = ossService.getSignedUrl(uploadId);
             ContactDetail contactDetail = contactService.getContactDetail(loginUser);
             ContactDetail contactDetail = contactService.getContactDetail(loginUser);
             ChatRecordGetRet chatRecordGetRet = new ChatRecordGetRet(chatRecord, contactDetail);
             ChatRecordGetRet chatRecordGetRet = new ChatRecordGetRet(chatRecord, contactDetail);
             String createAt = DateTimeConverter.format(chatRecord.getCreateTime());
             String createAt = DateTimeConverter.format(chatRecord.getCreateTime());
@@ -213,7 +213,7 @@ public class ChatMessageService {
     public String putImageMessage(ImageMessage imageMessage) throws Exception {
     public String putImageMessage(ImageMessage imageMessage) throws Exception {
         int channelCode = imageMessage.getChannelCode();
         int channelCode = imageMessage.getChannelCode();
         String uploadId = imageMessage.getUploadId();
         String uploadId = imageMessage.getUploadId();
-        return ossService.getSignedUrl(channelCode, uploadId);
+        return ossService.getSignedUrl(uploadId);
     }
     }
 
 
     public List<DateDto> getDateList() {
     public List<DateDto> getDateList() {

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatRecordService.java

@@ -89,7 +89,7 @@ public class ChatRecordService {
             FileMessage fileMessage = fileMessageMapper.findByRecordId(recordId1);
             FileMessage fileMessage = fileMessageMapper.findByRecordId(recordId1);
             String uploadId = fileMessage.getUploadId();
             String uploadId = fileMessage.getUploadId();
             int channelCode = 110;
             int channelCode = 110;
-            String url = ossService.getSignedUrl(channelCode, uploadId);
+            String url = ossService.getSignedUrl(uploadId);
 
 
             String filename = fileMessage.getFilename();
             String filename = fileMessage.getFilename();
             String suffix = getSuffix(filename);
             String suffix = getSuffix(filename);

+ 2 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/AudioPostController.java

@@ -1,12 +1,9 @@
 package cn.reghao.tnb.content.app.data.controller;
 package cn.reghao.tnb.content.app.data.controller;
 
 
-import cn.reghao.jutil.jdk.web.db.PageList;
 import cn.reghao.tnb.common.web.WebResult;
 import cn.reghao.tnb.common.web.WebResult;
 import cn.reghao.tnb.common.auth.AuthUser;
 import cn.reghao.tnb.common.auth.AuthUser;
 import cn.reghao.tnb.content.app.data.model.dto.AudioPublishSbt;
 import cn.reghao.tnb.content.app.data.model.dto.AudioPublishSbt;
 import cn.reghao.tnb.content.app.data.model.dto.AudioScopeUpdate;
 import cn.reghao.tnb.content.app.data.model.dto.AudioScopeUpdate;
-import cn.reghao.tnb.content.app.data.model.vo.UserAudioCard;
-import cn.reghao.tnb.content.app.data.service.AudioPostService;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
@@ -20,17 +17,10 @@ import org.springframework.web.bind.annotation.*;
 @RestController
 @RestController
 @RequestMapping("/api/content/post/audio")
 @RequestMapping("/api/content/post/audio")
 public class AudioPostController {
 public class AudioPostController {
-    private final AudioPostService audioPostService;
-
-    public AudioPostController(AudioPostService audioPostService) {
-        this.audioPostService = audioPostService;
-    }
-
     @AuthUser
     @AuthUser
     @Operation(summary = "添加音频贴")
     @Operation(summary = "添加音频贴")
     @PostMapping("")
     @PostMapping("")
     public String submitAudioPost(@RequestBody @Validated AudioPublishSbt audioPublishSbt) {
     public String submitAudioPost(@RequestBody @Validated AudioPublishSbt audioPublishSbt) {
-        audioPostService.submit(audioPublishSbt);
         return WebResult.success();
         return WebResult.success();
     }
     }
 
 
@@ -38,7 +28,6 @@ public class AudioPostController {
     @Operation(summary = "更新音频贴可见范围")
     @Operation(summary = "更新音频贴可见范围")
     @PostMapping("/update/scope")
     @PostMapping("/update/scope")
     public String updateAudioScope(@RequestBody @Validated AudioScopeUpdate audioScopeUpdate) {
     public String updateAudioScope(@RequestBody @Validated AudioScopeUpdate audioScopeUpdate) {
-        audioPostService.updateAudioScope(audioScopeUpdate);
         return WebResult.success();
         return WebResult.success();
     }
     }
 
 
@@ -46,7 +35,6 @@ public class AudioPostController {
     @Operation(summary = "删除音频贴")
     @Operation(summary = "删除音频贴")
     @DeleteMapping("/{audioId}")
     @DeleteMapping("/{audioId}")
     public String deleteAudioPost(@PathVariable("audioId") String audioId) {
     public String deleteAudioPost(@PathVariable("audioId") String audioId) {
-        audioPostService.deleteAudio(audioId);
         return WebResult.success();
         return WebResult.success();
     }
     }
 
 
@@ -54,15 +42,13 @@ public class AudioPostController {
     @Operation(summary = "获取音频贴")
     @Operation(summary = "获取音频贴")
     @GetMapping("/{audioId}")
     @GetMapping("/{audioId}")
     public String getAudioPost(@PathVariable("audioId") String audioId) {
     public String getAudioPost(@PathVariable("audioId") String audioId) {
-        UserAudioCard userAudioCard = audioPostService.getAudioInfo(audioId);
-        return WebResult.success(userAudioCard);
+        return WebResult.success();
     }
     }
 
 
     @AuthUser
     @AuthUser
     @Operation(summary = "获取音频贴列表")
     @Operation(summary = "获取音频贴列表")
     @GetMapping("")
     @GetMapping("")
     public String getAudioPosts(@RequestParam("page") int page) {
     public String getAudioPosts(@RequestParam("page") int page) {
-        PageList<UserAudioCard> pageList = audioPostService.getPageByUserId(page);
-        return WebResult.success(pageList);
+        return WebResult.success();
     }
     }
 }
 }

+ 0 - 102
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/AudioPostService.java

@@ -1,102 +0,0 @@
-package cn.reghao.tnb.content.app.data.service;
-
-import cn.reghao.file.api.iface.OssService;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.string.IdGenerator;
-import cn.reghao.tnb.content.api.constant.PostScope;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.data.model.dto.AudioPublishSbt;
-import cn.reghao.tnb.content.app.data.db.mapper.AudioPostMapper;
-import cn.reghao.tnb.content.app.data.model.dto.AudioScopeUpdate;
-import cn.reghao.tnb.content.app.data.model.po.AudioPost;
-import cn.reghao.tnb.content.app.data.model.vo.UserAudioCard;
-import cn.reghao.oss.api.dto.media.AudioInfo;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2023-01-29 10:25:10
- */
-@Slf4j
-@Service
-public class AudioPostService {
-    @DubboReference(check = false)
-    private OssService ossService;
-
-    private final int pageSize = 10;
-    private final IdGenerator idGenerator;
-    private final AudioPostMapper audioPostMapper;
-
-    public AudioPostService(AudioPostMapper audioPostMapper) {
-        this.idGenerator = new IdGenerator("audio-id");
-        this.audioPostMapper = audioPostMapper;
-    }
-
-    public void submit(AudioPublishSbt audioPublishSbt) {
-        try {
-            int channelCode = audioPublishSbt.getChannelCode();
-            String audioFileId = audioPublishSbt.getAudioFileId();
-            AudioInfo audioInfo = ossService.getAudioInfo(channelCode, audioFileId);
-            if (audioInfo == null) {
-                log.error("音频文件 {} 在 oss 中不存在", audioFileId);
-                return;
-            }
-
-            int scope = PostScope.PUBLIC.getCode();
-            ossService.setObjectScope(channelCode, audioFileId, scope);
-
-            String audioUrl = audioInfo.getUrl();
-            int duration = audioInfo.getDuration();
-            String codec = audioInfo.getCodec();
-            String audioId = idGenerator.getUuid();
-            AudioPost audioPost = new AudioPost(audioId, audioUrl, duration, codec, audioPublishSbt);
-            audioPostMapper.save(audioPost);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void updateAudioScope(AudioScopeUpdate audioScopeUpdate) {
-        String audioId = audioScopeUpdate.getAudioId();
-        AudioPost audioPost = audioPostMapper.findByAudioId(audioId);
-        if (audioPost == null) {
-            return;
-        }
-
-        long loginUser = UserContext.getUserId();
-        long publishBy = audioPost.getPublishBy();
-        if (loginUser == publishBy) {
-            audioPostMapper.updateAudioScope(audioScopeUpdate);
-        }
-
-        String audioFileId = audioPost.getAudioFileId();
-        int scope = audioScopeUpdate.getScope();
-        int channelCode = audioPost.getChannelCode();
-        try {
-            ossService.setObjectScope(channelCode, audioFileId, scope);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void deleteAudio(String audioId) {
-    }
-
-    public PageList<UserAudioCard> getPageByUserId(int page) {
-        long userId = UserContext.getUserId();
-        int total = audioPostMapper.countByUserId(userId);
-        Page page1 = new Page(page, pageSize);
-        List<UserAudioCard> list = audioPostMapper.findAudioCardByUserIdAndByPage(page1, userId);
-        return PageList.pageList(page, pageSize, total, list);
-    }
-
-    public UserAudioCard getAudioInfo(String audioId) {
-        UserAudioCard userAudioCard = audioPostMapper.findAudioInfo(audioId);
-        return userAudioCard;
-    }
-}

+ 11 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ImagePostService.java

@@ -5,7 +5,6 @@ import cn.reghao.jutil.jdk.web.db.Page;
 import cn.reghao.jutil.jdk.web.db.PageList;
 import cn.reghao.jutil.jdk.web.db.PageList;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.tnb.common.web.WebResult;
 import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.oss.api.dto.media.ImageInfo;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.api.constant.PostScope;
 import cn.reghao.tnb.content.api.constant.PostScope;
@@ -91,7 +90,7 @@ public class ImagePostService {
         String imageFileId = albumImageData.getImageFileId();
         String imageFileId = albumImageData.getImageFileId();
         int channelCode = postAlbum.getChannelCode();
         int channelCode = postAlbum.getChannelCode();
         try {
         try {
-            ImageInfo imageInfo = ossService.getImageInfo(channelCode, imageFileId);
+            //ObjectInfo objectInfo = ossService.getObjectInfo(coverFileId);
             /*Map<String, ConvertedImageInfo> map = imageFileIds.stream()
             /*Map<String, ConvertedImageInfo> map = imageFileIds.stream()
                     .map(imageFileId -> ossService.getWebpInfo(channelCode, imageFileId))
                     .map(imageFileId -> ossService.getWebpInfo(channelCode, imageFileId))
                     .filter(Objects::nonNull)
                     .filter(Objects::nonNull)
@@ -100,21 +99,21 @@ public class ImagePostService {
                 String errMsg = String.format("相册 %s 中的图片转换为 webp 失败", albumId);
                 String errMsg = String.format("相册 %s 中的图片转换为 webp 失败", albumId);
                 return Result.fail(errMsg);
                 return Result.fail(errMsg);
             }*/
             }*/
-            PostItem postItem = new PostItem(albumId, channelCode, imageInfo);
-            Integer channelScope = ossService.getChannelScope(channelCode);
-            if (channelScope == null ) {
+            /*PostItem postItem = new PostItem(albumId, channelCode, imageInfo);
+            ObjectChannel objectChannel = ossService.getChannel(channelCode);
+            if (objectChannel == null ) {
                 String errMsg = String.format("channelCode %s 的 scope 在 oss 中不存在", channelCode);
                 String errMsg = String.format("channelCode %s 的 scope 在 oss 中不存在", channelCode);
                 return Result.fail(errMsg);
                 return Result.fail(errMsg);
             }
             }
 
 
             int scope = postAlbum.getScope();
             int scope = postAlbum.getScope();
-            if (channelScope != scope) {
+            if (objectChannel.getScope() != scope) {
                 ossService.setObjectScope(channelCode, imageFileId, scope);
                 ossService.setObjectScope(channelCode, imageFileId, scope);
             }
             }
-            albumRepository.addAlbumImage(albumId, imageCount, postItem);
+            albumRepository.addAlbumImage(albumId, imageCount, postItem);*/
             return Result.success();
             return Result.success();
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("{}", e.getMessage());
         }
         }
 
 
         return Result.fail("");
         return Result.fail("");
@@ -150,18 +149,17 @@ public class ImagePostService {
                         if (!coverUrl.isBlank()) {
                         if (!coverUrl.isBlank()) {
                             PostItem postItem = albumRepository.getByUrl(coverUrl);
                             PostItem postItem = albumRepository.getByUrl(coverUrl);
                             String objectId = postItem.getObjectId();
                             String objectId = postItem.getObjectId();
-                            postAlbum.setCoverUrl(ossService.getSignedUrl(channelCode, objectId));
+                            postAlbum.setCoverUrl(ossService.getSignedUrl(objectId));
                         }
                         }
                     }
                     }
                 }
                 }
                 String userIdStr = accountQuery.getUserIdStr(postAlbum.getCreateBy());
                 String userIdStr = accountQuery.getUserIdStr(postAlbum.getCreateBy());
                 return new AlbumCard(postAlbum, userIdStr);
                 return new AlbumCard(postAlbum, userIdStr);
             } catch (Exception e) {
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("{}", e.getMessage());
             }
             }
             return null;
             return null;
         }).filter(Objects::nonNull).collect(Collectors.toList());
         }).filter(Objects::nonNull).collect(Collectors.toList());
-
         return PageList.pageList(page, pageSize, total, albumCards);
         return PageList.pageList(page, pageSize, total, albumCards);
     }
     }
 
 
@@ -225,11 +223,11 @@ public class ImagePostService {
                 int channelCode = postAlbum.getChannelCode();
                 int channelCode = postAlbum.getChannelCode();
                 if (channelCode != 501) {
                 if (channelCode != 501) {
                     try {
                     try {
-                        String signedUrl = ossService.getSignedUrl(channelCode, imageFileId);
+                        String signedUrl = ossService.getSignedUrl(imageFileId);
                         imageData.setThumbnailUrl(signedUrl);
                         imageData.setThumbnailUrl(signedUrl);
                         imageData.setOriginalUrl(signedUrl);
                         imageData.setOriginalUrl(signedUrl);
                     } catch (Exception e) {
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        log.error("{}", e.getMessage());
                     }
                     }
                 }
                 }
             });
             });

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/PhotoMapService.java

@@ -132,7 +132,7 @@ public class PhotoMapService {
         if (channelCode != 0) {
         if (channelCode != 0) {
             String uploadId = markerInfo.getUploadId();
             String uploadId = markerInfo.getUploadId();
             try {
             try {
-                String signedUrl = ossService.getSignedUrl(channelCode, uploadId);
+                String signedUrl = ossService.getSignedUrl(uploadId);
                 if (signedUrl != null) {
                 if (signedUrl != null) {
                     markerInfo.setPhotoUrl(signedUrl);
                     markerInfo.setPhotoUrl(signedUrl);
                 }
                 }

+ 4 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/service/ProductService.java

@@ -5,7 +5,7 @@ import cn.reghao.jutil.jdk.web.db.PageList;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.serializer.JsonConverter;
 import cn.reghao.jutil.jdk.serializer.JsonConverter;
 import cn.reghao.jutil.jdk.string.SnowFlake;
 import cn.reghao.jutil.jdk.string.SnowFlake;
-import cn.reghao.oss.api.dto.media.ImageInfo;
+import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.content.api.dto.TaobaoItem;
 import cn.reghao.tnb.content.api.dto.TaobaoItem;
 import cn.reghao.tnb.content.app.mall.db.mapper.ProductMapper;
 import cn.reghao.tnb.content.app.mall.db.mapper.ProductMapper;
@@ -60,15 +60,14 @@ public class ProductService {
 
 
     public Result addProduct(ProductAddDto productAddDto) throws Exception {
     public Result addProduct(ProductAddDto productAddDto) throws Exception {
         String coverFileId = productAddDto.getCoverFileId();
         String coverFileId = productAddDto.getCoverFileId();
-        int coverChannelCode = productAddDto.getCoverChannelCode();
-        ImageInfo imageInfo = ossService.getImageInfo(coverChannelCode, coverFileId);
-        if (imageInfo == null) {
+        ObjectInfo objectInfo = ossService.getObjectInfo(coverFileId);
+        if (objectInfo == null) {
             String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
             String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
             return Result.fail(errMsg);
             return Result.fail(errMsg);
         }
         }
 
 
         long productId = idGenerator.nextId();
         long productId = idGenerator.nextId();
-        String coverUrl = imageInfo.getUrl();
+        String coverUrl = objectInfo.getUrl();
         Product product = new Product(productAddDto, productId, coverUrl);
         Product product = new Product(productAddDto, productId, coverUrl);
         productMapper.save(product);
         productMapper.save(product);
         return Result.success();
         return Result.success();

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/rpc/AdminVideoServiceImpl.java

@@ -83,7 +83,7 @@ public class AdminVideoServiceImpl implements AdminVideoService {
         /*String uploadId = videoConvertedDto.getUploadId();
         /*String uploadId = videoConvertedDto.getUploadId();
         int channelCode = videoConvertedDto.getChannelCode();
         int channelCode = videoConvertedDto.getChannelCode();
         try {
         try {
-            VideoInfo videoInfo = ossService.getVideoInfo(channelCode, uploadId);
+            VideoInfo videoInfo = ossService.getVideoInfo(uploadId);
             if (videoInfo == null) {
             if (videoInfo == null) {
                 String errMsg = String.format("视频文件 %s 在 oss 中不存在", uploadId);
                 String errMsg = String.format("视频文件 %s 在 oss 中不存在", uploadId);
                 log.info(errMsg);
                 log.info(errMsg);

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/AdminVodService.java

@@ -130,7 +130,7 @@ public class AdminVodService {
                     try {
                     try {
                         int channelCode = videoUrlDto.getChannelCode();
                         int channelCode = videoUrlDto.getChannelCode();
                         String quality = videoUrlDto.getQuality();
                         String quality = videoUrlDto.getQuality();
-                        String signedUrl = ossService.getSignedUrl(channelCode, videoUrlDto.getObjectId());
+                        String signedUrl = ossService.getSignedUrl(videoUrlDto.getObjectId());
                         return new VideoUrl(quality, signedUrl);
                         return new VideoUrl(quality, signedUrl);
                     } catch (Exception e) {
                     } catch (Exception e) {
                         e.printStackTrace();
                         e.printStackTrace();
@@ -160,7 +160,7 @@ public class AdminVodService {
         /*String uploadId = videoConvertedDto.getUploadId();
         /*String uploadId = videoConvertedDto.getUploadId();
         int channelCode = videoConvertedDto.getChannelCode();
         int channelCode = videoConvertedDto.getChannelCode();
         try {
         try {
-            VideoInfo videoInfo = ossService.getVideoInfo(channelCode, uploadId);
+            VideoInfo videoInfo = ossService.getVideoInfo(uploadId);
             if (videoInfo == null) {
             if (videoInfo == null) {
                 String errMsg = String.format("视频文件 %s 在 oss 中不存在", uploadId);
                 String errMsg = String.format("视频文件 %s 在 oss 中不存在", uploadId);
                 log.info(errMsg);
                 log.info(errMsg);

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/AlbumService.java

@@ -116,7 +116,7 @@ public class AlbumService {
                     int channelCode = postItem.getChannelCode();
                     int channelCode = postItem.getChannelCode();
                     String objectId = postItem.getObjectId();
                     String objectId = postItem.getObjectId();
                     try {
                     try {
-                        String signedUrl = ossService.getSignedUrl(channelCode, objectId);
+                        String signedUrl = ossService.getSignedUrl(objectId);
                         postAlbum.setCoverUrl(signedUrl);
                         postAlbum.setCoverUrl(signedUrl);
                     } catch (Exception e) {
                     } catch (Exception e) {
                         e.printStackTrace();
                         e.printStackTrace();
@@ -152,7 +152,7 @@ public class AlbumService {
                     int channelCode = postItem.getChannelCode();
                     int channelCode = postItem.getChannelCode();
                     String objectId = postItem.getObjectId();
                     String objectId = postItem.getObjectId();
                     try {
                     try {
-                        String signedUrl = ossService.getSignedUrl(channelCode, objectId);
+                        String signedUrl = ossService.getSignedUrl(objectId);
                         postAlbum.setCoverUrl(signedUrl);
                         postAlbum.setCoverUrl(signedUrl);
                     } catch (Exception e) {
                     } catch (Exception e) {
                         e.printStackTrace();
                         e.printStackTrace();

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/CrawledDataService.java

@@ -73,7 +73,7 @@ public class CrawledDataService {
         int channelCode = 101;
         int channelCode = 101;
         String videoFileId = videoFileUpdate.getVideoFileId();
         String videoFileId = videoFileUpdate.getVideoFileId();
         try {
         try {
-            VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
+            VideoInfo videoInfo = ossService.getVideoInfo(videoFileId);
             if (videoInfo == null) {
             if (videoInfo == null) {
                 log.error("{} not exist", videoFileId);
                 log.error("{} not exist", videoFileId);
                 return;
                 return;
@@ -82,7 +82,7 @@ public class CrawledDataService {
             videoRepository.updateBiliVideoFile(videoId, videoInfo, channelCode);
             videoRepository.updateBiliVideoFile(videoId, videoInfo, channelCode);
             int scope = videoPost.getScope();
             int scope = videoPost.getScope();
             if (scope != PostScope.PRIVATE.getCode()) {
             if (scope != PostScope.PRIVATE.getCode()) {
-                ossService.setObjectScope(channelCode, videoFileId, scope);
+                ossService.setObjectScope(videoFileId, scope);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/VideoService.java

@@ -49,7 +49,7 @@ public class VideoService {
             try {
             try {
                 int channelCode = videoUrlDto.getChannelCode();
                 int channelCode = videoUrlDto.getChannelCode();
                 String videoFileId = videoUrlDto.getObjectId();
                 String videoFileId = videoUrlDto.getObjectId();
-                String signedUrl = ossService.getSignedUrl(channelCode, videoFileId);
+                String signedUrl = ossService.getSignedUrl(videoFileId);
                 return new DownloadUrl(signedUrl, "");
                 return new DownloadUrl(signedUrl, "");
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();

+ 5 - 3
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPlayServiceImpl.java

@@ -24,6 +24,7 @@ import cn.reghao.tnb.content.app.vod.service.rcmd.UserInterestBased;
 import cn.reghao.tnb.message.api.dto.MediaProgress;
 import cn.reghao.tnb.message.api.dto.MediaProgress;
 import cn.reghao.tnb.user.api.dto.UserCard;
 import cn.reghao.tnb.user.api.dto.UserCard;
 import cn.reghao.tnb.user.api.iface.UserService;
 import cn.reghao.tnb.user.api.iface.UserService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
  * @author reghao
  * @author reghao
  * @date 2024-08-07 07:22:34
  * @date 2024-08-07 07:22:34
  */
  */
+@Slf4j
 @Service
 @Service
 public class VideoPlayServiceImpl implements VideoPlayService {
 public class VideoPlayServiceImpl implements VideoPlayService {
     @DubboReference(check = false, timeout = 60_000, retries = 0)
     @DubboReference(check = false, timeout = 60_000, retries = 0)
@@ -100,16 +102,16 @@ public class VideoPlayServiceImpl implements VideoPlayService {
                         int channelCode = videoUrlDto.getChannelCode();
                         int channelCode = videoUrlDto.getChannelCode();
                         String videoFileId = videoUrlDto.getObjectId();
                         String videoFileId = videoUrlDto.getObjectId();
                         String quality = videoUrlDto.getQuality();
                         String quality = videoUrlDto.getQuality();
-                        String signedUrl = ossService.getSignedUrl(channelCode, videoFileId);
+                        String signedUrl = ossService.getSignedUrl(videoFileId);
                         return new VideoUrl(quality, signedUrl);
                         return new VideoUrl(quality, signedUrl);
                     } catch (Exception e) {
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        log.error("{}", e.getMessage());
                     }
                     }
                     return null;
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
                 }).filter(Objects::nonNull).collect(Collectors.toList());
                 return new VideoUrls(currentTime, urlType, urls);
                 return new VideoUrls(currentTime, urlType, urls);
             } catch (Exception e) {
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("{}", e.getMessage());
             }
             }
             return new VideoUrls();
             return new VideoUrls();
         } else {
         } else {

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostQueryImpl.java

@@ -308,7 +308,7 @@ public class VideoPostQueryImpl implements VideoPostQuery {
         for (VideoUrlDto videoUrlDto : list) {
         for (VideoUrlDto videoUrlDto : list) {
             String videoFileId = videoUrlDto.getObjectId();
             String videoFileId = videoUrlDto.getObjectId();
             try {
             try {
-                VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
+                VideoInfo videoInfo = ossService.getVideoInfo(videoFileId);
                 return videoInfo != null ? List.of(videoInfo) : Collections.emptyList();
                 return videoInfo != null ? List.of(videoInfo) : Collections.emptyList();
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();

+ 24 - 28
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostServiceImpl.java

@@ -4,7 +4,8 @@ import cn.reghao.file.api.iface.JobService;
 import cn.reghao.file.api.iface.OssService;
 import cn.reghao.file.api.iface.OssService;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.string.IdGenerator;
 import cn.reghao.jutil.jdk.string.IdGenerator;
-import cn.reghao.oss.api.dto.media.ImageInfo;
+import cn.reghao.oss.api.dto.ObjectChannel;
+import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
 import cn.reghao.oss.api.dto.media.VideoUrlDto;
 import cn.reghao.oss.api.dto.media.VideoUrlDto;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.common.auth.UserContext;
@@ -61,10 +62,9 @@ public class VideoPostServiceImpl implements VideoPostService {
         String title = videoFilePublish.getFilename();
         String title = videoFilePublish.getFilename();
         String videoFileId = videoFilePublish.getVideoFileId();
         String videoFileId = videoFilePublish.getVideoFileId();
         int channelCode = videoFilePublish.getChannelCode();
         int channelCode = videoFilePublish.getChannelCode();
-        ossService.setObjectUpload(channelCode, videoFileId);
-        VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
+        VideoInfo videoInfo = ossService.getVideoInfo(videoFileId);
         if (!videoInfo.getFormatName().contains("mov,mp4")) {
         if (!videoInfo.getFormatName().contains("mov,mp4")) {
-            long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
+            //long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
                 /*Result result1 = fileService.convertVideo(videoFileId, channelCode);
                 /*Result result1 = fileService.convertVideo(videoFileId, channelCode);
                 if (result1.getCode() == ResultStatus.SUCCESS.getCode()) {
                 if (result1.getCode() == ResultStatus.SUCCESS.getCode()) {
                     videoPost.setStatus(VideoStatus.converted.getCode());
                     videoPost.setStatus(VideoStatus.converted.getCode());
@@ -83,15 +83,13 @@ public class VideoPostServiceImpl implements VideoPostService {
     public Result publishVideoPost(VideoPublishSbt videoPublishSbt) {
     public Result publishVideoPost(VideoPublishSbt videoPublishSbt) {
         Result result;
         Result result;
         try {
         try {
-            int coverChannelCode = videoPublishSbt.getCoverChannelCode();
             String coverFileId = videoPublishSbt.getCoverFileId();
             String coverFileId = videoPublishSbt.getCoverFileId();
-            ossService.setObjectUpload(coverChannelCode, coverFileId);
-            ImageInfo imageInfo = ossService.getImageInfo(coverChannelCode, coverFileId);
-            if (imageInfo == null) {
+            ObjectInfo objectInfo = ossService.getObjectInfo(coverFileId);
+            if (objectInfo == null) {
                 String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
                 String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
                 return Result.fail(errMsg);
                 return Result.fail(errMsg);
             }
             }
-            String coverUrl = imageInfo.getUrl();
+            String coverUrl = objectInfo.getUrl();
 
 
             String videoId = videoPublishSbt.getVideoId();
             String videoId = videoPublishSbt.getVideoId();
             VideoPost videoPost = videoRepository.getVideoPost(videoId);
             VideoPost videoPost = videoRepository.getVideoPost(videoId);
@@ -109,15 +107,15 @@ public class VideoPostServiceImpl implements VideoPostService {
             String videoFileId = videoFile.getObjectId();
             String videoFileId = videoFile.getObjectId();
 
 
             int channelCode = videoFile.getChannelCode();
             int channelCode = videoFile.getChannelCode();
-            Integer channelScope = ossService.getChannelScope(channelCode);
-            if (channelScope == null ) {
+            ObjectChannel objectChannel = ossService.getChannel(channelCode);
+            if (objectChannel == null ) {
                 String errMsg = String.format("channelCode %s 的 scope 在 oss 中不存在", channelCode);
                 String errMsg = String.format("channelCode %s 的 scope 在 oss 中不存在", channelCode);
                 return Result.fail(errMsg);
                 return Result.fail(errMsg);
             }
             }
 
 
             int scope = videoPublishSbt.getScope();
             int scope = videoPublishSbt.getScope();
-            if (channelScope != scope) {
-                ossService.setObjectScope(channelCode, videoFileId, scope);
+            if (objectChannel.getScope() != scope) {
+                ossService.setObjectScope(videoFileId, scope);
             }
             }
 
 
             Set<String> tags = videoPublishSbt.getTags();
             Set<String> tags = videoPublishSbt.getTags();
@@ -176,10 +174,10 @@ public class VideoPostServiceImpl implements VideoPostService {
             try {
             try {
                 int channelCode = videoUrlDto.getChannelCode();
                 int channelCode = videoUrlDto.getChannelCode();
                 int scope = videoScopeUpdate.getScope();
                 int scope = videoScopeUpdate.getScope();
-                ossService.setObjectScope(channelCode, videoFileId, scope);
+                ossService.setObjectScope(videoFileId, scope);
                 videoPostMapper.updateVideoScope(videoScopeUpdate);
                 videoPostMapper.updateVideoScope(videoScopeUpdate);
             } catch (Exception e) {
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("{}", e.getMessage());
             }
             }
         }
         }
     }
     }
@@ -203,18 +201,17 @@ public class VideoPostServiceImpl implements VideoPostService {
 
 
         String coverFileId = videoCoverUpdate.getCoverFileId();
         String coverFileId = videoCoverUpdate.getCoverFileId();
         try {
         try {
-            int channelCode = 105;
-            ImageInfo imageInfo = ossService.getImageInfo(channelCode, coverFileId);
-            if (imageInfo == null) {
+            ObjectInfo objectInfo = ossService.getObjectInfo(coverFileId);
+            if (objectInfo == null) {
                 return;
                 return;
             }
             }
 
 
-            String coverUrl = imageInfo.getUrl();
+            String coverUrl = objectInfo.getUrl();
             videoPostMapper.updateVideoCover(videoId, coverUrl);
             videoPostMapper.updateVideoCover(videoId, coverUrl);
             String currentCover = videoPost.getCoverUrl();
             String currentCover = videoPost.getCoverUrl();
             deleteCoverFile(currentCover);
             deleteCoverFile(currentCover);
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("{}", e.getMessage());;
         }
         }
     }
     }
 
 
@@ -222,7 +219,7 @@ public class VideoPostServiceImpl implements VideoPostService {
         try {
         try {
             ossService.deleteByObjectUrl(coverUrl);
             ossService.deleteByObjectUrl(coverUrl);
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("{}", e.getMessage());;
         }
         }
     }
     }
 
 
@@ -238,7 +235,7 @@ public class VideoPostServiceImpl implements VideoPostService {
             String videoFileId = videoFileUpdate.getVideoFileId();
             String videoFileId = videoFileUpdate.getVideoFileId();
             try {
             try {
                 int channelCode = 101;
                 int channelCode = 101;
-                VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
+                VideoInfo videoInfo = ossService.getVideoInfo(videoFileId);
                 if (videoInfo == null) {
                 if (videoInfo == null) {
                     log.error("{} not exist", videoFileId);
                     log.error("{} not exist", videoFileId);
                     return;
                     return;
@@ -247,12 +244,12 @@ public class VideoPostServiceImpl implements VideoPostService {
                 videoPostMapper.updateVideoFile(videoId, videoInfo);
                 videoPostMapper.updateVideoFile(videoId, videoInfo);
                 int scope = videoPost.getScope();
                 int scope = videoPost.getScope();
                 if (scope != PostScope.PRIVATE.getCode()) {
                 if (scope != PostScope.PRIVATE.getCode()) {
-                    ossService.setObjectScope(channelCode, videoId, scope);
+                    ossService.setObjectScope(videoId, scope);
                 }
                 }
 
 
-                ossService.deleteByObjectId(channelCode, videoFileId);
+                ossService.deleteByObjectId(videoFileId);
             } catch (Exception e) {
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("{}", e.getMessage());;
             }
             }
         }
         }
     }
     }
@@ -270,10 +267,9 @@ public class VideoPostServiceImpl implements VideoPostService {
             for (VideoUrlDto videoUrlDto : list) {
             for (VideoUrlDto videoUrlDto : list) {
                 String videoFileId = videoUrlDto.getObjectId();
                 String videoFileId = videoUrlDto.getObjectId();
                 try {
                 try {
-                    int channelCode = videoUrlDto.getChannelCode();
-                    ossService.deleteByObjectId(channelCode, videoFileId);
+                    ossService.deleteByObjectId(videoFileId);
                 } catch (Exception e) {
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.error("{}", e.getMessage());;
                 }
                 }
             }
             }
         }
         }

+ 15 - 16
file/file-api/src/main/java/cn/reghao/file/api/iface/OssService.java

@@ -1,28 +1,27 @@
 package cn.reghao.file.api.iface;
 package cn.reghao.file.api.iface;
 
 
+import cn.reghao.oss.api.dto.ObjectChannel;
 import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.oss.api.dto.ServerInfo;
 import cn.reghao.oss.api.dto.ServerInfo;
-import cn.reghao.oss.api.dto.media.AudioInfo;
-import cn.reghao.oss.api.dto.media.ConvertedImageInfo;
-import cn.reghao.oss.api.dto.media.ImageInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
+import cn.reghao.oss.api.dto.rest.UploadFileRet;
+import cn.reghao.oss.api.dto.rest.UploadPrepare;
+import cn.reghao.oss.api.dto.rest.UploadPrepareRet;
+import cn.reghao.oss.api.dto.rest.UploadSample;
 
 
 /**
 /**
  * @author reghao
  * @author reghao
  * @date 2024-07-03 14:40:25
  * @date 2024-07-03 14:40:25
  */
  */
 public interface OssService {
 public interface OssService {
-    ServerInfo getUploadStore(String channelName) throws Exception;
-    Integer getChannelScope(int channelCode);
-    void setObjectUpload(int channelCode, String objectId) throws Exception;
-    void setObjectScope(int channelCode, String objectId, int scope) throws Exception;
-    void deleteByObjectId(int channelCode, String objectId) throws Exception;
-    void deleteByObjectUrl(String objectUrl) throws Exception;
-    ObjectInfo getObjectInfo(int channelCode, String objectId) throws Exception;
-    String getSignedUrl(int channelCode, String objectId) throws Exception;
-    String getSignedUrlByUrl(int channelCode, String objectUrl) throws Exception;
-    VideoInfo getVideoInfo(int channelCode, String videoFileId) throws Exception;
-    ImageInfo getImageInfo(int channelCode, String imageFileId) throws Exception;
-    ConvertedImageInfo getWebpInfo(int channelCode, String imageFileId) throws Exception;
-    AudioInfo getAudioInfo(int channelCode, String audioFileId) throws Exception;
+    ServerInfo getUploadStore(int channelCode);
+    UploadPrepareRet prepareUpload(UploadPrepare uploadPrepare);
+    UploadFileRet checkSample(UploadSample uploadSample);
+    ObjectChannel getChannel(int channelCode);
+    void setObjectScope(String objectId, int scope);
+    void deleteByObjectId(String objectId);
+    void deleteByObjectUrl(String objectUrl);
+    String getSignedUrl(String objectId);
+    ObjectInfo getObjectInfo(String objectId);
+    VideoInfo getVideoInfo(String videoFileId);
 }
 }

+ 30 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/config/ClientAvailabilityAspect.java

@@ -0,0 +1,30 @@
+package cn.reghao.tnb.file.app.config;
+
+import cn.reghao.tnb.file.app.rpc.OssClientManager;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author reghao
+ * @date 2026-04-27 16:22:31
+ */
+@Aspect
+@Component
+public class ClientAvailabilityAspect {
+    private final OssClientManager ossClientManager;
+
+    public ClientAvailabilityAspect(OssClientManager ossClientManager) {
+        this.ossClientManager = ossClientManager;
+    }
+
+    // 拦截 StoreServiceWrapperRouter 下的所有公共方法
+    @Around("execution(* cn.reghao.tnb.file.app.rpc.StoreServiceWrapperRouter.*(..))")
+    public Object checkOssClientAvailability(ProceedingJoinPoint joinPoint) throws Throwable {
+        if (ossClientManager.getOssClient() == null) {
+            throw new RuntimeException("OssClient 未初始化");
+        }
+        return joinPoint.proceed();
+    }
+}

+ 43 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/AdminFileController.java

@@ -0,0 +1,43 @@
+package cn.reghao.tnb.file.app.controller;
+
+import cn.reghao.tnb.common.web.WebResult;
+import cn.reghao.tnb.file.app.model.dto.OssConfigDto;
+import cn.reghao.tnb.file.app.model.po.OssConfig;
+import cn.reghao.tnb.file.app.service.AdminFileService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2026-04-27 17:04:34
+ */
+@Tag(name = "file 管理接口")
+@RestController
+@RequestMapping("/api/admin/file")
+public class AdminFileController {
+    private final AdminFileService adminFileService;
+
+    public AdminFileController(AdminFileService adminFileService) {
+        this.adminFileService = adminFileService;
+    }
+
+    @Operation(summary = "获取文件存储列表", description = "N")
+    @GetMapping(value = "/file_store", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getFileStores() {
+        List<OssConfig> list = adminFileService.getOssConfigList();
+        return WebResult.success(list);
+    }
+
+    @Operation(summary = "添加文件存储", description = "N")
+    @PostMapping(value = "/file_store", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ResponseBody
+    public String addFileStore(@RequestBody @Validated OssConfigDto ossConfigDto) {
+        adminFileService.addOssConfig(ossConfigDto);
+        return WebResult.success();
+    }
+}

+ 30 - 8
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/FileOssController.java

@@ -1,5 +1,9 @@
 package cn.reghao.tnb.file.app.controller;
 package cn.reghao.tnb.file.app.controller;
 
 
+import cn.reghao.oss.api.dto.rest.UploadFileRet;
+import cn.reghao.oss.api.dto.rest.UploadPrepare;
+import cn.reghao.oss.api.dto.rest.UploadPrepareRet;
+import cn.reghao.oss.api.dto.rest.UploadSample;
 import cn.reghao.tnb.common.web.WebResult;
 import cn.reghao.tnb.common.web.WebResult;
 import cn.reghao.oss.api.dto.ServerInfo;
 import cn.reghao.oss.api.dto.ServerInfo;
 import cn.reghao.tnb.common.auth.AuthUser;
 import cn.reghao.tnb.common.auth.AuthUser;
@@ -8,7 +12,9 @@ import cn.reghao.tnb.file.app.rpc.StoreServiceWrapperRouter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import org.springframework.http.MediaType;
 import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
@@ -30,8 +36,8 @@ public class FileOssController {
     @Operation(summary = "获取图片上传 token", description = "N")
     @Operation(summary = "获取图片上传 token", description = "N")
     @PostMapping(value = "/serverinfo/image", produces = MediaType.APPLICATION_JSON_VALUE)
     @PostMapping(value = "/serverinfo/image", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getImageChannelInfo() throws Exception {
     public String getImageChannelInfo() throws Exception {
-        String channelName = UploadChannelType.imageChannel.name();
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
+        int channelCode = UploadChannelType.imageChannel.getChannelCode();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelCode);
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
     }
     }
 
 
@@ -39,8 +45,8 @@ public class FileOssController {
     @Operation(summary = "获取照片上传 token", description = "N")
     @Operation(summary = "获取照片上传 token", description = "N")
     @PostMapping(value = "/serverinfo/photo", produces = MediaType.APPLICATION_JSON_VALUE)
     @PostMapping(value = "/serverinfo/photo", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getPhotoChannelInfo() throws Exception {
     public String getPhotoChannelInfo() throws Exception {
-        String channelName = UploadChannelType.photoChannel.name();
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
+        int channelCode = UploadChannelType.photoChannel.getChannelCode();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelCode);
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
     }
     }
 
 
@@ -48,8 +54,8 @@ public class FileOssController {
     @Operation(summary = "获取视频上传 token", description = "N")
     @Operation(summary = "获取视频上传 token", description = "N")
     @PostMapping(value = "/serverinfo/video", produces = MediaType.APPLICATION_JSON_VALUE)
     @PostMapping(value = "/serverinfo/video", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getVideoChannelInfo() throws Exception {
     public String getVideoChannelInfo() throws Exception {
-        String channelName = UploadChannelType.videoChannel.name();
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
+        int channelCode = UploadChannelType.videoChannel.getChannelCode();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelCode);
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
     }
     }
 
 
@@ -57,8 +63,24 @@ public class FileOssController {
     @Operation(summary = "获取文件上传 token", description = "N")
     @Operation(summary = "获取文件上传 token", description = "N")
     @PostMapping(value = "/serverinfo/file", produces = MediaType.APPLICATION_JSON_VALUE)
     @PostMapping(value = "/serverinfo/file", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getFileChannelInfo() throws Exception {
     public String getFileChannelInfo() throws Exception {
-        String channelName = UploadChannelType.fileChannel.name();
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
+        int channelCode = UploadChannelType.fileChannel.getChannelCode();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelCode);
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
         return serverInfo != null ? WebResult.success(serverInfo) : WebResult.failWithMsg("get ServerInfo failed");
     }
     }
+
+    @AuthUser
+    @Operation(summary = "文件上传前的预检", description = "N")
+    @PostMapping(value = "/prepare_upload", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String prepareUpload(@RequestBody @Validated UploadPrepare uploadPrepare) throws Exception {
+        UploadPrepareRet uploadPrepareRet = storeServiceWrapperRouter.prepareUpload(uploadPrepare);
+        return WebResult.success(uploadPrepareRet);
+    }
+
+    @AuthUser
+    @Operation(summary = "文件快传的二次检查", description = "N")
+    @PostMapping(value = "/check_sample", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String checkSample(@RequestBody @Validated UploadSample uploadSample) throws Exception {
+        UploadFileRet uploadFileRet = storeServiceWrapperRouter.checkSample(uploadSample);
+        return WebResult.success(uploadFileRet);
+    }
 }
 }

+ 14 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/dto/OssConfigDto.java

@@ -0,0 +1,14 @@
+package cn.reghao.tnb.file.app.model.dto;
+
+import lombok.Data;
+
+/**
+ * @author reghao
+ * @date 2026-04-27 17:09:29
+ */
+@Data
+public class OssConfigDto {
+    private String endpoint;
+    private String accessKeyId;
+    private String accessKeySecret;
+}

+ 10 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/OssConfig.java

@@ -1,13 +1,16 @@
 package cn.reghao.tnb.file.app.model.po;
 package cn.reghao.tnb.file.app.model.po;
 
 
 import cn.reghao.jutil.jdk.web.db.BaseObject;
 import cn.reghao.jutil.jdk.web.db.BaseObject;
+import cn.reghao.tnb.file.app.model.dto.OssConfigDto;
 import lombok.Getter;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.Setter;
 
 
 /**
 /**
  * @author reghao
  * @author reghao
  * @date 2026-03-02 21:47:20
  * @date 2026-03-02 21:47:20
  */
  */
+@NoArgsConstructor
 @Setter
 @Setter
 @Getter
 @Getter
 public class OssConfig extends BaseObject<Integer> {
 public class OssConfig extends BaseObject<Integer> {
@@ -15,4 +18,11 @@ public class OssConfig extends BaseObject<Integer> {
     private String endpoint;
     private String endpoint;
     private String accessKeyId;
     private String accessKeyId;
     private String accessKeySecret;
     private String accessKeySecret;
+
+    public OssConfig(OssConfigDto ossConfigDto) {
+        this.ossType = 1;
+        this.endpoint = ossConfigDto.getEndpoint();
+        this.accessKeyId = ossConfigDto.getAccessKeyId();
+        this.accessKeySecret = ossConfigDto.getAccessKeySecret();
+    }
 }
 }

+ 37 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/OssClientManager.java

@@ -0,0 +1,37 @@
+package cn.reghao.tnb.file.app.rpc;
+
+import cn.reghao.oss.sdk.OssClient;
+import cn.reghao.tnb.file.app.db.mapper.OssConfigMapper;
+import cn.reghao.tnb.file.app.model.po.OssConfig;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author reghao
+ * @date 2026-04-27 16:16:20
+ */
+@Component
+public class OssClientManager {
+    private final OssConfigMapper ossConfigMapper;
+    private OssClient ossClient;
+
+    public OssClientManager(OssConfigMapper ossConfigMapper) {
+        this.ossConfigMapper = ossConfigMapper;
+    }
+
+    public OssClient getOssClient() {
+        if (this.ossClient == null) {
+            int ossType = 1;
+            OssConfig ossConfig = ossConfigMapper.findByOssType(ossType);
+            if (ossConfig == null) {
+                throw new RuntimeException("OssClient not exist");
+            }
+
+            String endpoint = ossConfig.getEndpoint();
+            String ak = ossConfig.getAccessKeyId();
+            String sk = ossConfig.getAccessKeySecret();
+            this.ossClient = new OssClient(endpoint, ak, sk);
+        }
+
+        return this.ossClient;
+    }
+}

+ 46 - 121
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/StoreServiceWrapperRouter.java

@@ -2,19 +2,17 @@ package cn.reghao.tnb.file.app.rpc;
 
 
 import cn.reghao.file.api.iface.OssService;
 import cn.reghao.file.api.iface.OssService;
 import cn.reghao.oss.api.constant.ObjectAction;
 import cn.reghao.oss.api.constant.ObjectAction;
-import cn.reghao.oss.sdk.OssClient;
 import cn.reghao.oss.api.constant.ObjectScope;
 import cn.reghao.oss.api.constant.ObjectScope;
+import cn.reghao.oss.api.dto.ObjectChannel;
 import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.oss.api.dto.ServerInfo;
 import cn.reghao.oss.api.dto.ServerInfo;
-import cn.reghao.oss.api.dto.media.AudioInfo;
-import cn.reghao.oss.api.dto.media.ConvertedImageInfo;
-import cn.reghao.oss.api.dto.media.ImageInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
 import cn.reghao.oss.api.dto.media.VideoInfo;
-import cn.reghao.tnb.file.app.db.mapper.OssConfigMapper;
+import cn.reghao.oss.api.dto.rest.UploadFileRet;
+import cn.reghao.oss.api.dto.rest.UploadPrepare;
+import cn.reghao.oss.api.dto.rest.UploadPrepareRet;
+import cn.reghao.oss.api.dto.rest.UploadSample;
 import cn.reghao.tnb.file.app.model.constant.OssType;
 import cn.reghao.tnb.file.app.model.constant.OssType;
-import cn.reghao.tnb.file.app.model.po.OssConfig;
-import cn.reghao.tnb.file.app.service.StoreConfigService;
-import jakarta.annotation.PostConstruct;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -22,160 +20,87 @@ import org.springframework.stereotype.Service;
  * @author reghao
  * @author reghao
  * @date 2024-07-03 14:40:25
  * @date 2024-07-03 14:40:25
  */
  */
+@Slf4j
 @DubboService
 @DubboService
 @Service
 @Service
 public class StoreServiceWrapperRouter implements OssService {
 public class StoreServiceWrapperRouter implements OssService {
     private final int ossType = 1;
     private final int ossType = 1;
-    private final StoreConfigService storeConfigService;
-    private final OssConfigMapper ossConfigMapper;
-    private OssClient ossClient;
+    private final OssClientManager ossClientManager;
 
 
-    public StoreServiceWrapperRouter(StoreConfigService storeConfigService, OssConfigMapper ossConfigMapper) {
-        this.storeConfigService = storeConfigService;
-        this.ossConfigMapper = ossConfigMapper;
-    }
-
-    @PostConstruct
-    public void init() {
-        OssConfig ossConfig = ossConfigMapper.findByOssType(ossType);
-        String endpoint = ossConfig.getEndpoint();
-        String ak = ossConfig.getAccessKeyId();
-        String sk = ossConfig.getAccessKeySecret();
-        this.ossClient = new OssClient(endpoint, ak, sk);
-    }
-
-    @Override
-    public ServerInfo getUploadStore(String channelName) throws Exception {
-        /*int ossUser = storeConfigService.getLocalOssUser();
-        UploadChannel uploadChannel = storeRepository.getUploadChannel(ossUser, channelName);*/
-        int channelCode = 101;
-        return ossClient.getServerInfo();
+    public StoreServiceWrapperRouter(OssClientManager ossClientManager) {
+        this.ossClientManager = ossClientManager;
     }
     }
 
 
     @Override
     @Override
-    public Integer getChannelScope(int channelCode) {
-        /*try {
-            if (ossType == OssType.localOss.getCode()) {
-                OssConsoleClient ossConsoleClient = ossConsoleClientFactory.getOssConsoleClient();
-                return ossConsoleClient.getChannelScope(channelCode);
-            } else if (ossType == OssType.aliyunOss.getCode()) {
-            }
+    public ServerInfo getUploadStore(int channelCode) {
+        try {
+            return ossClientManager.getOssClient().getServerInfo(channelCode);
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
-        }*/
-        return ObjectScope.PRIVATE.getCode();
-    }
-
-    @Override
-    public void setObjectUpload(int channelCode, String objectId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //storeServiceWrapper.setObjectUpload(channelCode, objectId, ossUser);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
+            throw new RuntimeException(e);
         }
         }
     }
     }
 
 
-    @Override
-    public void setObjectScope(int channelCode, String objectId, int scope) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //storeServiceWrapper.setObjectScope(channelCode, objectId, scope, ossUser);
-            ossClient.setObjectScope(objectId);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
-        }
-    }
-
-    @Override
-    public void deleteByObjectId(int channelCode, String objectId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //storeServiceWrapper.deleteByObjectId(channelCode, objectId, ossUser);
-            ossClient.deleteObject(objectId);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
+    public UploadPrepareRet prepareUpload(UploadPrepare uploadPrepare) {
+        try {
+            return ossClientManager.getOssClient().prepareUpload(uploadPrepare);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
         }
     }
     }
 
 
-    @Override
-    public void deleteByObjectUrl(String objectUrl) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //storeServiceWrapper.deleteByObjectUrl(objectUrl, ossUser);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
+    public UploadFileRet checkSample(UploadSample uploadSample) {
+        try {
+            return ossClientManager.getOssClient().checkSample(uploadSample);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
         }
     }
     }
 
 
     @Override
     @Override
-    public ObjectInfo getObjectInfo(int channelCode, String objectId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //storeServiceWrapper.getObjectInfo(channelCode, objectId, ossUser);
-            return ossClient.getObjectInfo(objectId);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
+    public ObjectChannel getChannel(int channelCode) {
+        try {
+            return ossClientManager.getOssClient().getChannel(channelCode);
+            /*if (ossType == OssType.localOss.getCode()) {
+                return ossClientManager.getOssClient().getChannel(channelCode);
+            } else if (ossType == OssType.aliyunOss.getCode()) {
+            }*/
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
         }
-
-        throw new Exception("OSSType not found");
     }
     }
 
 
     @Override
     @Override
-    public String getSignedUrl(int channelCode, String objectId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
+    public void setObjectScope(String objectId, int scope) {
         if (ossType == OssType.localOss.getCode()) {
         if (ossType == OssType.localOss.getCode()) {
-            //return storeServiceWrapper.getSignedUrl(channelCode, objectId, ossUser);
-            return ossClient.getSignedUrl(objectId, ObjectAction.access.getName());
+            ossClientManager.getOssClient().setObjectScope(objectId, ObjectScope.PUBLIC);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
         }
-
-        throw new Exception("OSSType not found");
     }
     }
 
 
     @Override
     @Override
-    public String getSignedUrlByUrl(int channelCode, String objectUrl) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //return storeServiceWrapper.getSignedUrlByUrl(channelCode, objectUrl, ossUser);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
-        }
-
-        throw new Exception("OSSType not found");
+    public void deleteByObjectId(String objectId) {
     }
     }
 
 
     @Override
     @Override
-    public VideoInfo getVideoInfo(int channelCode, String videoFileId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        //storeServiceWrapper.getVideoInfo(channelCode, videoFileId, ossUser);
-        return ossClient.getVideoInfo(videoFileId);
+    public void deleteByObjectUrl(String objectUrl) {
     }
     }
 
 
     @Override
     @Override
-    public ImageInfo getImageInfo(int channelCode, String imageFileId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //return storeServiceWrapper.getImageInfo(channelCode, imageFileId, ossUser);
-            return ossClient.getImageInfo(imageFileId);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
+    public String getSignedUrl(String objectId) {
+        try {
+            return ossClientManager.getOssClient().getSignedUrl(objectId, ObjectAction.access.getName());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
         }
-
-        throw new Exception("OSSType not found");
     }
     }
 
 
     @Override
     @Override
-    public ConvertedImageInfo getWebpInfo(int channelCode, String imageFileId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //return storeServiceWrapper.getWebpInfo(channelCode, imageFileId, ossUser);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
-        }
-        throw new Exception("OSSType not found");
+    public ObjectInfo getObjectInfo(String objectId) {
+        return ossClientManager.getOssClient().getObjectInfo(objectId);
     }
     }
 
 
     @Override
     @Override
-    public AudioInfo getAudioInfo(int channelCode, String audioFileId) throws Exception {
-        int ossUser = storeConfigService.getLocalOssUser();
-        if (ossType == OssType.localOss.getCode()) {
-            //return storeServiceWrapper.getAudioInfo(channelCode, audioFileId, ossUser);
-        } else if (ossType == OssType.aliyunOss.getCode()) {
-        }
-
-        throw new Exception("OSSType not found");
+    public VideoInfo getVideoInfo(String videoFileId) {
+        return ossClientManager.getOssClient().getVideoInfo(videoFileId);
     }
     }
 }
 }

+ 37 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/AdminFileService.java

@@ -0,0 +1,37 @@
+package cn.reghao.tnb.file.app.service;
+
+import cn.reghao.tnb.file.app.db.mapper.OssConfigMapper;
+import cn.reghao.tnb.file.app.model.dto.OssConfigDto;
+import cn.reghao.tnb.file.app.model.po.OssConfig;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2026-04-27 17:08:01
+ */
+@Service
+public class AdminFileService {
+    private final OssConfigMapper ossConfigMapper;
+
+    public AdminFileService(OssConfigMapper ossConfigMapper) {
+        this.ossConfigMapper = ossConfigMapper;
+    }
+
+    public void addOssConfig(OssConfigDto ossConfigDto) {
+        OssConfig ossConfig = new OssConfig(ossConfigDto);
+        ossConfigMapper.save(ossConfig);
+    }
+
+    public List<OssConfig> getOssConfigList() {
+        int ossType = 1;
+        OssConfig ossConfig = ossConfigMapper.findByOssType(ossType);
+        if (ossConfig != null) {
+            return List.of(ossConfig);
+        }
+
+        return Collections.emptyList();
+    }
+}

+ 4 - 6
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/AvatarService.java

@@ -1,7 +1,7 @@
 package cn.reghao.tnb.file.app.service;
 package cn.reghao.tnb.file.app.service;
 
 
 import cn.reghao.file.api.iface.OssService;
 import cn.reghao.file.api.iface.OssService;
-import cn.reghao.oss.api.dto.media.ImageInfo;
+import cn.reghao.oss.api.dto.ObjectInfo;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.auth.api.iface.AccountQuery;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.file.app.model.dto.AvatarUpdate;
 import cn.reghao.tnb.file.app.model.dto.AvatarUpdate;
@@ -24,12 +24,10 @@ public class AvatarService {
     }
     }
 
 
     public String updateAvatar(AvatarUpdate avatarUpdate) throws Exception {
     public String updateAvatar(AvatarUpdate avatarUpdate) throws Exception {
-        int channelCode = avatarUpdate.getChannelCode();
         String uploadId = avatarUpdate.getUploadId();
         String uploadId = avatarUpdate.getUploadId();
-        ossService.setObjectUpload(channelCode, uploadId);
-        ImageInfo imageInfo = ossService.getImageInfo(channelCode, uploadId);
-        if (imageInfo != null) {
-            String avatarUrl = imageInfo.getUrl();
+        ObjectInfo objectInfo = ossService.getObjectInfo(uploadId);
+        if (objectInfo != null) {
+            String avatarUrl = objectInfo.getUrl();
             long loginUser = UserContext.getUserId();
             long loginUser = UserContext.getUserId();
             accountQuery.updateAvatar(loginUser, avatarUrl);
             accountQuery.updateAvatar(loginUser, avatarUrl);
             return avatarUrl;
             return avatarUrl;

+ 0 - 32
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/StoreConfigService.java

@@ -1,32 +0,0 @@
-package cn.reghao.tnb.file.app.service;
-
-import cn.reghao.tnb.auth.api.iface.AccountQuery;
-import cn.reghao.tnb.common.auth.AccountRole;
-import cn.reghao.tnb.common.util.ConstantId;
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-/**
- * @author reghao
- * @date 2024-09-09 11:35:55
- */
-@Service
-public class StoreConfigService {
-    @DubboReference(check = false, retries = 0, timeout = 60_000)
-    private AccountQuery accountQuery;
-
-    public int getLocalOssUser() {
-        Integer ossUser = getOssUser();
-        return ossUser != null ? ossUser : (int) ConstantId.ANONYMOUS_USER_ID;
-    }
-
-    @Cacheable(cacheNames = "tnb:file:oss_user", key = "'local_oss_user'", unless = "#result == null")
-    public Integer getOssUser() {
-        long ossUser = accountQuery.getByRole(AccountRole.admin.getValue());
-        if (ossUser != ConstantId.ANONYMOUS_USER_ID) {
-            return (int) ossUser;
-        }
-        return null;
-    }
-}

+ 2 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/CamRecordService.java

@@ -70,7 +70,7 @@ public class CamRecordService {
         try {
         try {
             int videoChannelCode = camRecordDto.getVideoChannelCode();
             int videoChannelCode = camRecordDto.getVideoChannelCode();
             String videoFileId = camRecordDto.getVideoFileId();
             String videoFileId = camRecordDto.getVideoFileId();
-            VideoInfo videoInfo = ossService.getVideoInfo(videoChannelCode, videoFileId);
+            VideoInfo videoInfo = ossService.getVideoInfo(videoFileId);
 
 
             int duration = videoInfo.getDuration();
             int duration = videoInfo.getDuration();
             long recordId = idService.getLongId();
             long recordId = idService.getLongId();
@@ -156,7 +156,7 @@ public class CamRecordService {
 
 
         String videoFileId = camRecord.getVideoFileId();
         String videoFileId = camRecord.getVideoFileId();
         try {
         try {
-            String signedUrl = ossService.getSignedUrl(camChannelCode, videoFileId);
+            String signedUrl = ossService.getSignedUrl(videoFileId);
             return new CamRecordDetail(camRecord, signedUrl);
             return new CamRecordDetail(camRecord, signedUrl);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();

+ 2 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/DiskAlbumService.java

@@ -256,7 +256,7 @@ public class DiskAlbumService {
             String coverUrl = "";
             String coverUrl = "";
             try {
             try {
                 String coverFileId = diskAlbum.getCoverFileId();
                 String coverFileId = diskAlbum.getCoverFileId();
-                coverUrl = ossService.getSignedUrl(channelCode, coverFileId);
+                coverUrl = ossService.getSignedUrl(coverFileId);
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("getSignedUrl error: {}", e.getMessage());
                 log.error("getSignedUrl error: {}", e.getMessage());
             }
             }
@@ -330,7 +330,7 @@ public class DiskAlbumService {
         for (DiskFileDetail diskFileDetail : list) {
         for (DiskFileDetail diskFileDetail : list) {
             String fileId = diskFileDetail.getFileId();
             String fileId = diskFileDetail.getFileId();
             try {
             try {
-                String signedUrl = ossService.getSignedUrl(channelCode, fileId);
+                String signedUrl = ossService.getSignedUrl(fileId);
                 diskFileDetail.setUrl(signedUrl);
                 diskFileDetail.setUrl(signedUrl);
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();

+ 3 - 3
file/file-service/src/main/java/cn/reghao/tnb/file/app/zdisk/service/DiskFileService.java

@@ -58,7 +58,7 @@ public class DiskFileService {
         try {
         try {
             int channelCode = uploadedFile.getChannelCode();
             int channelCode = uploadedFile.getChannelCode();
             String uploadId = uploadedFile.getUploadId();
             String uploadId = uploadedFile.getUploadId();
-            ObjectInfo objectInfo = ossService.getObjectInfo(channelCode, uploadId);
+            ObjectInfo objectInfo = ossService.getObjectInfo(uploadId);
             String filename = objectInfo.getFilename();
             String filename = objectInfo.getFilename();
             String path = FileUtil.getCanonicalPath(String.format("%s/%s", parentPath, filename));
             String path = FileUtil.getCanonicalPath(String.format("%s/%s", parentPath, filename));
             DiskFile diskFile2 = findByPath(path);
             DiskFile diskFile2 = findByPath(path);
@@ -585,8 +585,8 @@ public class DiskFileService {
 
 
     public DiskFileDetail getDiskFileDetail(int channelCode, String objectId) {
     public DiskFileDetail getDiskFileDetail(int channelCode, String objectId) {
         try {
         try {
-            ObjectInfo objectInfo = ossService.getObjectInfo(channelCode, objectId);
-            String signedUrl = ossService.getSignedUrl(channelCode, objectId);
+            ObjectInfo objectInfo = ossService.getObjectInfo(objectId);
+            String signedUrl = ossService.getSignedUrl(objectId);
             return new DiskFileDetail(objectInfo, signedUrl);
             return new DiskFileDetail(objectInfo, signedUrl);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();

+ 2 - 1
file/file-service/src/test/java/DiskUnitTest.java

@@ -122,7 +122,8 @@ public class DiskUnitTest {
         String sk = "28aQEK7wJ6U5m7E1u7";
         String sk = "28aQEK7wJ6U5m7E1u7";
         OssClient ossClient = new OssClient(endpoint, ak, sk);
         OssClient ossClient = new OssClient(endpoint, ak, sk);
 
 
-        ServerInfo serverInfo = ossClient.getServerInfo();
+        int channelCode = 101;
+        ServerInfo serverInfo = ossClient.getServerInfo(channelCode);
         String uploadUrl = serverInfo.getOssUrl();
         String uploadUrl = serverInfo.getOssUrl();
         String uploadToken = serverInfo.getToken();
         String uploadToken = serverInfo.getToken();