v1.16 软件增加server地址

This commit is contained in:
2026-11-27 21:13:53 +08:00
parent 8139870825
commit 376c688b3e
9 changed files with 24 additions and 17 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.rnb</groupId> <groupId>com.rnb</groupId>
<artifactId>rnb</artifactId> <artifactId>rnb</artifactId>
<version>1.15</version> <version>1.16</version>
<description>基于 Java 17 + SpringBoot 3 + Spring Security 构建的后台管理系统。</description> <description>基于 Java 17 + SpringBoot 3 + Spring Security 构建的后台管理系统。</description>
<parent> <parent>
@@ -34,4 +34,5 @@ public interface SystemConstants {
// one-api 配置键(与 sys_config 表 configKey 字段对应) // one-api 配置键(与 sys_config 表 configKey 字段对应)
String ONE_API_URL = "ONE_API_URL"; String ONE_API_URL = "ONE_API_URL";
String ONE_API_TOKEN = "ONE_API_TOKEN"; String ONE_API_TOKEN = "ONE_API_TOKEN";
String ONE_API_MODEL = "ONE_API_MODEL";
} }
@@ -13,5 +13,6 @@ public class Software {
private Integer verLatest; private Integer verLatest;
private Integer verValid; private Integer verValid;
private String upgradePath; private String upgradePath;
private String server;
private Integer deprecated; private Integer deprecated;
} }
@@ -98,7 +98,10 @@ public class AccountService extends ServiceImpl<AccountMapper, Account> {
} }
if(saveOrUpdate(account)) { if(saveOrUpdate(account)) {
syncOneApiToken(account); // 令牌只在账户初次创建且尚未注册 one-api 时同步建,避免每次编辑都重复注册
if (account.getApiKey() == null || account.getApiKey().isEmpty()) {
syncOneApiToken(account);
}
return account.getId(); return account.getId();
} }
@@ -50,7 +50,11 @@ public class ApiService {
Software software = softwareService.getOne(swWrapper); Software software = softwareService.getOne(swWrapper);
if(software == null) return "err:101"; if(software == null) return "err:101";
return "flg:" + (software.getVerValid() > ver ? "0" : "1") + "|ver:" + software.getVerLatest(); String srv = software.getServer();
return "srv:" + (srv==null ? "" : srv)
+ "|flg:" + (software.getVerValid() > ver ? "0" : "1")
+ "|ver:" + software.getVerLatest();
} }
public String userLogin(String uname, String web, Integer sid, Integer ver, Long did) { public String userLogin(String uname, String web, Integer sid, Integer ver, Long did) {
@@ -1,17 +1,11 @@
package com.rnb.rnb.service; package com.rnb.rnb.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rnb.common.base.BasePageQuery; import com.rnb.common.base.BasePageQuery;
import com.rnb.rnb.mapper.SoftwareMapper;
import com.rnb.rnb.model.entity.Account;
import com.rnb.rnb.model.entity.Oplog;
import com.rnb.rnb.model.entity.Software; import com.rnb.rnb.model.entity.Software;
import com.rnb.rnb.model.query.OplogPageQuery;
import com.rnb.rnb.model.vo.AccountBaseVo;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -49,6 +49,9 @@ public class OneApiClient {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.set("name", name); body.set("name", name);
body.set("remain_quota", 1000000); body.set("remain_quota", 1000000);
// models 留空=分组内不限模型;配置值=建出即受限于该模型名(大小写敏感,与请求 model 一致才有效)
String model = (String) configService.getSystemConfig(SystemConstants.ONE_API_MODEL);
body.set("models", (model == null || model.isEmpty()) ? "" : model);
body.set("expired_time", -1); // 永不过期 body.set("expired_time", -1); // 永不过期
resp = HttpRequest.post(url) resp = HttpRequest.post(url)
+4 -4
View File
@@ -222,10 +222,10 @@ captcha:
expire-seconds: 120 expire-seconds: 120
# 微信小程配置 # 微信小程配置
#wx: wx:
# miniapp: miniapp:
# app-id: xxxxxx app-id: xxxxxx
# app-secret: xxxxxx app-secret: xxxxxx
# 日志级别 # 日志级别
logging: logging:
+5 -4
View File
@@ -218,10 +218,11 @@ captcha:
expire-seconds: 120 expire-seconds: 120
# 微信小程配置 # 微信小程配置
#wx: wx:
# miniapp: miniapp:
# app-id: xxxxxx app-id: xxxxxx
# app-secret: xxxxxx app-secret: xxxxxx
# 日志级别 # 日志级别
logging: logging:
level: level: