reghao 6 hónapja
szülő
commit
d3ece208c9
52 módosított fájl, 535 hozzáadás és 313 törlés
  1. 0 22
      account/account-api/src/main/java/cn/reghao/tnb/account/api/dto/AdminCreateAccount.java
  2. 1 0
      account/account-api/src/main/java/cn/reghao/tnb/account/api/iface/AccountQuery.java
  3. 0 2
      account/account-api/src/main/java/cn/reghao/tnb/account/api/iface/AdminAccountService.java
  4. 33 4
      account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountCodeController.java
  5. 6 1
      account/account-service/src/main/java/cn/reghao/tnb/account/app/db/repository/AccountRepository.java
  6. 29 12
      account/account-service/src/main/java/cn/reghao/tnb/account/app/model/po/UserAccount.java
  7. 10 1
      account/account-service/src/main/java/cn/reghao/tnb/account/app/rpc/AccountQueryImpl.java
  8. 0 5
      account/account-service/src/main/java/cn/reghao/tnb/account/app/rpc/AdminAccountServiceImpl.java
  9. 0 3
      account/account-service/src/main/java/cn/reghao/tnb/account/app/service/AccountRegistryService.java
  10. 26 35
      account/account-service/src/main/java/cn/reghao/tnb/account/app/service/impl/AccountRegistryServiceImpl.java
  11. 1 1
      account/account-service/src/main/resources/mapper/UserAccountRoleMapper.xml
  12. 1 1
      content/content-api/src/main/java/cn/reghao/tnb/content/api/dto/VideoPublishSbt.java
  13. 3 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ImagePostService.java
  14. 12 5
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/AdminVodController.java
  15. 21 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/dto/CategoryAdd.java
  16. 19 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/dto/NoticeAdd.java
  17. 3 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/PostAlbum.java
  18. 15 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoCategory.java
  19. 16 8
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/AdminVodService.java
  20. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPostServiceImpl.java
  21. 8 0
      content/content-service/src/main/resources/mapper/vod/VideoCategoryMapper.xml
  22. 9 0
      content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java
  23. 11 11
      file/file-api/src/main/java/cn/reghao/file/api/iface/OssService.java
  24. 4 4
      file/file-service/pom.xml
  25. 5 41
      file/file-service/src/main/java/cn/reghao/tnb/file/app/config/CacheConfig.java
  26. 1 1
      file/file-service/src/main/java/cn/reghao/tnb/file/app/config/OssConsoleClientFactory.java
  27. 3 5
      file/file-service/src/main/java/cn/reghao/tnb/file/app/config/SpringLifecycle.java
  28. 9 4
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/FileOssController.java
  29. 10 12
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UploadChannelController.java
  30. 9 4
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UserKeyController.java
  31. 2 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UserNodeController.java
  32. 2 1
      file/file-service/src/main/java/cn/reghao/tnb/file/app/db/mapper/UploadChannelMapper.java
  33. 14 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/db/repository/StoreRepository.java
  34. 49 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/constant/UploadChannelType.java
  35. 10 4
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/dto/UploadChannelDto.java
  36. 18 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/UploadChannel.java
  37. 2 2
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/UserNode.java
  38. 17 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/model/vo/AddChannelAttr.java
  39. 6 6
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/ConsoleServiceImpl.java
  40. 2 6
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/FileServiceImpl.java
  41. 2 4
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/JobServiceImpl.java
  42. 25 20
      file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/StoreServiceWrapperRouter.java
  43. 17 0
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/StoreConfigService.java
  44. 26 4
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/StoreNodeService.java
  45. 32 16
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UploadChannelService.java
  46. 7 10
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UserKeyService.java
  47. 19 6
      file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UserNodeService.java
  48. 11 6
      file/file-service/src/main/resources/mapper/UploadChannelMapper.xml
  49. 2 10
      file/file-service/src/main/resources/mapper/UserKeyMapper.xml
  50. 5 5
      file/file-service/src/main/resources/mapper/UserNodeMapper.xml
  51. 0 13
      user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/AdminUserController.java
  52. 0 5
      user/user-service/src/main/java/cn/reghao/tnb/user/app/service/AdminUserService.java

+ 0 - 22
account/account-api/src/main/java/cn/reghao/tnb/account/api/dto/AdminCreateAccount.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.account.api.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
-/**
- * @author reghao
- * @date 2025-03-26 15:05:42
- */
-@Setter
-@Getter
-public class AdminCreateAccount implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @NotBlank(message = "邮箱/手机号尚未填写")
-    private String username;
-    @NotBlank(message = "密码尚未填写")
-    private String password;
-}

+ 1 - 0
account/account-api/src/main/java/cn/reghao/tnb/account/api/iface/AccountQuery.java

