Commit 93ce28f5 authored by codezwjava's avatar codezwjava

专属客服上传客服二维码图片

parent 2b954f4f
......@@ -47,8 +47,8 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Override
public R uploadImage(MultipartFile file, HttpServletRequest request, String wechatId) throws IOException {
// String basePath = request.getScheme() + "://" + request.getServerName()
// + ":" + request.getServerPort()+"/mimi/upload/images/";
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/upload/video/";
Long time = System.currentTimeMillis();
......@@ -56,23 +56,22 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
String suffixName = originalFilename.substring(originalFilename.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名
String newName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面
// String rootPath="G:/mimi/"+ File.separator+"upload/images/"; //上传图片存放位置
String filePath = uploadQRImagesLocation + newName;
String rootPath="/opt/upload/video/"; //上传图片存放位置
String filePath = rootPath + newName;
File newFile = new File(filePath);
//判断目标文件所在目录是否存在
if(!newFile.getParentFile().exists()){
//如果目标文件所在的目录不存在,则创建父目录
newFile.getParentFile().mkdirs();
}
//将内存中的数据写入磁盘
file.transferTo(newFile);
//图片上传保存url
// String imgUrl = basePath + newzxName;
// 图片上传保存url
String videoUrl = basePath + newName;
CustomerService customerService = new CustomerService();
customerService.setWechatId(wechatId);
customerService.setWechatImgUrl(filePath);
customerService.setWechatImgUrl(videoUrl);
customerServiceMapper.insert(customerService);
return R.ok("上传成功");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment