提交 1aaed8f8 编写于 作者: 孙喜旺

素材图片上传接口返回添加图片名称

上级 83741955
......@@ -13,6 +13,7 @@ import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
import com.linkwechat.wecom.service.IWeMaterialService;
import com.linkwechat.wecom.service.IWePosterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
......@@ -31,6 +32,7 @@ import java.util.stream.Collectors;
* @author KEWEN
* @date 2020-10-08
*/
@Api("企业微信素材管理")
@RestController
@RequestMapping("/wecom/material")
public class WeMaterialController extends BaseController {
......@@ -149,7 +151,9 @@ public class WeMaterialController extends BaseController {
@PostMapping("/uploadimg")
@ApiOperation("上传素材图片")
public AjaxResult<WeMediaDto> uploadImg(MultipartFile file){
return AjaxResult.success(materialService.uploadImg(file));
WeMediaDto weMediaDto = materialService.uploadImg(file);
weMediaDto.setFileName(file.getResource().getFilename());
return AjaxResult.success(weMediaDto);
}
}
......@@ -131,10 +131,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
//微信授权接口
.antMatchers("/weixin/auth/**").anonymous()
//.antMatchers("/wecom/user/synchWeUser").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()
......
package com.linkwechat.wecom.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......@@ -7,6 +9,7 @@ import lombok.Data;
* @Description:
* @Date: create in 2020/9/24 0024 0:16
*/
@ApiModel
@Data
public class WeMediaDto extends WeResultDto{
/**媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file)*/
......@@ -16,5 +19,9 @@ public class WeMediaDto extends WeResultDto{
/**媒体文件上传时间戳*/
private Long created_at;
/**上传后得到的图片URL。永久有效*/
@ApiModelProperty("图片路径")
private String url;
@ApiModelProperty("图片名称")
private String fileName;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册