Commit 3a65bab0 by 水库浪子

修改素材发送BUG

1 parent a71d1850
...@@ -35,7 +35,12 @@ public class WeChatCollectionController extends BaseController { ...@@ -35,7 +35,12 @@ public class WeChatCollectionController extends BaseController {
@Log(title = "添加收藏", businessType = BusinessType.INSERT) @Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PostMapping("addCollection") @PostMapping("addCollection")
public AjaxResult addCollection(@RequestBody WeChatCollectionDto chatCollectionDto) { public AjaxResult addCollection(@RequestBody WeChatCollectionDto chatCollectionDto) {
return toAjax(weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId())); boolean b =
weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId());
if(weChatCollectionService.addCollection(chatCollectionDto.getMaterialId(), chatCollectionDto.getUserId())){
return AjaxResult.success();
}
return AjaxResult.success("当前素材不可重复收藏");
} }
......
...@@ -52,12 +52,12 @@ public class WeMaterialController extends BaseController { ...@@ -52,12 +52,12 @@ public class WeMaterialController extends BaseController {
List<WeMaterial> list; List<WeMaterial> list;
if(StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())){ if(StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())){
list = wePosterService.list(StringUtils.isBlank(categoryId)?null:Long.valueOf(categoryId),search).stream().map(wePoster -> { list = wePosterService.list(StringUtils.isBlank(categoryId)?null:Long.valueOf(categoryId),search).stream().map(wePoster -> {
WeMaterial weMaterial = new WeMaterial(); WeMaterial weMaterial = new WeMaterial();
weMaterial.setMaterialName(wePoster.getTitle()); weMaterial.setMaterialName(wePoster.getTitle());
weMaterial.setMaterialUrl(wePoster.getSampleImgPath()); weMaterial.setMaterialUrl(wePoster.getSampleImgPath());
weMaterial.setCategoryId(wePoster.getCategoryId()); weMaterial.setCategoryId(wePoster.getCategoryId());
weMaterial.setId(wePoster.getId()); weMaterial.setId(wePoster.getId());
return weMaterial; return weMaterial;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
}else { }else {
list = materialService.findWeMaterials(categoryId, search,mediaType); list = materialService.findWeMaterials(categoryId, search,mediaType);
...@@ -122,19 +122,29 @@ public class WeMaterialController extends BaseController { ...@@ -122,19 +122,29 @@ public class WeMaterialController extends BaseController {
return AjaxResult.success(); return AjaxResult.success();
} }
// //@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
// @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
// @PostMapping("/temporaryMaterialMediaId")
// @ApiOperation("获取素材media_id")
// public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
// WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
// temporaryMaterialDto.getType()
// ,temporaryMaterialDto.getName());
// return AjaxResult.success(weMediaDto);
// }
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')") //@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER) @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@PostMapping("/temporaryMaterialMediaId") @GetMapping("/temporaryMaterialMediaId")
@ApiOperation("获取素材media_id") @ApiOperation("获取素材media_id")
public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){ public AjaxResult temporaryMaterialMediaId(String url,String type,String name){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(), WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url,
temporaryMaterialDto.getType() type
,temporaryMaterialDto.getName()); ,name);
return AjaxResult.success(weMediaDto); return AjaxResult.success(weMediaDto);
} }
@Log(title = "上传素材图片", businessType = BusinessType.OTHER) @Log(title = "上传素材图片", businessType = BusinessType.OTHER)
@PostMapping("/uploadimg") @PostMapping("/uploadimg")
@ApiOperation("上传素材图片") @ApiOperation("上传素材图片")
......
package com.linkwechat.framework.security.filter; package com.linkwechat.framework.security.filter;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -33,6 +34,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter ...@@ -33,6 +34,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
throws ServletException, IOException throws ServletException, IOException
{ {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
Enumeration<String> parameterNames = request.getParameterNames();
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
{ {
tokenService.verifyToken(loginUser); tokenService.verifyToken(loginUser);
......
...@@ -20,7 +20,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> { ...@@ -20,7 +20,7 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public int addCollection( Long materialId, String userId); public boolean addCollection( Long materialId, String userId);
/** /**
* 取消收藏 * 取消收藏
......
...@@ -27,18 +27,19 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap ...@@ -27,18 +27,19 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap
@Override @Override
public int addCollection(Long materialId, String userId) { public boolean addCollection(Long materialId, String userId) {
QueryWrapper<WeChatCollection> wrapper = new QueryWrapper<>(); QueryWrapper<WeChatCollection> wrapper = new QueryWrapper<>();
wrapper.eq("material_id",materialId).eq("user_id",userId); wrapper.eq("material_id",materialId).eq("user_id",userId);
WeChatCollection queryCollection = weChatCollectionMapper.selectOne(wrapper); WeChatCollection queryCollection = weChatCollectionMapper.selectOne(wrapper);
if(null!=queryCollection){ if(null!=queryCollection){
throw new CustomException("你已收藏"); return false;
} }
WeChatCollection chatCollection=new WeChatCollection(); WeChatCollection chatCollection=new WeChatCollection();
chatCollection.setCollectionId(SnowFlakeUtil.nextId()); chatCollection.setCollectionId(SnowFlakeUtil.nextId());
chatCollection.setMaterialId(materialId); chatCollection.setMaterialId(materialId);
chatCollection.setUserId(userId); chatCollection.setUserId(userId);
return weChatCollectionMapper.addCollection(chatCollection); weChatCollectionMapper.addCollection(chatCollection);
return true;
} }
@Override @Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!