@@ -16,6 +16,7 @@ public interface AccountQuery {
     List<AccountInfo> getAccountInfos(List<Long> userIds);
     AccountInfo getByMobile(String mobile);
     AccountInfo getByUsername(String username);
+    long getByRole(String role);
     @Deprecated
     Long createCrawledAccount(CrawledUser crawledUser);
     void updateAvatar(long userId, String avatarUrl);

+ 0 - 2
account/account-api/src/main/java/cn/reghao/tnb/account/api/iface/AdminAccountService.java

@@ -4,7 +4,6 @@ import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.tnb.account.api.dto.AccountInfo;
 import cn.reghao.tnb.account.api.dto.AccountRegistry;
 import cn.reghao.tnb.account.api.dto.AccountRegistryStatus;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 
 /**
  * @author reghao
@@ -16,5 +15,4 @@ public interface AdminAccountService {
     void setAccountCode(AccountRegistryStatus accountRegistryStatus);
 
     PageList<AccountInfo> getByScreenName(String screenName, int pageNumber, int pageSize);
-    void createAccount(AdminCreateAccount adminCreateAccount);
 }

+ 33 - 4
account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountCodeController.java

@@ -8,13 +8,20 @@ import cn.reghao.tnb.account.app.service.CodeService;
 import cn.reghao.tnb.account.app.service.PubkeyService;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.ClassUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.security.NoSuchAlgorithmException;
 import java.util.Base64;
 
@@ -24,7 +31,7 @@ import java.util.Base64;
  */
 @Tag(name = "验证码接口")
 @RestController
-@RequestMapping("/api/auth/code")
+@RequestMapping("/api/auth")
 public class AccountCodeController {
     private final CodeService codeService;
     private final PubkeyService pubkeyService;
@@ -35,14 +42,14 @@ public class AccountCodeController {
     }
 
     @Operation(summary = "获取加密需要的公钥", description = "N")
-    @GetMapping(value = "/pubkey", produces = MediaType.APPLICATION_JSON_VALUE)
+    @GetMapping(value = "/code/pubkey", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getPubkey(@RequestParam("channel") Integer channel) throws NoSuchAlgorithmException {
         RsaPubkey rsaPubkey = pubkeyService.getPubkey();
         return WebResult.success(rsaPubkey);
     }
 
     @Operation(summary = "获取图形验证码", description = "N")
-    @GetMapping(value = "/captcha", produces = MediaType.APPLICATION_JSON_VALUE)
+    @GetMapping(value = "/code/captcha", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getCaptcha() throws IOException {
         InputStream in = codeService.generateCaptcha();
         byte[] base64Bytes = Base64.getEncoder().encode(in.readAllBytes());
@@ -52,9 +59,31 @@ public class AccountCodeController {
     }
 
     @Operation(summary = "获取短信/邮件验证码", description = "N")
-    @PostMapping(value = "/verify", produces = MediaType.APPLICATION_JSON_VALUE)
+    @PostMapping(value = "/code/verify", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getVerifyCode(@RequestBody @Validated VerifyCode verifyCode) {
         Result result = codeService.sendVerifyCode(verifyCode);
         return WebResult.result(result);
     }
+
+    @Operation(summary = "头像", description = "N")
+    @GetMapping(value = "/avatar.jpg", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<byte[]> getAvatar() throws IOException {
+        String avatarResource = "static/dist/images/face.jpg";
+        InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(avatarResource);
+        byte[] imageBytes = resourceAsStream.readAllBytes();
+
+        /*URL resource = Thread.currentThread().getContextClassLoader().getResource(avatarResource);
+        String avatarPath = resource.getPath();
+        System.out.println(avatarPath);
+        File file = new File(avatarPath);
+        byte[] imageBytes = Files.readAllBytes(file.toPath());*/
+
+        // 构建 HTTP 响应头
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.IMAGE_JPEG);
+        headers.setContentLength(imageBytes.length);
+
+        // 返回包含图片字节数组的 ResponseEntity
+        return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
+    }
 }

+ 6 - 1
account/account-service/src/main/java/cn/reghao/tnb/account/app/db/repository/AccountRepository.java

@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
  */
 @Repository
 public class AccountRepository {
+    private final long startUserId = 10001L;
     private final UserAccountMapper userAccountMapper;
     private final UserRegistryMapper userRegistryMapper;
     private final UserAccountRoleMapper userAccountRoleMapper;
@@ -76,7 +77,7 @@ public class AccountRepository {
         long userId;
         Long maxUserId = userAccountMapper.findMaxUserId();
         if (maxUserId == null) {
-            userId = 10001L;
+            userId = startUserId;
         } else {
             userId = maxUserId + 1;
         }
@@ -84,6 +85,10 @@ public class AccountRepository {
         return userId;
     }
 
+    public long getStartUserId() {
+        return this.startUserId;
+    }
+
     @Cacheable(cacheNames = "tnb:account:info", key = "#userId", unless = "#result == null")
     public AccountInfo getAccountInfo(long userId) {
         AccountInfo accountInfo = userAccountMapper.findAccountInfo(userId);

+ 29 - 12
account/account-service/src/main/java/cn/reghao/tnb/account/app/model/po/UserAccount.java

@@ -1,9 +1,8 @@
 package cn.reghao.tnb.account.app.model.po;
 
 import cn.reghao.jutil.jdk.db.BaseObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
+import cn.reghao.tnb.common.auth.AccountRole;
+import lombok.*;
 import org.hibernate.validator.constraints.Length;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -41,15 +40,20 @@ public class UserAccount extends BaseObject<Integer> implements UserDetails {
     private transient int plat;
 
     // Spring Security 使用的字段
-    private transient Set<UserAuthority> authorities;
+    private Set<UserAuthority> authorities;
     private Boolean enabled;
     private Boolean locked;
 
-    public UserAccount(long userId, String email, String mobile, String avatarUrl) {
+    /**
+     * 验证码登入创建的帐号
+     *
+     * @param
+     * @return
+     * @date 2025-10-19 17:10:646
+     */
+    public UserAccount(long userId, String avatarUrl) {
         this.userId = userId;
         this.username = String.format("tnb_%s", userId);
-        this.email = email;
-        this.mobile = mobile;
         this.encodedPassword = "";
         this.salt = "";
         this.createAt = LocalDateTime.now();
@@ -60,11 +64,9 @@ public class UserAccount extends BaseObject<Integer> implements UserDetails {
         this.authorities = Set.of(new UserAuthority());
     }
 
-    public UserAccount(long userId, String email, String mobile, String encodedPassword, String salt, String avatarUrl) {
+    public UserAccount(long userId, String encodedPassword, String salt, String avatarUrl, Set<UserAuthority> authorities) {
         this.userId = userId;
         this.username = String.format("tnb_%s", userId);
-        this.mobile = mobile;
-        this.email = email;
         this.encodedPassword = encodedPassword;
         this.salt = salt;
         this.createAt = LocalDateTime.now();
@@ -72,11 +74,18 @@ public class UserAccount extends BaseObject<Integer> implements UserDetails {
         this.locked = false;
         this.screenName = this.username;
         this.avatarUrl = avatarUrl;
-        this.authorities = Set.of(new UserAuthority());
+        this.authorities = authorities;
     }
 
+    /**
+     * 使用爬虫数据创建的帐号
+     *
+     * @param
+     * @return
+     * @date 2025-10-19 17:10:262
+     */
     @Deprecated
-    public UserAccount(long userId, String email, String username, String screenName, String avatarUrl) {
+    public UserAccount(long userId, String email, String mobile, String encodedPassword, String salt, String username, String screenName, String avatarUrl) {
         this.userId = userId;
         this.username = username;
         this.email = email;
@@ -88,6 +97,14 @@ public class UserAccount extends BaseObject<Integer> implements UserDetails {
         this.authorities = Set.of(new UserAuthority());
     }
 
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
     public Long getUserId() {
         return userId;
     }

+ 10 - 1
account/account-service/src/main/java/cn/reghao/tnb/account/app/rpc/AccountQueryImpl.java

@@ -95,6 +95,12 @@ public class AccountQueryImpl implements AccountQuery {
         return accountRepository.getAccountInfoByUsername(username);
     }
 
+    @Override
+    public long getByRole(String role) {
+        List<Long> userIds = accountRepository.getRoleUsers(role);
+        return userIds.isEmpty() ? -1 : userIds.get(0);
+    }
+
     @Override
     public Long createCrawledAccount(CrawledUser crawledUser) {
         String screenName = crawledUser.getScreenName();
@@ -108,7 +114,10 @@ public class AccountQueryImpl implements AccountQuery {
         }
 
         String email = String.format("%s@tnb.cn", userId);
-        UserAccount userAccount = new UserAccount(userId, email, username, screenName, avatarUrl);
+        String mobile = String.format("190%s", userId);
+        String password = "";
+        String salt = "";
+        UserAccount userAccount = new UserAccount(userId, email, mobile, password, salt, username, screenName, avatarUrl);
         accountRepository.saveAccount(userAccount);
         return userId;
     }

+ 0 - 5
account/account-service/src/main/java/cn/reghao/tnb/account/app/rpc/AdminAccountServiceImpl.java

@@ -4,7 +4,6 @@ import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.tnb.account.api.dto.AccountInfo;
 import cn.reghao.tnb.account.api.dto.AccountRegistry;
 import cn.reghao.tnb.account.api.dto.AccountRegistryStatus;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 import cn.reghao.tnb.account.api.iface.AdminAccountService;
 import cn.reghao.tnb.account.app.db.repository.AccountRepository;
 import cn.reghao.tnb.account.app.model.po.UserRegistry;
@@ -52,8 +51,4 @@ public class AdminAccountServiceImpl implements AdminAccountService {
     public PageList<AccountInfo> getByScreenName(String screenName, int pageNumber, int pageSize) {
         return PageList.empty();
     }
-
-    public void createAccount(AdminCreateAccount adminCreateAccount) {
-        accountRegistryService.createAdminAccount(adminCreateAccount);
-    }
 }

+ 0 - 3
account/account-service/src/main/java/cn/reghao/tnb/account/app/service/AccountRegistryService.java

@@ -1,8 +1,6 @@
 package cn.reghao.tnb.account.app.service;
 
 import cn.reghao.jutil.jdk.result.Result;
-import cn.reghao.tnb.account.api.dto.AccountRegistry;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 import cn.reghao.tnb.account.app.model.dto.UserRegisterDto;
 import cn.reghao.tnb.account.app.model.po.UserAccount;
 import cn.reghao.tnb.account.app.model.po.UserRegistry;
@@ -15,5 +13,4 @@ public interface AccountRegistryService {
     UserRegistry getUserRegistry();
     Result createAccount(UserRegisterDto userRegisterDto);
     UserAccount createAccount(String principal, String password);
-    void createAdminAccount(AdminCreateAccount adminCreateAccount);
 }

+ 26 - 35
account/account-service/src/main/java/cn/reghao/tnb/account/app/service/impl/AccountRegistryServiceImpl.java

@@ -5,20 +5,22 @@ import cn.reghao.jutil.jdk.result.ResultStatus;
 import cn.reghao.jutil.jdk.security.RandomString;
 import cn.reghao.jutil.jdk.string.StringRegexp;
 import cn.reghao.tnb.account.api.constant.VerifyChannel;
-import cn.reghao.tnb.account.api.dto.AccountRegistry;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 import cn.reghao.tnb.account.app.model.dto.UserRegisterDto;
 import cn.reghao.tnb.account.app.db.repository.AccountRepository;
+import cn.reghao.tnb.account.app.model.po.UserAuthority;
 import cn.reghao.tnb.account.app.model.po.UserRegistry;
 import cn.reghao.tnb.account.app.service.CodeService;
 import cn.reghao.tnb.account.app.model.po.UserAccount;
 import cn.reghao.tnb.account.app.service.AccountRegistryService;
 import cn.reghao.tnb.account.app.service.PubkeyService;
+import cn.reghao.tnb.common.auth.AccountRole;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
+import java.util.Set;
 
 /**
  * @author reghao
@@ -76,14 +78,6 @@ public class AccountRegistryServiceImpl implements AccountRegistryService {
             return Result.fail("短信验证码不正确, 请重新获取");
         }
 
-        String email = null;
-        String mobile = null;
-        if (StringRegexp.matchEmail(principal)) {
-            email = principal;
-        } else if (StringRegexp.matchMobile(principal)) {
-            mobile = principal;
-        }
-
         String credential = userRegisterDto.getCredential();
         String decryptCredential;
         try {
@@ -95,43 +89,40 @@ public class AccountRegistryServiceImpl implements AccountRegistryService {
         long userId = accountRepository.getNextUserId();
         String salt = RandomString.getSalt(64);
         String encodedPassword = passwordEncoder.encode(decryptCredential + salt);
-        UserAccount userAccount = new UserAccount(userId, email, mobile, encodedPassword, salt, avatarUrl);
-        accountRepository.saveAccount(userAccount);
-        return Result.result(ResultStatus.SUCCESS, "帐号已创建");
-    }
-
-    @Override
-    public void createAdminAccount(AdminCreateAccount adminCreateAccount) {
-        String principal = adminCreateAccount.getUsername();
-        String email = null;
-        String mobile = null;
+        Set<UserAuthority> authorities = Set.of(new UserAuthority());
+        if (userId == accountRepository.getStartUserId()) {
+            authorities = Set.of(
+                    new UserAuthority(AccountRole.admin.getValue()),
+                    new UserAuthority(AccountRole.oss.getValue()));
+        }
+        UserAccount userAccount = new UserAccount(userId, encodedPassword, salt, avatarUrl, authorities);
         if (StringRegexp.matchEmail(principal)) {
-            email = principal;
+            userAccount.setEmail(principal);
         } else if (StringRegexp.matchMobile(principal)) {
-            mobile = principal;
+            userAccount.setMobile(principal);
+        } else {
+            throw new UsernameNotFoundException(String.format("username %s not found", principal));
+            //throw new Exception(String.format("username %s not found", principal));
         }
 
-        String decryptCredential = adminCreateAccount.getPassword();
-        long userId = accountRepository.getNextUserId();
-        String salt = RandomString.getSalt(64);
-        String encodedPassword = passwordEncoder.encode(decryptCredential + salt);
-        UserAccount userAccount = new UserAccount(userId, email, mobile, encodedPassword, salt, avatarUrl);
         accountRepository.saveAccount(userAccount);
+        return Result.result(ResultStatus.SUCCESS, "帐号已创建");
     }
 
     @Override
     public UserAccount createAccount(String principal, String password) {
-        String email = null;
-        String mobile = null;
+        long userId = accountRepository.getNextUserId();
+        UserAccount userAccount = new UserAccount(userId, avatarUrl);
         if (StringRegexp.matchEmail(principal)) {
-            email = principal;
+            userAccount.setEmail(principal);
+            accountRepository.saveAccount(userAccount);
+            return accountRepository.getUserAccountByEmail(principal);
         } else if (StringRegexp.matchMobile(principal)) {
-            mobile = principal;
+            userAccount.setMobile(principal);
+            accountRepository.saveAccount(userAccount);
+            return accountRepository.getUserAccountByMobile(principal);
         }
 
-        long userId = accountRepository.getNextUserId();
-        UserAccount userAccount = new UserAccount(userId, email, mobile, avatarUrl);
-        accountRepository.saveAccount(userAccount);
-        return accountRepository.getUserAccountByMobile(mobile);
+        throw new UsernameNotFoundException(String.format("username %s not found", principal));
     }
 }

+ 1 - 1
account/account-service/src/main/resources/mapper/UserAccountRoleMapper.xml

@@ -22,7 +22,7 @@
         from user_account_role
         where user_id=#{userId}
     </select>
-    <select id="findUserIdsByRoleName" resultType="java.lang.Long">
+    <select id="findUserIdsByRole" resultType="java.lang.Long">
         select user_id
         from user_account_role
         where `name`=#{role}

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

@@ -27,7 +27,7 @@ public class VideoPublishSbt implements Serializable {
     @NotBlank
     private String coverFileId;
     @NotNull
-    private Integer coverChannelId;
+    private Integer coverChannelCode;
     @NotBlank
     private String title;
     private String description;

+ 3 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ImagePostService.java

@@ -59,7 +59,9 @@ public class ImagePostService {
         String albumName = imagePublishSbt.getAlbumName();
         int scope = imagePublishSbt.getScope();
         long albumId = idService.getLongId();
-        PostAlbum postAlbum = new PostAlbum(albumId, albumName, scope);
+        int postType = PostType.Image.getCode();
+        int channelCode = 102;
+        PostAlbum postAlbum = new PostAlbum(albumId, albumName, scope, postType, channelCode);
         albumRepository.savePostAlbum(postAlbum);
         return Result.success();
     }

+ 12 - 5
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/AdminVodController.java

@@ -11,11 +11,14 @@ import cn.reghao.tnb.content.api.dto.VideoRegion;
 import cn.reghao.tnb.content.api.dto.VideoSearch;
 import cn.reghao.tnb.content.api.dto.VideoUrls;
 import cn.reghao.tnb.common.db.SelectOption;
+import cn.reghao.tnb.content.app.vod.model.dto.CategoryAdd;
+import cn.reghao.tnb.content.app.vod.model.dto.NoticeAdd;
 import cn.reghao.tnb.content.app.vod.service.AdminVodService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Collection;
@@ -64,7 +67,6 @@ public class AdminVodController {
 
     @Operation(summary = "稿件预览", description = "N")
     @GetMapping(value = "/video_preview/{videoId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    @ResponseBody
     public String previewPage(@PathVariable(value = "videoId") String videoId) {
         VideoUrls videoInfo = adminVodService.getVideoUrl(videoId);
         return WebResult.success(videoInfo);
@@ -80,16 +82,14 @@ public class AdminVodController {
     @Operation(summary = "站点公告", description = "N")
     @GetMapping(value = "/site_notice", produces = MediaType.APPLICATION_JSON_VALUE)
     public String siteNoticePage() {
-        AccountRegistry accountRegistry = adminAccountService.getAccountRegistry();
         String content = adminVodService.getSiteNotice();
         return WebResult.success(content);
     }
 
     @Operation(summary = "添加站点公告", description = "N")
     @PostMapping(value = "/site_notice", produces = MediaType.APPLICATION_JSON_VALUE)
-    @ResponseBody
-    public String addSiteNotice(String content) {
-        adminVodService.addSiteNotice(content);
+    public String addSiteNotice(@RequestBody @Validated NoticeAdd noticeAdd) {
+        adminVodService.setSiteNotice(noticeAdd);
         return WebResult.success();
     }
 
@@ -103,4 +103,11 @@ public class AdminVodController {
                 .collect(Collectors.toList());
         return WebResult.success(regions);
     }
+
+    @Operation(summary = "添加视频分区", description = "N")
+    @PostMapping(value = "/video_category", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String addVideoCategory(@RequestBody @Validated CategoryAdd categoryAdd) {
+        adminVodService.addVideoCategory(categoryAdd);
+        return WebResult.success();
+    }
 }

+ 21 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/dto/CategoryAdd.java

@@ -0,0 +1,21 @@
+package cn.reghao.tnb.content.app.vod.model.dto;
+
+import lombok.Getter;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author reghao
+ * @date 2025-10-19 14:35:47
+ */
+@Getter
+public class CategoryAdd {
+    @NotNull
+    private Integer pid;
+    @NotNull
+    @NotBlank
+    @Length(min = 1, max = 10)
+    private String name;
+}

+ 19 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/dto/NoticeAdd.java

@@ -0,0 +1,19 @@
+package cn.reghao.tnb.content.app.vod.model.dto;
+
+import lombok.Getter;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author reghao
+ * @date 2025-10-19 14:40:57
+ */
+@Getter
+public class NoticeAdd {
+    @NotNull
+    @NotBlank
+    @Length(min = 1, max = 225)
+    private String content;
+}

+ 3 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/PostAlbum.java

@@ -39,11 +39,12 @@ public class PostAlbum extends BaseObject<Integer> {
         this.createBy = UserContext.getUserId();
     }
 
-    public PostAlbum(long albumId, String albumName, int scope) {
+    public PostAlbum(long albumId, String albumName, int scope, int postType, int channelCode) {
         this.albumId = albumId;
         this.albumName = albumName;
-        this.channelCode = 105;
+        this.channelCode = channelCode;
         this.coverUrl = "";
+        this.postType = postType;
         this.total = 0;
         this.scope = scope;
         this.createAt = System.currentTimeMillis();

+ 15 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoCategory.java

@@ -1,13 +1,16 @@
 package cn.reghao.tnb.content.app.vod.model.po;
 
 import cn.reghao.jutil.jdk.db.BaseObject;
+import cn.reghao.tnb.content.app.vod.model.dto.CategoryAdd;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 /**
  * @author reghao
  * @date 2021-11-23 18:24:30
  */
+@NoArgsConstructor
 @Setter
 @Getter
 public class VideoCategory extends BaseObject<Integer> {
@@ -18,10 +21,20 @@ public class VideoCategory extends BaseObject<Integer> {
     private int sort;
     private boolean vip;
 
+    public VideoCategory(int pid, String name) {
+        this.pid = pid;
+        this.name = name;
+    }
+
+    public VideoCategory(CategoryAdd categoryAdd) {
+        this.pid = categoryAdd.getPid();
+        this.name = categoryAdd.getName();
+    }
+
     @Override
     public int hashCode() {
         int result = 17;
-        result = result * 31 + id.hashCode();
+        result = result * 31 + name.hashCode();
         return result;
     }
 
@@ -33,7 +46,7 @@ public class VideoCategory extends BaseObject<Integer> {
 
         if (other instanceof VideoCategory) {
             VideoCategory o = (VideoCategory) other;
-            return o.id.equals(id);
+            return o.name.equals(name);
         } else {
             return false;
         }

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

@@ -9,8 +9,11 @@ import cn.reghao.oss.sdk.model.dto.media.VideoUrlDto;
 import cn.reghao.tnb.content.api.constant.PostScope;
 import cn.reghao.tnb.content.api.dto.*;
 import cn.reghao.tnb.content.app.vod.db.mapper.SiteNoticeMapper;
+import cn.reghao.tnb.content.app.vod.db.mapper.VideoCategoryMapper;
 import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostMapper;
 import cn.reghao.tnb.content.app.vod.db.repository.VideoRepository;
+import cn.reghao.tnb.content.app.vod.model.dto.CategoryAdd;
+import cn.reghao.tnb.content.app.vod.model.dto.NoticeAdd;
 import cn.reghao.tnb.content.app.vod.model.po.BannerVideo;
 import cn.reghao.tnb.content.app.vod.model.po.SiteNotice;
 import cn.reghao.tnb.content.app.vod.model.po.VideoCategory;
@@ -44,24 +47,23 @@ public class AdminVodService {
     private VideoPostQuery videoPostQuery;
     private VideoRepository videoRepository;
     private CategoryService categoryService;
+    private VideoCategoryMapper videoCategoryMapper;
 
     public AdminVodService(RabbitTemplate rabbitTemplate, SiteNoticeMapper siteNoticeMapper, VideoPostMapper videoPostMapper,
-                           VideoPostQuery videoPostQuery, VideoRepository videoRepository, CategoryService categoryService) {
+                           VideoPostQuery videoPostQuery, VideoRepository videoRepository, CategoryService categoryService,
+                           VideoCategoryMapper videoCategoryMapper) {
         this.rabbitTemplate = rabbitTemplate;
         this.siteNoticeMapper = siteNoticeMapper;
         this.videoPostMapper = videoPostMapper;
         this.videoPostQuery = videoPostQuery;
         this.videoRepository = videoRepository;
         this.categoryService = categoryService;
+        this.videoCategoryMapper = videoCategoryMapper;
     }
 
-    public void addSiteNotice(String content) {
-        setSiteNotice(content);
-    }
-
-    public void setSiteNotice(String content) {
-        long createBy = 10000;
-        SiteNotice siteNotice = new SiteNotice(content, createBy);
+    public void setSiteNotice(NoticeAdd noticeAdd) {
+        long createBy = 10001;
+        SiteNotice siteNotice = new SiteNotice(noticeAdd.getContent(), createBy);
         siteNoticeMapper.save(siteNotice);
     }
 
@@ -218,4 +220,10 @@ public class AdminVodService {
             e.printStackTrace();
         }*/
     }
+
+    public void addVideoCategory(CategoryAdd categoryAdd) {
+        VideoCategory videoCategory1 = new VideoCategory(categoryAdd);
+        List<VideoCategory> list = List.of(videoCategory1);
+        videoCategoryMapper.saveAll(list);
+    }
 }

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

@@ -89,9 +89,9 @@ public class VideoPostServiceImpl implements VideoPostService {
     public Result publishVideoPost(VideoPublishSbt videoPublishSbt) {
         Result result;
         try {
-            int coverChannelId = videoPublishSbt.getCoverChannelId();
+            int coverChannelCode = videoPublishSbt.getCoverChannelCode();
             String coverFileId = videoPublishSbt.getCoverFileId();
-            ImageInfo imageInfo = ossService.getImageInfo(coverChannelId, coverFileId);
+            ImageInfo imageInfo = ossService.getImageInfo(coverChannelCode, coverFileId);
             if (imageInfo == null) {
                 String errMsg = String.format("封面文件 %s 在 oss 中不存在", coverFileId);
                 return Result.fail(errMsg);

+ 8 - 0
content/content-service/src/main/resources/mapper/vod/VideoCategoryMapper.xml

@@ -8,6 +8,14 @@
         values 
         (#{pid},#{name},#{regionId},#{icon},#{sort},#{vip})
     </insert>
+    <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
+        insert into vod_video_category
+        (`pid`,`name`,`region_id`,`icon`,`sort`,`vip`)
+        values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.pid},#{item.name},#{item.regionId},#{item.icon},#{item.sort},#{item.vip})
+        </foreach>
+    </insert>
 
     <select id="findAllCategoryIds" resultType="cn.reghao.tnb.content.api.dto.spider.BiliRegion">
         select region_id,pid as category_pid,id as category_id

+ 9 - 0
content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java

@@ -441,4 +441,13 @@ public class VideoPostTest {
         PageList<VideoCard> pageList1 = searchService.searchByKeyword(kw, "", pn);
         System.out.println();
     }
+
+    @Test
+    public void videoCategoryTest() {
+        VideoCategory videoCategory1 = new VideoCategory(0, "杂");
+        VideoCategory videoCategory2 = new VideoCategory(1, "bili");
+
+        List<VideoCategory> list = List.of(videoCategory1, videoCategory2);
+        videoCategoryMapper.saveAll(list);
+    }
 }

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

@@ -12,16 +12,16 @@ import cn.reghao.oss.sdk.model.dto.media.VideoInfo;
  * @date 2024-07-03 14:40:25
  */
 public interface OssService {
-    ServerInfo getUploadStore(int channelId) throws Exception;
-    Integer getChannelScope(int channelId);
-    void setObjectScope(int channelId, String objectId, int scope) throws Exception;
-    void deleteByObjectId(int channelId, String objectId) throws Exception;
+    ServerInfo getUploadStore(String channelName) throws Exception;
+    Integer getChannelScope(int channelCode);
+    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 channelId, String objectId) throws Exception;
-    String getSignedUrl(int channelId, String objectId) throws Exception;
-    String getSignedUrlByUrl(int channelId, String objectUrl) throws Exception;
-    VideoInfo getVideoInfo(int channelId, String videoFileId) throws Exception;
-    ImageInfo getImageInfo(int channelId, String imageFileId) throws Exception;
-    ConvertedImageInfo getWebpInfo(int channelId, String imageFileId) throws Exception;
-    AudioInfo getAudioInfo(int channelId, String audioFileId) 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;
 }

+ 4 - 4
file/file-service/pom.xml

@@ -75,18 +75,18 @@
             <version>3.1.0</version>
         </dependency>
 
-        <!--<dependency>
+        <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>-->
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-cache</artifactId>
         </dependency>
-        <dependency>
+        <!--<dependency>
             <groupId>com.github.ben-manes.caffeine</groupId>
             <artifactId>caffeine</artifactId>
-        </dependency>
+        </dependency>-->
 
         <dependency>
             <groupId>mysql</groupId>

+ 5 - 41
file/file-service/src/main/java/cn/reghao/tnb/file/app/config/CacheConfig.java

@@ -1,20 +1,18 @@
 package cn.reghao.tnb.file.app.config;
 
-import com.github.benmanes.caffeine.cache.Cache;
-import com.github.benmanes.caffeine.cache.Caffeine;
 import org.springframework.cache.CacheManager;
 import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.cache.caffeine.CaffeineCacheManager;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-/*import org.springframework.data.redis.cache.RedisCacheConfiguration;
+import org.springframework.data.redis.cache.RedisCacheConfiguration;
 import org.springframework.data.redis.cache.RedisCacheManager;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.RedisSerializationContext;
-import org.springframework.data.redis.serializer.RedisSerializer;*/
+import org.springframework.data.redis.serializer.RedisSerializer;
 
-import java.util.concurrent.TimeUnit;
+import java.time.Duration;
+import java.util.Objects;
 
 /**
  * 缓存配置
@@ -25,7 +23,7 @@ import java.util.concurrent.TimeUnit;
 @EnableCaching
 @Configuration
 public class CacheConfig {
-/*    @Bean
+    @Bean
     public CacheManager cacheManager(RedisTemplate<String, Object> template) {
         RedisCacheConfiguration config = RedisCacheConfiguration
                 .defaultCacheConfig()
@@ -53,39 +51,5 @@ public class CacheConfig {
         template.setHashKeySerializer(RedisSerializer.string());
         template.setValueSerializer(RedisSerializer.java());
         return template;
-    }*/
-
-    /**
-     * 为 Spring Cache 的相关注解提供一个缓存
-     *
-     * @param
-     * @return
-     * @date 2024-03-04 16:37:05
-     */
-    @Bean
-    public CacheManager cacheManager() {
-        CaffeineCacheManager cacheManager = new CaffeineCacheManager();
-        Caffeine<Object, Object> caffeineCache = Caffeine.newBuilder()
-                .initialCapacity(1000)
-                .maximumSize(10_000)
-                .expireAfterAccess(365, TimeUnit.DAYS);
-        cacheManager.setCaffeine(caffeineCache);
-        return cacheManager;
-    }
-
-    /**
-     * 提供一个全局的独立缓存
-     *
-     * @param
-     * @return
-     * @date 2024-03-04 16:37:38
-     */
-    @Bean("caffeineCache")
-    public Cache<String, String> caffeineCache() {
-        return Caffeine.newBuilder()
-                .initialCapacity(1000)
-                .maximumSize(10_000)
-                .expireAfterAccess(365, TimeUnit.DAYS)
-                .build();
     }
 }

+ 1 - 1
file/file-service/src/main/java/cn/reghao/tnb/file/app/config/OssConsoleClientFactory.java

@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
  * @author reghao
  * @date 2024-02-24 17:41:42
  */
-@Component
+//@Component
 public class OssConsoleClientFactory {
     private OssConsoleClient ossConsoleClient;
     private OssConsoleConfig ossConsoleConfig;

+ 3 - 5
file/file-service/src/main/java/cn/reghao/tnb/file/app/config/SpringLifecycle.java

@@ -20,16 +20,14 @@ import org.springframework.stereotype.Component;
 public class SpringLifecycle implements ApplicationRunner, DisposableBean {
     private final AppProperties appProperties;
     private final StoreConfigMapper storeConfigMapper;
-    private final OssConsoleClientFactory ossConsoleClientFactory;
+    private OssConsoleClientFactory ossConsoleClientFactory;
     private final AliyunOss aliyunOss;
     private final AliyunService aliyunService;
 
     public SpringLifecycle(AppProperties appProperties, StoreConfigMapper storeConfigMapper,
-                           OssConsoleClientFactory ossConsoleClientFactory, AliyunOss aliyunOss,
-                           AliyunService aliyunService) {
+                           AliyunOss aliyunOss, AliyunService aliyunService) {
         this.appProperties = appProperties;
         this.storeConfigMapper = storeConfigMapper;
-        this.ossConsoleClientFactory = ossConsoleClientFactory;
         this.aliyunOss = aliyunOss;
         this.aliyunService = aliyunService;
     }
@@ -39,7 +37,7 @@ public class SpringLifecycle implements ApplicationRunner, DisposableBean {
         int ossType = appProperties.getOssType();
         StoreConfig storeConfig = storeConfigMapper.findByOssType(ossType);
         if (ossType == OssType.localOss.getCode()) {
-            ossConsoleClientFactory.init(storeConfig);
+            //ossConsoleClientFactory.init(storeConfig);
         } else if (ossType == OssType.aliyunOss.getCode()) {
             aliyunOss.init(storeConfig);
         } else {

+ 9 - 4
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/FileOssController.java

@@ -3,6 +3,7 @@ package cn.reghao.tnb.file.app.controller;
 import cn.reghao.jutil.web.WebResult;
 import cn.reghao.oss.sdk.model.dto.ServerInfo;
 import cn.reghao.tnb.common.auth.AuthUser;
+import cn.reghao.tnb.file.app.model.constant.UploadChannelType;
 import cn.reghao.tnb.file.app.rpc.StoreServiceWrapperRouter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
@@ -29,7 +30,8 @@ public class FileOssController {
     @Operation(summary = "获取图片上传 token", description = "N")
     @PostMapping(value = "/serverinfo/image", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getImageChannelInfo() throws Exception {
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(104);
+        String channelName = UploadChannelType.imageChannel.name();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
         return WebResult.success(serverInfo);
     }
 
@@ -37,7 +39,8 @@ public class FileOssController {
     @Operation(summary = "获取照片上传 token", description = "N")
     @PostMapping(value = "/serverinfo/photo", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getPhotoChannelInfo() throws Exception {
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(105);
+        String channelName = UploadChannelType.photoChannel.name();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
         return WebResult.success(serverInfo);
     }
 
@@ -45,7 +48,8 @@ public class FileOssController {
     @Operation(summary = "获取视频上传 token", description = "N")
     @PostMapping(value = "/serverinfo/video", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getVideoChannelInfo() throws Exception {
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(101);
+        String channelName = UploadChannelType.videoChannel.name();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
         return WebResult.success(serverInfo);
     }
 
@@ -53,7 +57,8 @@ public class FileOssController {
     @Operation(summary = "获取文件上传 token", description = "N")
     @PostMapping(value = "/serverinfo/file", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getFileChannelInfo() throws Exception {
-        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(111);
+        String channelName = UploadChannelType.fileChannel.name();
+        ServerInfo serverInfo = storeServiceWrapperRouter.getUploadStore(channelName);
         return WebResult.success(serverInfo);
     }
 }

+ 10 - 12
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UploadChannelController.java

@@ -8,6 +8,7 @@ import cn.reghao.oss.sdk.model.constant.ObjectType;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.file.app.model.dto.UploadChannelDto;
 import cn.reghao.tnb.common.db.SelectOption;
+import cn.reghao.tnb.file.app.model.vo.AddChannelAttr;
 import cn.reghao.tnb.file.app.model.vo.UploadChannelInfo;
 import cn.reghao.tnb.file.app.model.vo.UserNodeInfo;
 import cn.reghao.tnb.file.app.service.UploadChannelService;
@@ -55,36 +56,33 @@ public class UploadChannelController {
         return WebResult.success(list);
     }
 
-    @Operation(summary = "添加上传通道页面", description = "N")
-    @GetMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addChannelPage(@RequestParam("userNodeId") Integer userNodeId) {
+    @Operation(summary = "上传通道属性", description = "N")
+    @GetMapping(value = "/attr", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String addChannelPage() {
         List<SelectOption> objectTypes = new ArrayList<>();
         for (ObjectType objectType : ObjectType.values()) {
             if (objectType.getCode() == ObjectType.Dir.getCode()) {
                 continue;
             }
-            objectTypes.add(new SelectOption(objectType.getCode()+"", objectType.name()));
+            objectTypes.add(new SelectOption(objectType.name(), objectType.getCode()+""));
         }
 
         List<SelectOption> objectScopes = new ArrayList<>();
         for (ObjectScope objectScope : ObjectScope.values()) {
-            objectScopes.add(new SelectOption(objectScope.getCode()+"", objectScope.name()));
+            objectScopes.add(new SelectOption(objectScope.name(), objectScope.getCode()+""));
         }
 
         List<SelectOption> sizeList = Arrays.stream(ObjectSize.values())
-                .map(objectSize -> new SelectOption(objectSize.getSize()+"", objectSize.getDesc()))
+                .map(objectSize -> new SelectOption(objectSize.getDesc(), objectSize.getSize()+""))
                 .collect(Collectors.toList());
 
-        /*model.addAttribute("objectTypes", objectTypes);
-        model.addAttribute("objectScopes", objectScopes);
-        model.addAttribute("sizeList", sizeList);
-        model.addAttribute("userNodeId", userNodeId);*/
-        return WebResult.success(objectScopes);
+        AddChannelAttr addChannelAttr = new AddChannelAttr(objectTypes, objectScopes, sizeList);
+        return WebResult.success(addChannelAttr);
     }
 
     @Operation(summary = "添加上传通道", description = "N")
     @PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addUploadChannel(@Validated UploadChannelDto uploadChannelDto) throws Exception {
+    public String addUploadChannel(@RequestBody @Validated UploadChannelDto uploadChannelDto) throws Exception {
         Result result = uploadChannelService.addObjectChannel(uploadChannelDto);
         return WebResult.result(result);
     }

+ 9 - 4
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UserKeyController.java

@@ -2,6 +2,7 @@ package cn.reghao.tnb.file.app.controller;
 
 import cn.reghao.jutil.web.WebResult;
 import cn.reghao.tnb.file.app.model.vo.UserKeyVo;
+import cn.reghao.tnb.file.app.service.StoreConfigService;
 import cn.reghao.tnb.file.app.service.UserKeyService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -19,22 +20,26 @@ import java.util.List;
 @RequestMapping("/api/oss/key")
 public class UserKeyController {
     private final UserKeyService userKeyService;
+    private final StoreConfigService storeConfigService;
 
-    public UserKeyController(UserKeyService userKeyService) {
+    public UserKeyController(UserKeyService userKeyService, StoreConfigService storeConfigService) {
         this.userKeyService = userKeyService;
+        this.storeConfigService = storeConfigService;
     }
 
     @Operation(summary = "oss key 页面", description = "N")
     @GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
     public String userKeyPage() {
-        List<UserKeyVo> list = userKeyService.getUserKeys();
+        int ossUser = storeConfigService.getLocalOssUser();
+        List<UserKeyVo> list = userKeyService.getUserKeys(ossUser);
         return WebResult.success(list);
     }
 
     @Operation(summary = "重新生成  oss key", description = "N")
     @PostMapping(value = "/regenerate", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String delete() {
-        userKeyService.regenerate();
+    public String regenerate() {
+        int ossUser = storeConfigService.getLocalOssUser();
+        userKeyService.regenerate(ossUser);
         return WebResult.success();
     }
 }

+ 2 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/controller/UserNodeController.java

@@ -47,14 +47,14 @@ public class UserNodeController {
 
     @Operation(summary = "添加用户节点", description = "N")
     @PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addUserNode(@Validated UserNodeDto userNodeDto) {
+    public String addUserNode(@RequestBody @Validated UserNodeDto userNodeDto) {
         Result result = userNodeService.add(userNodeDto);
         return WebResult.result(result);
     }
 
     @Operation(summary = "更新用户节点", description = "N")
     @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String updateNode(@Validated UserNodeDto userNodeDto) {
+    public String updateNode(@RequestBody @Validated UserNodeDto userNodeDto) {
         return WebResult.success();
     }
 

+ 2 - 1
file/file-service/src/main/java/cn/reghao/tnb/file/app/db/mapper/UploadChannelMapper.java

@@ -17,8 +17,9 @@ public interface UploadChannelMapper extends BaseMapper<UploadChannel> {
 
     int countByCreateBy(long createBy);
     List<UploadChannel> findByCreateBy(long createBy);
+    UploadChannel findById(int id);
     List<UploadChannel> findByCreateByAndUserNodeId(@Param("createBy") long createBy, @Param("userNodeId") int userNodeId);
     UploadChannel findByCreateByAndChannelCode(@Param("createBy") long createBy, @Param("channelCode") int channelCode);
     UploadChannel findByCreateByAndPrefix(@Param("createBy") long createBy, @Param("prefix") String prefix);
-    UploadChannel findById(int id);
+    UploadChannel findByCreateByAndName(@Param("createBy") long createBy, @Param("name") String name);
 }

+ 14 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/db/repository/StoreRepository.java

@@ -3,8 +3,11 @@ package cn.reghao.tnb.file.app.db.repository;
 import cn.reghao.oss.api.dto.StoreNodeDto;
 import cn.reghao.tnb.file.app.db.mapper.StoreNodeMapper;
 import cn.reghao.tnb.file.app.db.mapper.StoreVolumeMapper;
+import cn.reghao.tnb.file.app.db.mapper.UploadChannelMapper;
 import cn.reghao.tnb.file.app.model.po.StoreNode;
 import cn.reghao.tnb.file.app.model.po.StoreVolume;
+import cn.reghao.tnb.file.app.model.po.UploadChannel;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -19,14 +22,17 @@ import java.util.stream.Collectors;
 public class StoreRepository {
     private final StoreNodeMapper storeNodeMapper;
     private final StoreVolumeMapper storeVolumeMapper;
+    private UploadChannelMapper uploadChannelMapper;
 
-    public StoreRepository(StoreNodeMapper storeNodeMapper, StoreVolumeMapper storeVolumeMapper) {
+    public StoreRepository(StoreNodeMapper storeNodeMapper, StoreVolumeMapper storeVolumeMapper,
+                           UploadChannelMapper uploadChannelMapper) {
         this.storeNodeMapper = storeNodeMapper;
         this.storeVolumeMapper = storeVolumeMapper;
+        this.uploadChannelMapper = uploadChannelMapper;
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public void saveStoreNode(StoreNodeDto storeNodeDto) {
+    public int saveStoreNode(StoreNodeDto storeNodeDto) {
         StoreNode storeNode = new StoreNode(storeNodeDto);
         storeNodeMapper.save(storeNode);
 
@@ -37,5 +43,11 @@ public class StoreRepository {
         if (!storeVolumes.isEmpty()) {
             storeVolumeMapper.saveAll(storeVolumes);
         }
+        return storeNode.getId();
+    }
+
+    @Cacheable(cacheNames = "tnb:file:channel", key = "#ossUser + '_' + #channelName", unless = "#result == null")
+    public UploadChannel getUploadChannel(int ossUser, String channelName) {
+        return uploadChannelMapper.findByCreateByAndName(ossUser, channelName);
     }
 }

+ 49 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/constant/UploadChannelType.java

@@ -0,0 +1,49 @@
+package cn.reghao.tnb.file.app.model.constant;
+
+import cn.reghao.oss.api.constant.ObjectSize;
+import cn.reghao.oss.sdk.model.constant.ObjectScope;
+import cn.reghao.oss.sdk.model.constant.ObjectType;
+
+/**
+ * @author reghao
+ * @date 2025-10-19 17:24:54
+ */
+public enum UploadChannelType {
+    videoChannel(101, "video/playback/", ObjectType.Video.getCode(), ObjectSize.mb10.getSize(), ObjectScope.PUBLIC.getCode()),
+    imageChannel(102, "image/i/", ObjectType.Image.getCode(), ObjectSize.mb100.getSize(), ObjectScope.PUBLIC.getCode()),
+    photoChannel(103, "image/p/", ObjectType.Image.getCode(), ObjectSize.gb10.getSize(), ObjectScope.PUBLIC.getCode()),
+    fileChannel(104, "file/", ObjectType.Any.getCode(), ObjectSize.gb10.getSize(), ObjectScope.PRIVATE.getCode());
+
+    private final int channelCode;
+    private final String channelPrefix;
+    private final int fileType;
+    private final long maxSize;
+    private final int scope;
+    UploadChannelType(int channelCode, String channelPrefix, int fileType, long maxSize, int scope) {
+        this.channelCode = channelCode;
+        this.channelPrefix = channelPrefix;
+        this.fileType = fileType;
+        this.maxSize = maxSize;
+        this.scope = scope;
+    }
+
+    public int getChannelCode() {
+        return channelCode;
+    }
+
+    public String getChannelPrefix() {
+        return channelPrefix;
+    }
+
+    public int getFileType() {
+        return fileType;
+    }
+
+    public long getMaxSize() {
+        return maxSize;
+    }
+
+    public int getScope() {
+        return scope;
+    }
+}

+ 10 - 4
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/dto/UploadChannelDto.java

@@ -4,22 +4,28 @@ import cn.reghao.jutil.web.validator.ValidEnum;
 import cn.reghao.oss.api.constant.ObjectSize;
 import cn.reghao.oss.sdk.model.constant.ObjectScope;
 import cn.reghao.oss.sdk.model.constant.ObjectType;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import org.hibernate.validator.constraints.Length;
 
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
 
 /**
  * @author reghao
  * @date 2021-06-03 16:15:23
  */
-@Data
+@Setter
+@Getter
 public class UploadChannelDto {
     //@Pattern(regexp = "(^/)([^\\\\:*<>|\"?\\r\\n\\s/]+/)*([^\\\\:*<>|\"?\\r\\n\\s/]+)?$", message = "通道前缀不匹配")
     @Pattern(regexp = "([^\\\\:*<>|\"?\\r\\n\\s/]+/)*([^\\\\:*<>|\"?\\r\\n\\s/]+)/$", message = "通道前缀不匹配")
-    @Size(min = 2, max = 128, message = "通道前缀超过限制长度")
+    @NotNull
+    @Length(min = 2, max = 128, message = "通道前缀超过限制长度")
     private String channelPrefix;
+    @NotNull
+    @Length(min = 2, max = 128, message = "通道名超过限制长度")
+    private String channelName;
     @ValidEnum(value = ObjectSize.class, message = "通道允许上传的对象大小不合法")
     private Long maxSize;
     @ValidEnum(value = ObjectType.class, message = "通道允许上传的对象类型不合法")

+ 18 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/UploadChannel.java

@@ -1,6 +1,7 @@
 package cn.reghao.tnb.file.app.model.po;
 
 import cn.reghao.jutil.jdk.db.BaseObject;
+import cn.reghao.tnb.file.app.model.constant.UploadChannelType;
 import cn.reghao.tnb.file.app.model.dto.UploadChannelDto;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -15,6 +16,7 @@ import lombok.Setter;
 @Setter
 public class UploadChannel extends BaseObject<Integer> {
     private Integer channelCode;
+    private String name;
     private String prefix;
     private Long maxSize;
     private Integer fileType;
@@ -26,13 +28,27 @@ public class UploadChannel extends BaseObject<Integer> {
 
     public UploadChannel(int channelCode, UploadChannelDto uploadChannelDto, int createBy) {
         this.channelCode = channelCode;
+        this.name = uploadChannelDto.getChannelName();
         this.prefix = uploadChannelDto.getChannelPrefix();
         this.maxSize = uploadChannelDto.getMaxSize();
         this.fileType = uploadChannelDto.getObjectType();
-        this.seturl = false;
         this.scope = uploadChannelDto.getScope();
-        this.enabled = true;
         this.userNodeId = uploadChannelDto.getUserNodeId();
         this.createBy = createBy;
+        this.seturl = false;
+        this.enabled = true;
+    }
+
+    public UploadChannel(int userNodeId, UploadChannelType uploadChannelType, int ossUser) {
+        this.channelCode = uploadChannelType.getChannelCode();
+        this.name = uploadChannelType.name();
+        this.prefix = uploadChannelType.getChannelPrefix();
+        this.maxSize = uploadChannelType.getMaxSize();
+        this.fileType = uploadChannelType.getFileType();
+        this.scope = uploadChannelType.getScope();
+        this.userNodeId = userNodeId;
+        this.createBy = ossUser;
+        this.seturl = false;
+        this.enabled = true;
     }
 }

+ 2 - 2
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/po/UserNode.java

@@ -20,9 +20,9 @@ public class UserNode extends BaseObject<Integer> {
     private String domain;
     private String secretKey;
     private String referer;
-    private Long createBy;
+    private Integer createBy;
 
-    public UserNode(UserNodeDto userNodeDto, long createBy) {
+    public UserNode(UserNodeDto userNodeDto, int createBy) {
         this.storeNodeId = userNodeDto.getStoreNodeId();
         this.domain = userNodeDto.getDomain();
         this.createBy = createBy;

+ 17 - 0
file/file-service/src/main/java/cn/reghao/tnb/file/app/model/vo/AddChannelAttr.java

@@ -0,0 +1,17 @@
+package cn.reghao.tnb.file.app.model.vo;
+
+import cn.reghao.tnb.common.db.SelectOption;
+import lombok.AllArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2025-10-18 20:52:03
+ */
+@AllArgsConstructor
+public class AddChannelAttr {
+    List<SelectOption> objectTypes;
+    List<SelectOption> objectScopes;
+    List<SelectOption> sizeList;
+}

+ 6 - 6
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/ConsoleServiceImpl.java

@@ -12,6 +12,7 @@ import cn.reghao.tnb.file.app.model.po.StoreConfig;
 import cn.reghao.tnb.file.app.model.po.StoreNode;
 import cn.reghao.tnb.file.app.model.po.UploadChannel;
 import cn.reghao.tnb.file.app.model.po.UserNode;
+import cn.reghao.tnb.file.app.service.StoreConfigService;
 import cn.reghao.tnb.file.app.service.StoreNodeService;
 import cn.reghao.tnb.file.app.service.UploadChannelService;
 import cn.reghao.tnb.file.app.service.UserNodeService;
@@ -33,21 +34,20 @@ public class ConsoleServiceImpl implements ConsoleService {
     private final StoreNodeService storeNodeService;
     private final UserNodeService userNodeService;
     private final RpcService rpcService;
-    private final StoreConfigMapper storeConfigMapper;
+    private final StoreConfigService storeConfigService;
 
     public ConsoleServiceImpl(UploadChannelService uploadChannelService, StoreNodeService storeNodeService,
-                              UserNodeService userNodeService, RpcService rpcService, StoreConfigMapper storeConfigMapper) {
+                              UserNodeService userNodeService, RpcService rpcService, StoreConfigService storeConfigService) {
         this.uploadChannelService = uploadChannelService;
         this.storeNodeService = storeNodeService;
         this.userNodeService = userNodeService;
         this.rpcService = rpcService;
-        this.storeConfigMapper = storeConfigMapper;
+        this.storeConfigService = storeConfigService;
     }
 
     @PostConstruct
-    public void postSetOwner() {
-        StoreConfig storeConfig = storeConfigMapper.findByOssType(OssType.localOss.getValue());
-        this.ossUser = Integer.parseInt(storeConfig.getAccessKeyId());
+    public void postSetOssUser() {
+        this.ossUser = storeConfigService.getLocalOssUser(OssType.localOss);
     }
 
     @Override

+ 2 - 6
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/FileServiceImpl.java

@@ -32,19 +32,15 @@ import java.util.stream.Collectors;
 @DubboService
 @Service
 public class FileServiceImpl implements FileService {
-    private final OssConsoleClientFactory ossConsoleClientFactory;
+    private OssConsoleClientFactory ossConsoleClientFactory;
     private final int ossType;
     private final JobDetailMapper jobDetailMapper;
     private final String baseDir;
-    private final AppProperties appProperties;
 
-    private FileServiceImpl(OssConsoleClientFactory ossConsoleClientFactory, JobDetailMapper jobDetailMapper,
-                            AppProperties appProperties) {
-        this.ossConsoleClientFactory = ossConsoleClientFactory;
+    private FileServiceImpl(JobDetailMapper jobDetailMapper, AppProperties appProperties) {
         this.ossType = appProperties.getOssType();
         this.jobDetailMapper = jobDetailMapper;
         this.baseDir = System.getProperty("java.io.tmpdir");
-        this.appProperties = appProperties;
     }
 
     public String getAccountAvatar(long userId) {

+ 2 - 4
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/JobServiceImpl.java

@@ -37,16 +37,14 @@ public class JobServiceImpl implements JobService {
 
     private final SnowFlake idGenerator;
     private final JobContext jobContext;
-    private final OssConsoleClientFactory ossConsoleClientFactory;
+    private OssConsoleClientFactory ossConsoleClientFactory;
     private final JobDetailMapper jobDetailMapper;
     private final String baseDir;
     private final OrderMapper orderMapper;
 
-    public JobServiceImpl(JobContext jobContext, OssConsoleClientFactory ossConsoleClientFactory,
-                          JobDetailMapper jobDetailMapper, OrderMapper orderMapper) {
+    public JobServiceImpl(JobContext jobContext, JobDetailMapper jobDetailMapper, OrderMapper orderMapper) {
         this.idGenerator = new SnowFlake(1L, 1L);
         this.jobContext = jobContext;
-        this.ossConsoleClientFactory = ossConsoleClientFactory;
         this.jobDetailMapper = jobDetailMapper;
         this.baseDir = System.getProperty("java.io.tmpdir");
         this.orderMapper = orderMapper;

+ 25 - 20
file/file-service/src/main/java/cn/reghao/tnb/file/app/rpc/StoreServiceWrapperRouter.java

@@ -10,9 +10,10 @@ import cn.reghao.oss.sdk.model.dto.media.ConvertedImageInfo;
 import cn.reghao.oss.sdk.model.dto.media.ImageInfo;
 import cn.reghao.oss.sdk.model.dto.media.VideoInfo;
 import cn.reghao.tnb.file.app.config.AppProperties;
-import cn.reghao.tnb.file.app.db.mapper.StoreConfigMapper;
+import cn.reghao.tnb.file.app.db.repository.StoreRepository;
 import cn.reghao.tnb.file.app.model.constant.OssType;
-import cn.reghao.tnb.file.app.model.po.StoreConfig;
+import cn.reghao.tnb.file.app.model.po.UploadChannel;
+import cn.reghao.tnb.file.app.service.StoreConfigService;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.stereotype.Service;
 
@@ -25,27 +26,31 @@ import javax.annotation.PostConstruct;
 @DubboService
 @Service
 public class StoreServiceWrapperRouter implements OssService {
-    private int owner = -1;
+    private int ossUser = -1;
     private final int ossType;
     private final ConsoleService consoleService;
     private final StoreServiceWrapper storeServiceWrapper;
-    private final StoreConfigMapper storeConfigMapper;
+    private final StoreConfigService storeConfigService;
+    private final StoreRepository storeRepository;
 
     public StoreServiceWrapperRouter(AppProperties appProperties, ConsoleService consoleService,
-                                     StoreServiceWrapper storeServiceWrapper, StoreConfigMapper storeConfigMapper) {
+                                     StoreServiceWrapper storeServiceWrapper, StoreConfigService storeConfigService,
+                                     StoreRepository storeRepository) {
         this.ossType = appProperties.getOssType();
         this.consoleService = consoleService;
         this.storeServiceWrapper = storeServiceWrapper;
-        this.storeConfigMapper = storeConfigMapper;
+        this.storeConfigService = storeConfigService;
+        this.storeRepository = storeRepository;
     }
 
     @PostConstruct
-    public void postSetOwner() {
-        StoreConfig storeConfig = storeConfigMapper.findByOssType(OssType.localOss.getValue());
-        this.owner = Integer.parseInt(storeConfig.getAccessKeyId());
+    public void postSetOssUser() {
+        this.ossUser = storeConfigService.getLocalOssUser(OssType.localOss);
     }
 
-    public ServerInfo getUploadStore(int channelCode) throws Exception {
+    public ServerInfo getUploadStore(String channelName) throws Exception {
+        UploadChannel uploadChannel = storeRepository.getUploadChannel(ossUser, channelName);
+        int channelCode = uploadChannel.getChannelCode();
         return consoleService.getUploadStore(channelCode);
     }
 
@@ -64,28 +69,28 @@ public class StoreServiceWrapperRouter implements OssService {
 
     public void setObjectScope(int channelCode, String objectId, int scope) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            storeServiceWrapper.setObjectScope(channelCode, objectId, scope, owner);
+            storeServiceWrapper.setObjectScope(channelCode, objectId, scope, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
     }
 
     public void deleteByObjectId(int channelCode, String objectId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            storeServiceWrapper.deleteByObjectId(channelCode, objectId, owner);
+            storeServiceWrapper.deleteByObjectId(channelCode, objectId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
     }
 
     public void deleteByObjectUrl(String objectUrl) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            storeServiceWrapper.deleteByObjectUrl(objectUrl, owner);
+            storeServiceWrapper.deleteByObjectUrl(objectUrl, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
     }
 
     public ObjectInfo getObjectInfo(int channelCode, String objectId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getObjectInfo(channelCode, objectId, owner);
+            return storeServiceWrapper.getObjectInfo(channelCode, objectId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
 
@@ -94,7 +99,7 @@ public class StoreServiceWrapperRouter implements OssService {
 
     public String getSignedUrl(int channelCode, String objectId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getSignedUrl(channelCode, objectId, owner);
+            return storeServiceWrapper.getSignedUrl(channelCode, objectId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
 
@@ -103,7 +108,7 @@ public class StoreServiceWrapperRouter implements OssService {
 
     public String getSignedUrlByUrl(int channelCode, String objectUrl) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getSignedUrlByUrl(channelCode, objectUrl, owner);
+            return storeServiceWrapper.getSignedUrlByUrl(channelCode, objectUrl, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
 
@@ -111,12 +116,12 @@ public class StoreServiceWrapperRouter implements OssService {
     }
 
     public VideoInfo getVideoInfo(int channelCode, String videoFileId) throws Exception {
-        return storeServiceWrapper.getVideoInfo(channelCode, videoFileId, owner);
+        return storeServiceWrapper.getVideoInfo(channelCode, videoFileId, ossUser);
     }
 
     public ImageInfo getImageInfo(int channelCode, String imageFileId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getImageInfo(channelCode, imageFileId, owner);
+            return storeServiceWrapper.getImageInfo(channelCode, imageFileId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
 
@@ -125,7 +130,7 @@ public class StoreServiceWrapperRouter implements OssService {
 
     public ConvertedImageInfo getWebpInfo(int channelCode, String imageFileId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getWebpInfo(channelCode, imageFileId, owner);
+            return storeServiceWrapper.getWebpInfo(channelCode, imageFileId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
         throw new Exception("OSSType not found");
@@ -133,7 +138,7 @@ public class StoreServiceWrapperRouter implements OssService {
 
     public AudioInfo getAudioInfo(int channelCode, String audioFileId) throws Exception {
         if (ossType == OssType.localOss.getCode()) {
-            return storeServiceWrapper.getAudioInfo(channelCode, audioFileId, owner);
+            return storeServiceWrapper.getAudioInfo(channelCode, audioFileId, ossUser);
         } else if (ossType == OssType.aliyunOss.getCode()) {
         }
 

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

@@ -1,8 +1,12 @@
 package cn.reghao.tnb.file.app.service;
 
+import cn.reghao.tnb.account.api.iface.AccountQuery;
+import cn.reghao.tnb.common.auth.AccountRole;
 import cn.reghao.tnb.file.app.db.mapper.StoreConfigMapper;
 import cn.reghao.tnb.file.app.model.constant.OssType;
 import cn.reghao.tnb.file.app.model.po.StoreConfig;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -13,6 +17,8 @@ import java.util.List;
  */
 @Service
 public class StoreConfigService {
+    @DubboReference(check = false, retries = 0, timeout = 60_000)
+    private AccountQuery accountQuery;
     private final StoreConfigMapper storeConfigMapper;
 
     public StoreConfigService(StoreConfigMapper storeConfigMapper) {
@@ -28,6 +34,17 @@ public class StoreConfigService {
     }
 
     public void addStoreConfig(StoreConfig storeConfig) {
+    }
+
+    @Cacheable(cacheNames = "tnb:file:oss_user", key = "#ossType.name", unless = "#result == null")
+    public int getLocalOssUser(OssType ossType) {
+        long ossUser = accountQuery.getByRole(AccountRole.oss.getValue());
+        StoreConfig storeConfig = storeConfigMapper.findByOssType(ossType.getValue());
+        return storeConfig == null ? -1 : Integer.parseInt(storeConfig.getAccessKeyId());
+    }
 
+    public int getLocalOssUser() {
+        long ossUser = accountQuery.getByRole(AccountRole.oss.getValue());
+        return (int) ossUser;
     }
 }

+ 26 - 4
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/StoreNodeService.java

@@ -32,24 +32,39 @@ public class StoreNodeService {
     private final StoreVolumeMapper storeVolumeMapper;
     private final UserNodeMapper userNodeMapper;
     private final StoreServiceWrapper storeServiceWrapper;
-    private StoreRepository storeRepository;
+    private final StoreRepository storeRepository;
+    private final UserNodeService userNodeService;
+    private final UploadChannelService uploadChannelService;
+    private final StoreConfigService storeConfigService;
+    private final UserKeyService userKeyService;
 
     public StoreNodeService(ByteConverter byteConverter, StoreNodeMapper storeNodeMapper,
                             StoreVolumeMapper storeVolumeMapper, UserNodeMapper userNodeMapper,
-                            StoreServiceWrapper storeServiceWrapper, StoreRepository storeRepository) {
+                            StoreServiceWrapper storeServiceWrapper, StoreRepository storeRepository,
+                            UserNodeService userNodeService, UploadChannelService uploadChannelService,
+                            StoreConfigService storeConfigService, UserKeyService userKeyService) {
         this.byteConverter = byteConverter;
         this.storeNodeMapper = storeNodeMapper;
         this.storeVolumeMapper = storeVolumeMapper;
         this.userNodeMapper = userNodeMapper;
         this.storeServiceWrapper = storeServiceWrapper;
         this.storeRepository = storeRepository;
+        this.userNodeService = userNodeService;
+        this.uploadChannelService = uploadChannelService;
+        this.storeConfigService = storeConfigService;
+        this.userKeyService = userKeyService;
     }
 
     public void addOrUpdate(StoreNodeDto storeNodeDto) {
         String nodeAddr = storeNodeDto.getNodeAddr();
         StoreNode storeNode = storeNodeMapper.findByNodeAddr(nodeAddr);
         if (storeNode == null) {
-            storeRepository.saveStoreNode(storeNodeDto);
+            int storeNodeId = storeRepository.saveStoreNode(storeNodeDto);
+
+            int total = storeNodeMapper.findAll().size();
+            if (total == 1) {
+                init(storeNodeId);
+            }
         } else {
             int storeNodeId = storeNode.getId();
             List<StoreVolume> storeVolumes = storeNodeDto.getDiskVolumes().stream()
@@ -59,6 +74,13 @@ public class StoreNodeService {
         }
     }
 
+    private void init(int storeNodeId) {
+        int userNodeId = userNodeService.createUserNode(storeNodeId);
+        int ossUser = storeConfigService.getLocalOssUser();
+        userKeyService.getUserKeys(ossUser);
+        uploadChannelService.createUploadChannel(ossUser, userNodeId);
+    }
+
     public Result updateStatus(int storeNodeId) {
         StoreNode storeNode = storeNodeMapper.findById(storeNodeId);
         if (storeNode != null) {
@@ -119,7 +141,7 @@ public class StoreNodeService {
                 .map(storeNode -> {
                     int storeNodeId = storeNode.getId();
                     String nodeAddr = storeNode.getNodeAddr();
-                    return new SelectOption(storeNodeId+"", nodeAddr);
+                    return new SelectOption(nodeAddr, storeNodeId+"");
                 }).collect(Collectors.toList());
     }
 

+ 32 - 16
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UploadChannelService.java

@@ -9,6 +9,7 @@ import cn.reghao.oss.sdk.model.constant.ObjectScope;
 import cn.reghao.oss.sdk.model.constant.ObjectType;
 import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.file.app.db.mapper.UploadChannelMapper;
+import cn.reghao.tnb.file.app.model.constant.UploadChannelType;
 import cn.reghao.tnb.file.app.model.dto.UploadChannelDto;
 import cn.reghao.tnb.file.app.model.po.UploadChannel;
 import cn.reghao.tnb.file.app.model.po.UserNode;
@@ -17,6 +18,7 @@ import cn.reghao.tnb.file.app.rpc.StoreServiceWrapper;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -30,18 +32,20 @@ public class UploadChannelService {
     private final UploadChannelMapper uploadChannelMapper;
     private final UserNodeService userNodeService;
     private final StoreServiceWrapper storeServiceWrapper;
+    private final StoreConfigService storeConfigService;
 
     public UploadChannelService(ByteConverter byteConverter, UploadChannelMapper uploadChannelMapper,
-                                UserNodeService userNodeService, StoreServiceWrapper storeServiceWrapper) {
+                                UserNodeService userNodeService, StoreServiceWrapper storeServiceWrapper,
+                                StoreConfigService storeConfigService) {
         this.byteConverter = byteConverter;
         this.uploadChannelMapper = uploadChannelMapper;
         this.userNodeService = userNodeService;
         this.storeServiceWrapper = storeServiceWrapper;
+        this.storeConfigService = storeConfigService;
     }
 
-    @Transactional(rollbackFor = Exception.class)
     public synchronized Result addObjectChannel(UploadChannelDto uploadChannelDto) throws Exception {
-        long createBy = UserContext.getUserId();
+        long createBy = storeConfigService.getLocalOssUser();
         int userNodeId = uploadChannelDto.getUserNodeId();
         UserNode userNode = userNodeService.getUserNode(userNodeId);
         if (userNode == null) {
@@ -56,12 +60,30 @@ public class UploadChannelService {
 
         int channelCode = getNextChannelCode(createBy);
         uploadChannel = new UploadChannel(channelCode, uploadChannelDto, (int) createBy);
+        createUploadChannel(uploadChannel);
+        return Result.success();
+    }
+
+    public void createUploadChannel(int ossUser, int userNodeId) {
+        Arrays.asList(UploadChannelType.values()).forEach(uploadChannelType -> {
+            try {
+                UploadChannel uploadChannel = new UploadChannel(userNodeId, uploadChannelType, ossUser);
+                createUploadChannel(uploadChannel);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void createUploadChannel(UploadChannel uploadChannel) throws Exception {
         uploadChannelMapper.save(uploadChannel);
 
+        int userNodeId = uploadChannel.getUserNodeId();
+        String prefix = uploadChannel.getPrefix();
         int scope = uploadChannel.getScope();
-        long loginUser = UserContext.getUserId();
-        storeServiceWrapper.createChannel(userNodeId, channelPrefix, scope, (int) loginUser);
-        return Result.success();
+        int ossUser = storeConfigService.getLocalOssUser();
+        storeServiceWrapper.createChannel(userNodeId, prefix, scope, ossUser);
     }
 
     private int getNextChannelCode(long createBy) {
@@ -88,11 +110,10 @@ public class UploadChannelService {
 
         int channelCode = uploadChannel.getId();
         String prefix = uploadChannel.getPrefix();
-        long loginUser = UserContext.getUserId();
-        Integer total = storeServiceWrapper.countChannelObjects(channelCode, prefix, (int) loginUser);
+        int ossUser = storeConfigService.getLocalOssUser();
+        Integer total = storeServiceWrapper.countChannelObjects(channelCode, prefix, ossUser);
         if (total != null && total == 0) {
-            long owner = UserContext.getUserId();
-            storeServiceWrapper.deleteByObjectName(channelCode, prefix, (int) owner);
+            storeServiceWrapper.deleteByObjectName(channelCode, prefix, ossUser);
             uploadChannelMapper.deleteById(id);
             return Result.result(ResultStatus.SUCCESS);
         }
@@ -102,7 +123,7 @@ public class UploadChannelService {
     }
 
     public List<UploadChannelInfo> getChannelsByUserNode(int userNodeId) {
-        long createBy = UserContext.getUserId();
+        long createBy = storeConfigService.getLocalOssUser();
         List<UploadChannel> page = uploadChannelMapper.findByCreateByAndUserNodeId(createBy, userNodeId);
         List<UploadChannelInfo> list = page.stream().map(uploadChannel -> {
             long maxSize = uploadChannel.getMaxSize();
@@ -147,9 +168,4 @@ public class UploadChannelService {
         String domain = userNode.getDomain();
         return new ObjectChannel(id, channelCode, channelPrefix, maxSize, fileType, seturl, scope, domain, (int) createBy);
     }
-
-    public UploadChannel getUploadChannel(int channelCode) {
-        long loginUser = UserContext.getUserId();
-        return uploadChannelMapper.findByCreateByAndChannelCode(loginUser, channelCode);
-    }
 }

+ 7 - 10
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UserKeyService.java

@@ -65,9 +65,8 @@ public class UserKeyService {
         return null;
     }
 
-    public void regenerate() {
-        long loginUser = UserContext.getUserId();
-        UserKey userKey = userKeyMapper.findByCreateBy(loginUser);
+    public void regenerate(int ossUser) {
+        UserKey userKey = userKeyMapper.findByCreateBy(ossUser);
         if (userKey == null) {
             return;
         }
@@ -79,11 +78,10 @@ public class UserKeyService {
         userKeyMapper.updateByCreateBy(userKey);
     }
 
-    public List<UserKeyVo> getUserKeys() {
-        long loginUser = UserContext.getUserId();
-        UserKey userKey = userKeyMapper.findByCreateBy(loginUser);
+    public List<UserKeyVo> getUserKeys(int ossUser) {
+        UserKey userKey = userKeyMapper.findByCreateBy(ossUser);
         if (userKey == null) {
-            userKey = create();
+            userKey = create(ossUser);
         }
 
         String accessKeyId = userKey.getAccessKeyId();
@@ -91,11 +89,10 @@ public class UserKeyService {
         return List.of(new UserKeyVo(accessKeyId, accessKeySecret));
     }
 
-    private UserKey create() {
-        long loginUser = UserContext.getUserId();
+    private UserKey create(int ossUser) {
         String accessKeyId = RandomString.getString(8);
         String accessKeySecret = RandomString.getString(18);
-        UserKey userKey = new UserKey(accessKeyId, accessKeySecret, loginUser);
+        UserKey userKey = new UserKey(accessKeyId, accessKeySecret, ossUser);
         userKeyMapper.save(userKey);
         return userKey;
     }

+ 19 - 6
file/file-service/src/main/java/cn/reghao/tnb/file/app/service/UserNodeService.java

@@ -25,18 +25,20 @@ public class UserNodeService {
     private final UserNodeMapper userNodeMapper;
     private final StoreNodeMapper storeNodeMapper;
     private final UploadChannelMapper uploadChannelMapper;
+    private final StoreConfigService storeConfigService;
 
     public UserNodeService(UserNodeMapper userNodeMapper, StoreNodeMapper storeNodeMapper,
-                           UploadChannelMapper uploadChannelMapper) {
+                           UploadChannelMapper uploadChannelMapper, StoreConfigService storeConfigService) {
         this.userNodeMapper = userNodeMapper;
         this.storeNodeMapper = storeNodeMapper;
         this.uploadChannelMapper = uploadChannelMapper;
+        this.storeConfigService = storeConfigService;
     }
 
     public Result add(UserNodeDto userNodeDto) {
         int storeNodeId = userNodeDto.getStoreNodeId();
-        long userId = UserContext.getUserId();
-        UserNode userNode = userNodeMapper.findByCreateByAndStoreNodeId(userId, storeNodeId);
+        int ossUser = storeConfigService.getLocalOssUser();
+        UserNode userNode = userNodeMapper.findByCreateByAndStoreNodeId(ossUser, storeNodeId);
         if (userNode != null) {
             return Result.fail("UserNode exist");
         }
@@ -46,17 +48,28 @@ public class UserNodeService {
             return Result.success("StoreNode not exist");
         }
 
-        userNode = new UserNode(userNodeDto, userId);
+        userNode = new UserNode(userNodeDto, ossUser);
         userNodeMapper.save(userNode);
         return Result.success("node added");
     }
 
+    public int createUserNode(int storeNodeId) {
+        int ossUser = storeConfigService.getLocalOssUser();
+        String domain = "";
+        String secretKey = "";
+        String referer = "";
+        UserNode userNode = new UserNode(storeNodeId, domain, secretKey, referer, ossUser);
+        userNodeMapper.save(userNode);
+        int userNodeId = userNode.getId();
+        return userNodeId;
+    }
+
     public Result delete(int id) {
         UserNode userNode = userNodeMapper.findById(id);
         if (userNode != null) {
             int userNodeId = userNode.getId();
-            long userId = UserContext.getUserId();
-            List<UploadChannel> uploadChannels = uploadChannelMapper.findByCreateByAndUserNodeId(userId, userNodeId);
+            int ossUser = storeConfigService.getLocalOssUser();
+            List<UploadChannel> uploadChannels = uploadChannelMapper.findByCreateByAndUserNodeId(ossUser, userNodeId);
             if (!uploadChannels.isEmpty()) {
                 return Result.fail("UploadChannel exists");
             }

+ 11 - 6
file/file-service/src/main/resources/mapper/UploadChannelMapper.xml

@@ -4,16 +4,16 @@
 <mapper namespace="cn.reghao.tnb.file.app.db.mapper.UploadChannelMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into file_upload_channel
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
+        (`channel_code`,`name`,`prefix`,`max_size`,`file_type`,`seturl`,`scope`,`enabled`,`user_node_id`,`create_by`)
         values
-        (#{ossType},#{endpoint},#{accessKeyId},#{accessKeySecret},#{region},#{bucketName},#{roleArn})
+        (#{channelCode},#{name},#{prefix},#{maxSize},#{fileType},#{seturl},#{scope},#{enabled},#{userNodeId},#{createBy})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
         insert into file_upload_channel
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
+        (`channel_code`,`name`,`prefix`,`max_size`,`file_type`,`seturl`,`scope`,`enabled`,`user_node_id`,`create_by`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.ossType},#{item.endpoint},#{item.accessKeyId},#{item.accessKeySecret},#{item.region},#{item.bucketName},#{item.roleArn})
+            (#{item.channelCode},#{item.name},#{item.prefix},#{item.maxSize},#{item.fileType},#{item.seturl},#{item.scope},#{item.enabled},#{item.userNodeId},#{item.createBy})
         </foreach>
     </insert>
 
@@ -32,6 +32,11 @@
         from file_upload_channel
         where create_by=#{createBy}
     </select>
+    <select id="findById" resultType="cn.reghao.tnb.file.app.model.po.UploadChannel">
+        select *
+        from file_upload_channel
+        where id=#{id}
+    </select>
     <select id="findByCreateByAndUserNodeId" resultType="cn.reghao.tnb.file.app.model.po.UploadChannel">
         select *
         from file_upload_channel
@@ -47,9 +52,9 @@
         from file_upload_channel
         where create_by=#{createBy} and prefix like concat(#{prefix},'%')
     </select>
-    <select id="findById" resultType="cn.reghao.tnb.file.app.model.po.UploadChannel">
+    <select id="findByCreateByAndName" resultType="cn.reghao.tnb.file.app.model.po.UploadChannel">
         select *
         from file_upload_channel
-        where id=#{id}
+        where create_by=#{createBy} and name=#{name}
     </select>
 </mapper>

+ 2 - 10
file/file-service/src/main/resources/mapper/UserKeyMapper.xml

@@ -4,17 +4,9 @@
 <mapper namespace="cn.reghao.tnb.file.app.db.mapper.UserKeyMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into file_user_key
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
+        (`access_key_id`,`access_key_secret`,`create_by`)
         values
-        (#{ossType},#{endpoint},#{accessKeyId},#{accessKeySecret},#{region},#{bucketName},#{roleArn})
-    </insert>
-    <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
-        insert into file_user_key
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
-        values
-        <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.ossType},#{item.endpoint},#{item.accessKeyId},#{item.accessKeySecret},#{item.region},#{item.bucketName},#{item.roleArn})
-        </foreach>
+        (#{accessKeyId},#{accessKeySecret},#{createBy})
     </insert>
 
     <update id="updateByCreateBy">

+ 5 - 5
file/file-service/src/main/resources/mapper/UserNodeMapper.xml

@@ -4,16 +4,16 @@
 <mapper namespace="cn.reghao.tnb.file.app.db.mapper.UserNodeMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into file_user_node
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
+        (`store_node_id`,`domain`,`referer`,`secret_key`,`create_by`)
         values
-        (#{ossType},#{endpoint},#{accessKeyId},#{accessKeySecret},#{region},#{bucketName},#{roleArn})
+        (#{storeNodeId},#{domain},#{referer},#{secretKey},#{createBy})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
         insert into file_user_node
-        (`oss_type`,`endpoint`,`access_key_id`,`access_key_secret`,`region`,`bucket_name`,`role_arn`)
+        (`store_node_id`,`domain`,`referer`,`secret_key`,`create_by`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.ossType},#{item.endpoint},#{item.accessKeyId},#{item.accessKeySecret},#{item.region},#{item.bucketName},#{item.roleArn})
+            (#{item.storeNodeId},#{item.domain},#{item.referer},#{item.secretKey},#{item.createBy})
         </foreach>
     </insert>
 
@@ -25,7 +25,7 @@
     <select id="findByCreateByAndStoreNodeId" resultType="cn.reghao.tnb.file.app.model.po.UserNode">
         select *
         from file_user_node
-        where create_by=#{create_by} and store_node_id=#{storeNodeId}
+        where create_by=#{createBy} and store_node_id=#{storeNodeId}
     </select>
     <select id="findByCreateBy" resultType="cn.reghao.tnb.file.app.model.po.UserNode">
         select *

+ 0 - 13
user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/AdminUserController.java

@@ -4,7 +4,6 @@ import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.jutil.web.WebResult;
 import cn.reghao.tnb.account.api.dto.AccountRegistry;
 import cn.reghao.tnb.account.api.dto.AccountRegistryStatus;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 import cn.reghao.tnb.account.api.iface.AdminAccountService;
 import cn.reghao.tnb.user.api.dto.UserInfo;
 import cn.reghao.tnb.user.api.dto.VipPlanInfo;
@@ -63,18 +62,6 @@ public class AdminUserController {
         return WebResult.success(pageList);
     }
 
-    @Operation(summary = "创建用户帐号", description = "N")
-    @PostMapping(value = "/create", produces = MediaType.APPLICATION_JSON_VALUE)
-    @ResponseBody
-    public String createAccount(@Validated AdminCreateAccount adminCreateAccount) {
-        try {
-            adminUserService.createAccount(adminCreateAccount);
-            return WebResult.success();
-        } catch (Exception e) {
-            return WebResult.failWithMsg(e.getMessage());
-        }
-    }
-
     @Operation(summary = "充值请求列表页面", description = "N")
     @GetMapping(value = "/charge", produces = MediaType.APPLICATION_JSON_VALUE)
     public String chargeReq(@RequestParam("pn") int pageNumber) {

+ 0 - 5
user/user-service/src/main/java/cn/reghao/tnb/user/app/service/AdminUserService.java

@@ -4,7 +4,6 @@ import cn.reghao.jutil.jdk.db.PageList;
 import cn.reghao.jutil.jdk.thread.ThreadPoolWrapper;
 import cn.reghao.tnb.account.api.dto.AccountInfo;
 import cn.reghao.tnb.account.api.dto.AccountRegistry;
-import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
 import cn.reghao.tnb.account.api.dto.CrawledUser;
 import cn.reghao.tnb.account.api.iface.AccountQuery;
 import cn.reghao.tnb.account.api.iface.AdminAccountService;
@@ -131,10 +130,6 @@ public class AdminUserService {
         return userId;
     }
 
-    public void createAccount(AdminCreateAccount adminCreateAccount) {
-        adminAccountService.createAccount(adminCreateAccount);
-    }
-
     public List<WalletChargeDto> getChargeReqs() {
         return userWalletService.getChargeReqs();
     }