From b01f752252eaadd1fa31eda6a9ad43146660b721 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 03 四月 2025 23:42:57 +0800
Subject: [PATCH] bug修改

---
 xinquan-modules/xinquan-meditation/src/main/java/com/xinquan/meditation/controller/client/ClientHomeController.java |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/xinquan-modules/xinquan-meditation/src/main/java/com/xinquan/meditation/controller/client/ClientHomeController.java b/xinquan-modules/xinquan-meditation/src/main/java/com/xinquan/meditation/controller/client/ClientHomeController.java
index 620bd94..319a57c 100644
--- a/xinquan-modules/xinquan-meditation/src/main/java/com/xinquan/meditation/controller/client/ClientHomeController.java
+++ b/xinquan-modules/xinquan-meditation/src/main/java/com/xinquan/meditation/controller/client/ClientHomeController.java
@@ -12,6 +12,7 @@
 import com.xinquan.common.security.service.TokenService;
 import com.xinquan.meditation.domain.HomeBackgroundMusic;
 import com.xinquan.meditation.domain.HomeBackgroundMusicUser;
+import com.xinquan.meditation.domain.MeditationMusic;
 import com.xinquan.meditation.domain.vo.ClientHomeBackgroundMusicVO;
 import com.xinquan.meditation.domain.vo.ClientMeditationAndCateVO;
 import com.xinquan.meditation.domain.vo.ClientMeditationCategoryVO;
@@ -57,6 +58,8 @@
     private final MeditationService meditationService;
     private final MeditationCategoryService meditationCategoryService;
     private final MeditationEverydayService meditationEverydayService;
+
+
     @Resource
     private  RemoteHotWordsService remoteHotWordsService;
     private final MeditationQuestionService meditationQuestionService;
@@ -64,6 +67,19 @@
     private HomeBackgroundMusicUserService homeBackgroundMusicUserService;
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private MeditationMusicService meditationMusicService;
+    @PostMapping("/testObs")
+    @ApiOperation(value = "OBS", tags = "OBS")
+    public R testObs() {
+        List<MeditationMusic> list = meditationMusicService.list();
+        for (MeditationMusic meditationMusic : list) {
+            String replace = meditationMusic.getMusicUrl().replace("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com", "http://obs.xq.xqzhihui.com");
+            meditationMusic.setMusicUrl(replace);
+        }
+        meditationMusicService.updateBatchById(list);
+        return R.ok();
+    }
     // 新增需求 用户注册默认给一个背景音频设置
     @GetMapping("/addHomeBackgroundMusicDefault/{id}")
     public R addHomeBackgroundMusicDefault(@PathVariable("id") Long id) {
@@ -167,18 +183,38 @@
     public R<ClientHomeBackgroundMusicVO> getHomeBackgroundMusicByUserId() {
         if (tokenService.getLoginUser()==null){
             // 游客登录模式 不要返回登录失效 返回空即可
-            return R.ok(new ClientHomeBackgroundMusicVO());
+            List<HomeBackgroundMusic> list = homeBackgroundMusicService.list();
+            if (list.isEmpty()){
+                return R.ok(new ClientHomeBackgroundMusicVO());
+            }
+            ClientHomeBackgroundMusicVO clientHomeBackgroundMusicVO = new ClientHomeBackgroundMusicVO();
+            BeanUtils.copyProperties(list.get(0), clientHomeBackgroundMusicVO);
+            return R.ok(clientHomeBackgroundMusicVO);
         }
         HomeBackgroundMusicUser homeBackgroundMusicUser = homeBackgroundMusicUserService.lambdaQuery()
                 .eq(HomeBackgroundMusicUser::getAppUserId, tokenService.getLoginUser().getAppUserId())
                 .one();
         if (homeBackgroundMusicUser==null){
-            return R.ok(new ClientHomeBackgroundMusicVO());
+            List<HomeBackgroundMusic> list = homeBackgroundMusicService.list();
+            if (list.isEmpty()){
+                return R.ok(new ClientHomeBackgroundMusicVO());
+            }
+            ClientHomeBackgroundMusicVO clientHomeBackgroundMusicVO = new ClientHomeBackgroundMusicVO();
+            BeanUtils.copyProperties(list.get(0), clientHomeBackgroundMusicVO);
+            return R.ok(clientHomeBackgroundMusicVO);
         }
         HomeBackgroundMusic homeBackgroundMusic = homeBackgroundMusicService.lambdaQuery()
                 .eq(HomeBackgroundMusic::getId, homeBackgroundMusicUser.getHomeBackgroundMusicId())
                 .one();
-        if (homeBackgroundMusic==null)return R.ok(new ClientHomeBackgroundMusicVO());
+        if (homeBackgroundMusic==null){
+            List<HomeBackgroundMusic> list = homeBackgroundMusicService.list();
+            if (list.isEmpty()){
+                return R.ok(new ClientHomeBackgroundMusicVO());
+            }
+            ClientHomeBackgroundMusicVO clientHomeBackgroundMusicVO = new ClientHomeBackgroundMusicVO();
+            BeanUtils.copyProperties(list.get(0), clientHomeBackgroundMusicVO);
+            return R.ok(clientHomeBackgroundMusicVO);
+        }
         ClientHomeBackgroundMusicVO clientHomeBackgroundMusicVO = new ClientHomeBackgroundMusicVO();
         BeanUtils.copyProperties(homeBackgroundMusic, clientHomeBackgroundMusicVO);
         return R.ok(clientHomeBackgroundMusicVO);

--
Gitblit v1.7.1