发表于: 2018-01-02 23:19:11
1 467
今天完成的事情:
1.完成文学部后台全部接口
2.完成上传接口
接口:
上传工具类方法:
public static String upLoad(InputStream inputStream,String module,String fileType) {
try {
//获取随机字符串文件名
String fileName = DataUtils.getSimpleUUID();
String endpoint = "oss-cn-shenzhen.aliyuncs.com";
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
/*InputStream inputStream = new FileInputStream(filePath);*/
ossClient.putObject(bucketName,module+"/"+fileName+fileType, inputStream/*new File(filePath)*/);
inputStream.close();
ossClient.shutdown();
//拼接返回url
return String.format("%s/%s/%s", "http://img2.summerwaves.cn", module, fileName + fileType);
} catch (OSSException oe) {
log.error("Caught an upLoad OSSException," + "the error code is " + oe.getErrorCode() + "," + "reason is " + oe.getMessage());
}catch (IOException e) {
log.error("File upload problem,throw a IOException");
}
return null;
}
测试:
效果:
明天计划的事情:
完成用户模块后台接口、开始微信用户绑定接口的编写
遇到的问题:
无
收获:
复习了下第三方API的使用
进度:
视频模块、文章模块、签到模块均已完成,剩下比较复杂的用户模块
评论