登陆放开
This commit is contained in:
@@ -44,36 +44,39 @@ public class FileController extends BaseController {
|
|||||||
// 获取文件字节
|
// 获取文件字节
|
||||||
if (objectName.equals("musicFile")) {
|
if (objectName.equals("musicFile")) {
|
||||||
LoginUser userInfo = SecurityUtils.getLoginUser();
|
LoginUser userInfo = SecurityUtils.getLoginUser();
|
||||||
if (userInfo == null){
|
// if (userInfo == null){
|
||||||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||||
response.setContentType("application/json;charset=UTF-8");
|
// response.setContentType("application/json;charset=UTF-8");
|
||||||
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
SysUser sysUser = userInfo.getUser();
|
// SysUser sysUser = userInfo.getUser();
|
||||||
if (sysUser == null) {
|
//if (sysUser == null) {
|
||||||
// if (StrUtil.isBlank(musicId)) {
|
// if (StrUtil.isBlank(musicId)) {
|
||||||
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||||
// response.setContentType("application/json;charset=UTF-8");
|
// response.setContentType("application/json;charset=UTF-8");
|
||||||
// response.getWriter().write("{\"code\":400,\"msg\":\"音乐ID不能为空\"}");
|
// response.getWriter().write("{\"code\":400,\"msg\":\"音乐ID不能为空\"}");
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
ShopUser shopUser = userInfo.getShopUser();
|
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||||
if (shopUser == null) {
|
|
||||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
|
||||||
response.setContentType("application/json;charset=UTF-8");
|
//ShopUser shopUser = userInfo.getShopUser();
|
||||||
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
// if (shopUser == null) {
|
||||||
return;
|
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
}else{
|
// response.setContentType("application/json;charset=UTF-8");
|
||||||
// 检查会员时间
|
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||||
if (!MusicUtil.getShopIsVip(shopUser)) {
|
// return;
|
||||||
if (shopUser.getVip() == 1){
|
// }else{
|
||||||
// 会员已过期修改为非会员
|
// // 检查会员时间
|
||||||
shopUser.setVip(2L);
|
// if (!MusicUtil.getShopIsVip(shopUser)) {
|
||||||
shopUserMapper.updateShopUser(shopUser);
|
// if (shopUser.getVip() == 1){
|
||||||
}
|
// // 会员已过期修改为非会员
|
||||||
}
|
// shopUser.setVip(2L);
|
||||||
}
|
// shopUserMapper.updateShopUser(shopUser);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//shopUser = shopUserMapper.selectShopUserByUserId(userId);
|
//shopUser = shopUserMapper.selectShopUserByUserId(userId);
|
||||||
// MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
// MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||||
//
|
//
|
||||||
@@ -93,7 +96,7 @@ public class FileController extends BaseController {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置响应头
|
// 设置响应头
|
||||||
|
|||||||
@@ -114,9 +114,7 @@ public class MusicController extends BaseController {
|
|||||||
@RequestMapping("/getMusicInfo/{musicId}")
|
@RequestMapping("/getMusicInfo/{musicId}")
|
||||||
public AjaxResult getMusicInfo(@PathVariable String musicId){
|
public AjaxResult getMusicInfo(@PathVariable String musicId){
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
if (userId == null){
|
if (userId != null){
|
||||||
return AjaxResult.error(401,"用户未登录或用户ID为空");
|
|
||||||
}
|
|
||||||
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
|
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
|
||||||
if (musicInfo != null){
|
if (musicInfo != null){
|
||||||
// 增加历史
|
// 增加历史
|
||||||
@@ -125,6 +123,11 @@ public class MusicController extends BaseController {
|
|||||||
}else {
|
}else {
|
||||||
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
|
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
MusicInfo musicInfo = musicService.getMusicInfo(null, musicId);
|
||||||
|
return AjaxResult.success(musicInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增用户混音
|
// 新增用户混音
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ public class SecurityConfig
|
|||||||
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music",
|
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music",
|
||||||
"/client/version/getLastVersion","/client/search/list","/client/music/find","/client" +
|
"/client/version/getLastVersion","/client/search/list","/client/music/find","/client" +
|
||||||
"/index/getCategory","/client/index/cate/music/**","/client/consult/list",
|
"/index/getCategory","/client/index/cate/music/**","/client/consult/list",
|
||||||
"/client/index/re/music/**","/client/share/list").permitAll()
|
"/client/index/re/music/**","/client/share/list","/file/download/**",
|
||||||
|
"/client/music/getMusicInfo/**","/client/music/getPrevMusicId","/client/music/getNextMusicId").permitAll()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ import java.util.stream.Collectors;
|
|||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MusicInfoServiceImpl implements IMusicInfoService
|
public class MusicInfoServiceImpl implements IMusicInfoService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MusicInfoMapper musicInfoMapper;
|
private MusicInfoMapper musicInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -38,8 +37,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopUserMapper shopUserMapper;
|
private ShopUserMapper shopUserMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询音乐信息
|
* 查询音乐信息
|
||||||
*
|
*
|
||||||
@@ -47,8 +44,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 音乐信息
|
* @return 音乐信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MusicInfo selectMusicInfoById(String id)
|
public MusicInfo selectMusicInfoById(String id) {
|
||||||
{
|
|
||||||
return musicInfoMapper.selectMusicInfoById(id);
|
return musicInfoMapper.selectMusicInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +55,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 音乐信息
|
* @return 音乐信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo)
|
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo) {
|
||||||
{
|
|
||||||
return musicInfoMapper.selectMusicInfoList(musicInfo);
|
return musicInfoMapper.selectMusicInfoList(musicInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +66,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertMusicInfo(MusicInfo musicInfo)
|
public int insertMusicInfo(MusicInfo musicInfo) {
|
||||||
{
|
|
||||||
|
|
||||||
musicInfo.setCreateTime(DateUtils.getNowDate());
|
musicInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
musicInfo.setMusicId(IdUtil.getSnowflakeNextId());
|
musicInfo.setMusicId(IdUtil.getSnowflakeNextId());
|
||||||
@@ -89,8 +83,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateMusicInfo(MusicInfo musicInfo)
|
public int updateMusicInfo(MusicInfo musicInfo) {
|
||||||
{
|
|
||||||
musicInfo.setUpdateTime(DateUtils.getNowDate());
|
musicInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
return musicInfoMapper.updateMusicInfo(musicInfo);
|
return musicInfoMapper.updateMusicInfo(musicInfo);
|
||||||
}
|
}
|
||||||
@@ -102,8 +95,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteMusicInfoByIds(String[] ids)
|
public int deleteMusicInfoByIds(String[] ids) {
|
||||||
{
|
|
||||||
return musicInfoMapper.deleteMusicInfoByIds(ids);
|
return musicInfoMapper.deleteMusicInfoByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,8 +106,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteMusicInfoById(String id)
|
public int deleteMusicInfoById(String id) {
|
||||||
{
|
|
||||||
return musicInfoMapper.deleteMusicInfoById(id);
|
return musicInfoMapper.deleteMusicInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +171,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if (userId != null) {
|
||||||
// 查询是否是用户喜欢
|
// 查询是否是用户喜欢
|
||||||
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
|
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
|
||||||
if (userLikeMusic != null) {
|
if (userLikeMusic != null) {
|
||||||
@@ -192,6 +183,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
musicInfo.setCollect(true);
|
musicInfo.setCollect(true);
|
||||||
musicInfo.setUserCollect(userCollect);
|
musicInfo.setUserCollect(userCollect);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 判断是否是是混音
|
// 判断是否是是混音
|
||||||
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
|
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
|
||||||
// 查询混音相关信息
|
// 查询混音相关信息
|
||||||
@@ -284,7 +276,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
public String getPrevMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
public String getPrevMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
||||||
List<MusicInfo> musicList = null;
|
List<MusicInfo> musicList = null;
|
||||||
|
|
||||||
// 根据播放列表类型获取对应的音乐列表
|
if (userId != null) {
|
||||||
switch (playlistType) {
|
switch (playlistType) {
|
||||||
case 1: // 历史播放
|
case 1: // 历史播放
|
||||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||||
@@ -315,13 +307,16 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||||
|
}
|
||||||
|
// 根据播放列表类型获取对应的音乐列表
|
||||||
|
|
||||||
// 如果列表为空,返回null
|
// 如果列表为空,返回null
|
||||||
if (musicList == null || musicList.isEmpty()) {
|
if (musicList == null || musicList.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 根据播放模式获取上一首音乐ID
|
// 根据播放模式获取上一首音乐ID
|
||||||
if (playMode == 1) { // 顺序播放
|
if (playMode == 1) { // 顺序播放
|
||||||
// 按照ID排序列表
|
// 按照ID排序列表
|
||||||
@@ -331,8 +326,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
return idA.compareTo(idB);
|
return idA.compareTo(idB);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 如果没有当前音乐ID,返回列表中的最后一首
|
// 如果没有当前音乐ID,返回列表中的最后一首
|
||||||
if (currentMusicId == null || currentMusicId.isEmpty()) {
|
if (currentMusicId == null || currentMusicId.isEmpty()) {
|
||||||
return musicList.get(musicList.size() - 1).getMusicId().toString();
|
return musicList.get(musicList.size() - 1).getMusicId().toString();
|
||||||
@@ -381,6 +374,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
||||||
List<MusicInfo> musicList = null;
|
List<MusicInfo> musicList = null;
|
||||||
|
|
||||||
|
if (userId != null) {
|
||||||
// 根据播放列表类型获取对应的音乐列表
|
// 根据播放列表类型获取对应的音乐列表
|
||||||
switch (playlistType) {
|
switch (playlistType) {
|
||||||
case 1: // 历史播放
|
case 1: // 历史播放
|
||||||
@@ -412,6 +406,9 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||||
|
}
|
||||||
|
|
||||||
// 如果列表为空,返回null
|
// 如果列表为空,返回null
|
||||||
if (musicList == null || musicList.isEmpty()) {
|
if (musicList == null || musicList.isEmpty()) {
|
||||||
@@ -468,7 +465,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询喜欢的音乐数量
|
* 根据用户ID查询喜欢的音乐数量
|
||||||
*
|
*
|
||||||
@@ -500,7 +496,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
|||||||
@Override
|
@Override
|
||||||
public List<MusicInfo> findLikeSearch(String search) {
|
public List<MusicInfo> findLikeSearch(String search) {
|
||||||
|
|
||||||
|
|
||||||
// 根据作者名称或音乐名称模糊搜索音乐
|
// 根据作者名称或音乐名称模糊搜索音乐
|
||||||
List<MusicInfo> musicList = musicInfoMapper.selectMusicInfoBySearch(search);
|
List<MusicInfo> musicList = musicInfoMapper.selectMusicInfoBySearch(search);
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||||||
orderInfo.setOrderName(request.getOrderName());
|
orderInfo.setOrderName(request.getOrderName());
|
||||||
orderInfo.setUserId(loginUser.getUserId());
|
orderInfo.setUserId(loginUser.getUserId());
|
||||||
Product product = productMapper.selectProductByPageType(request.getPackageType());
|
Product product = productMapper.selectProductByPageType(request.getPackageType());
|
||||||
orderInfo.setAmount(new BigDecimal("0.01"));
|
|
||||||
|
orderInfo.setAmount(product.getCurrentPrice());
|
||||||
orderInfo.setPayType(request.getPayType());
|
orderInfo.setPayType(request.getPayType());
|
||||||
orderInfo.setPackageType(request.getPackageType());
|
orderInfo.setPackageType(request.getPackageType());
|
||||||
orderInfo.setDeviceType(request.getDeviceType());
|
orderInfo.setDeviceType(request.getDeviceType());
|
||||||
|
|||||||
Reference in New Issue
Block a user