|  | @@ -1,5 +1,6 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.teacher.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiParam;
 | 
	
	
		
			
				|  | @@ -12,10 +13,12 @@ import javax.validation.Valid;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.PathVariable;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestBody;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
	
		
			
				|  | @@ -105,7 +108,7 @@ public class MusicAlbumController extends BaseController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          query.setType(2);
 | 
	
		
			
				|  |  |          query.setState(YesOrNoEnum.YES);
 | 
	
		
			
				|  |  | -        YesOrNoEnum yesOrNoEnum = musicAlbumService.checkFavorite(sysUser.getId(),query.getId() );
 | 
	
		
			
				|  |  | +        YesOrNoEnum yesOrNoEnum = musicAlbumService.checkFavorite(sysUser.getId(),query.getId(), ClientEnum.TEACHER);
 | 
	
		
			
				|  |  |          AlbumDetailVo albumDetailVo = musicAlbumService.detail(PageUtil.getPage(query), query);
 | 
	
		
			
				|  |  |          albumDetailVo.setFavorite(yesOrNoEnum);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -133,22 +136,27 @@ public class MusicAlbumController extends BaseController {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 专辑收藏
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    // @PostMapping("/favorite/{id}")
 | 
	
		
			
				|  |  | +     @PostMapping("/favorite/{id}")
 | 
	
		
			
				|  |  |      @ApiOperation(value = "专辑收藏/取消收藏")
 | 
	
		
			
				|  |  | -    public HttpResponseResult<Boolean> favorite(@ApiParam(value = "专辑编号", required = true) @PathVariable("id") Long id) {
 | 
	
		
			
				|  |  | +    public HttpResponseResult<Boolean> favorite(@ApiParam(value = "专辑编号", required = true) @PathVariable("id") Long id,
 | 
	
		
			
				|  |  | +                                                @ApiParam(value = "客户端类型") @RequestParam(value = "clientType", required = false, defaultValue = "TEACHER") String clientType) {
 | 
	
		
			
				|  |  |          SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  |          if (sysUser == null  || sysUser.getId() == null) {
 | 
	
		
			
				|  |  |              return failed("用户信息获取失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return succeed(musicAlbumService.setFavorite(sysUser.getId(),id));
 | 
	
		
			
				|  |  | +         if (ClientEnum.invalid(clientType)) {
 | 
	
		
			
				|  |  | +             return failed("无效的客户端类型");
 | 
	
		
			
				|  |  | +         }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return succeed(musicAlbumService.setFavorite(sysUser.getId(), id, ClientEnum.valueOf(clientType)));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 专辑收藏
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    // @GetMapping("/favorite")
 | 
	
		
			
				|  |  | +    @GetMapping("/favorite")
 | 
	
		
			
				|  |  |      @ApiOperation(value = "收藏专辑列表")
 | 
	
		
			
				|  |  |      public HttpResponseResult<PageInfo<MusicAlbumVo>> favoriteAlbum(QueryInfo query) {
 | 
	
		
			
				|  |  |          SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
	
		
			
				|  | @@ -158,7 +166,7 @@ public class MusicAlbumController extends BaseController {
 | 
	
		
			
				|  |  |          StudentMusicAlbumSearch search = new StudentMusicAlbumSearch();
 | 
	
		
			
				|  |  |          search.setStudentId(sysUser.getId());
 | 
	
		
			
				|  |  |          search.setAlbumStatus(YesOrNoEnum.YES);
 | 
	
		
			
				|  |  | -        IPage<MusicAlbumVo> albumVoIPage = musicAlbumService.favoriteAlbum(PageUtil.getPage(query), search);
 | 
	
		
			
				|  |  | +        IPage<MusicAlbumVo> albumVoIPage = musicAlbumService.favoriteAlbum(PageUtil.getPage(query), search, ClientEnum.TEACHER);
 | 
	
		
			
				|  |  |          return succeed(PageUtil.pageInfo(albumVoIPage));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |