feat(splash): 添加全局开屏图片功能并优化客户端启动流程
- 新增全局开屏图片上传、获取、删除接口 - 实现客户端全局开屏图片优先加载机制 - 集成七牛云存储配置从 pxdj 切换到 bydj - 优化 splash 窗口显示逻辑确保至少显示 2 秒 - 添加全局开屏图片管理界面组件 - 更新应用配置和构建设置 - 修复多处图片缓存和加载问题 - 调整服务端 API 地址配置 - 修改微信客服联系方式
This commit is contained in:
@@ -74,6 +74,8 @@ public class ClientAccountController extends BaseController {
|
||||
|
||||
private static final String SPLASH_IMAGE_CACHE_KEY = "splash_image:";
|
||||
private static final String BRAND_LOGO_CACHE_KEY = "brand_logo:";
|
||||
private static final String GLOBAL_SPLASH_IMAGE_KEY = "global_splash_image";
|
||||
private static final String GLOBAL_BRAND_LOGO_KEY = "global_brand_logo";
|
||||
|
||||
private AjaxResult checkDeviceLimit(Long accountId, String deviceId, int deviceLimit) {
|
||||
int activeDeviceCount = accountDeviceMapper.countActiveDevicesByAccountId(accountId);
|
||||
@@ -474,4 +476,53 @@ public class ClientAccountController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传全局开屏图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:upload')")
|
||||
@PostMapping("/global-splash-image/upload")
|
||||
public AjaxResult uploadGlobalSplashImage(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
if (!file.getContentType().startsWith("image/")) return AjaxResult.error("只支持图片文件");
|
||||
if (file.getSize() > 5 * 1024 * 1024) return AjaxResult.error("图片大小不能超过5MB");
|
||||
|
||||
String fileName = "splash/global/" + DateUtil.format(new Date(), "yyyy/MM/") + IdUtil.simpleUUID() + "." + FileUtil.extName(file.getOriginalFilename());
|
||||
try (InputStream is = file.getInputStream()) {
|
||||
Response res = uploadManager.put(is, fileName, auth.uploadToken(qiniu.getBucket()), null, "");
|
||||
if (!res.isOK()) return AjaxResult.error("上传失败");
|
||||
}
|
||||
|
||||
String url = qiniu.getResourcesUrl() + fileName;
|
||||
redisCache.setCacheObject(GLOBAL_SPLASH_IMAGE_KEY, url);
|
||||
return AjaxResult.success().put("url", url).put("fileName", fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("上传失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局开屏图片
|
||||
*/
|
||||
@GetMapping("/global-splash-image")
|
||||
public AjaxResult getGlobalSplashImage() {
|
||||
String url = redisCache.getCacheObject(GLOBAL_SPLASH_IMAGE_KEY);
|
||||
return AjaxResult.success(Map.of("url", url != null ? url : ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除全局开屏图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:upload')")
|
||||
@PostMapping("/global-splash-image/delete")
|
||||
public AjaxResult deleteGlobalSplashImage() {
|
||||
try {
|
||||
redisCache.deleteObject(GLOBAL_SPLASH_IMAGE_KEY);
|
||||
return AjaxResult.success("全局开屏图片已删除");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,9 +18,9 @@ qiniu:
|
||||
accessKey: M1I8ItQjEYOYXyJYieloSSaIG8Ppi4lfCAyZ8BaF
|
||||
secretKey: Xvi0SwtL9WVOl28h6DNRLKP9MnZZqsKBWrC8shAl
|
||||
# 七牛空间名
|
||||
bucket: pxdj-prod
|
||||
bucket: bydj-prod
|
||||
# 资源地址
|
||||
resourcesUrl: https://qiniu.pxdj.tashowz.com/
|
||||
resourcesUrl: https://qiniu.bydj.tashowz.com/
|
||||
# 七牛云机房
|
||||
zone: HUA_NAN
|
||||
|
||||
|
||||
Reference in New Issue
Block a user