| | |
| | | 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; |
| | |
| | | private final MeditationService meditationService; |
| | | private final MeditationCategoryService meditationCategoryService; |
| | | private final MeditationEverydayService meditationEverydayService; |
| | | |
| | | |
| | | @Resource |
| | | private RemoteHotWordsService remoteHotWordsService; |
| | | private final MeditationQuestionService meditationQuestionService; |
| | |
| | | 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) { |
| | |
| | | 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); |