基于微信小程序+JAVA+Vue+SpringBoot+MySQL的音乐平台,包含了音乐档案模块、音乐收藏模块、音乐订单模块,支持PC后台和微信小程序用户端使用,还包含系统自带的用户管理、部门管理、角色管理、菜单管理、日志管理、数据字典管理、文件管理、图表展示等基础模块,基于微信小程序的音乐平台基于角色的访问控制,给音乐管理员、音乐用户角色使用,可将权限精确到按钮级别,您可以自定义角色并分配权限,系统适合设计精确的权限约束需求。
随着当今世界网络和计算机的飞速发展以及智能手机的普及,人们的生活从过去的必须使用计算机进行工作、娱乐、信息获取转变为通过使用更加便利的移动设备去代替。小程序是一种全新的连接用户与服务的方式,它可以在微信内被便捷地获取和传播,同时具有出色的使用体验。在微信作为不可或缺的工具当下,微信小程序作为内置于微信内的功能平台,能够给绝大多数人带来对于他们自己而言更简易方便的使用感受及体验。
同时,在如今的时代背景下,音乐对于大多数人来说亦是不可或缺的元素。从商场、超市、餐厅等等舒缓的背景音乐包括现在可以说是如日中天的抖音也是结合了音乐与短视频,由此可见音乐的覆盖面,将音乐与微信小程序相结合,相信是一种有可能性的研究内容。
@RequestMapping(value = "/getOne", method = RequestMethod.GET)
@ApiOperation(value = "查询单首音乐")
public Result<Music> get(@RequestParam String id){
User currUser = securityUtil.getCurrUser();
Music music = iMusicService.getById(id);
if(music == null) {
return ResultUtil.error("音乐不存在");
}
// 收藏
QueryWrapper<MusicCollect> mc = new QueryWrapper<>();
mc.eq("music_id",music.getId());
mc.eq("user_id",currUser.getId());
music.setCollectFlag(iMusicCollectService.count(mc));
// 下单
QueryWrapper<MusicOrder> mo = new QueryWrapper<>();
mo.eq("music_id",music.getId());
mo.eq("user_id",currUser.getId());
music.setOrderFlag(iMusicOrderService.count(mo));
return new ResultUtil<Music>().setData(music);
}
@RequestMapping(value = "/insert", method = RequestMethod.POST)
@ApiOperation(value = "新增音乐")
public Result<Music> insert(Music music){
iMusicService.saveOrUpdate(music);
return new ResultUtil<Music>().setData(music);
}
@RequestMapping(value = "/addOne", method = RequestMethod.GET)
@ApiOperation(value = "新增单条音乐订单")
public Result<MusicOrder> addOne(@RequestParam String id){
Music music = iMusicService.getById(id);
if(music == null) {
return ResultUtil.error("音乐不存在");
}
User currUser = securityUtil.getCurrUser();
QueryWrapper<MusicOrder> moQw = new QueryWrapper<>();
moQw.eq("music_id",music.getId());
moQw.eq("user_id",currUser.getId());
if(iMusicOrderService.count(moQw) < 1L) {
MusicOrder mo = new MusicOrder();
mo.setMusicId(music.getId());
mo.setTitle(music.getTitle());
mo.setOwner(music.getOwner());
mo.setFileUrl(music.getFileUrl());
mo.setPrice(music.getPrice());
mo.setStatus("未付款");
mo.setUserId(currUser.getId());
mo.setUserName(currUser.getNickname());
iMusicOrderService.saveOrUpdate(mo);
}
return ResultUtil.success();
}
@RequestMapping(value = "/getByPage", method = RequestMethod.GET)
@ApiOperation(value = "查询音乐订单")
public Result<IPage<MusicOrder>> getByPage(@ModelAttribute MusicOrder musicOrder ,@ModelAttribute PageVo page){
QueryWrapper<MusicOrder> qw = new QueryWrapper<>();
User currUser = securityUtil.getCurrUser();
QueryWrapper<User> userQw = new QueryWrapper<>();
userQw.eq("id",currUser.getId());
userQw.inSql("id","SELECT user_id FROM a_user_role WHERE del_flag = 0 AND role_id = '1536606659751841799'");
if(iUserService.count(userQw) < 1L) {
qw.eq("user_id",currUser.getId());
}
if(!ZwzNullUtils.isNull(musicOrder.getTitle())) {
qw.like("title",musicOrder.getTitle());
}
if(!ZwzNullUtils.isNull(musicOrder.getUserName())) {
qw.like("user_name",musicOrder.getUserName());
}
IPage<MusicOrder> data = iMusicOrderService.page(PageUtil.initMpPage(page),qw);
return new ResultUtil<IPage<MusicOrder>>().setData(data);
}
@RequestMapping(value = "/addOne", method = RequestMethod.GET)
@ApiOperation(value = "新增单条音乐收藏")
public Result<Object> addOne(@RequestParam String id){
Music music = iMusicService.getById(id);
if(music == null) {
return ResultUtil.error("音乐不存在");
}
User currUser = securityUtil.getCurrUser();
QueryWrapper<MusicCollect> mcQw = new QueryWrapper<>();
mcQw.eq("music_id",music.getId());
mcQw.eq("user_id",currUser.getId());
if(iMusicCollectService.count(mcQw) < 1L) {
MusicCollect mc = new MusicCollect();
mc.setMusicId(music.getId());
mc.setTitle(music.getTitle());
mc.setOwner(music.getOwner());
mc.setFileUrl(music.getFileUrl());
mc.setUserId(currUser.getId());
mc.setUserName(currUser.getNickname());
iMusicCollectService.saveOrUpdate(mc);
}
return ResultUtil.success();
}