完善c端接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.config;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
@@ -89,7 +90,7 @@ public class AliConfig {
|
||||
}
|
||||
|
||||
|
||||
public static String ossUp(String objectName, InputStream inputStream){
|
||||
public static String ossUp(String objectName,String fileName, InputStream inputStream){
|
||||
// 配置参数
|
||||
String endpoint = "https://oss-cn-beijing.aliyuncs.com";
|
||||
String accessKeyId = AliKeyConfig.ACCESS_KEY_ID;
|
||||
@@ -98,12 +99,13 @@ public class AliConfig {
|
||||
|
||||
// 创建OSSClient实例
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
String path = objectName + IdUtil.fastUUID() + suffix;
|
||||
try {
|
||||
// 上传字符串内容作为文件
|
||||
ossClient.putObject(bucketName, objectName, inputStream);
|
||||
ossClient.putObject(bucketName, path, inputStream);
|
||||
System.out.println("文件上传成功:" + objectName);
|
||||
return "/file/download/"+objectName;
|
||||
return "/file/download/"+path;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
@@ -25,10 +25,18 @@ import java.util.Map;
|
||||
@Component
|
||||
public class UmengConfig {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static CloseableHttpResponse send(String token){
|
||||
String umAppkey = "5df88f83570df3b8d40012337";
|
||||
String appKey = "LTAI5tDWWzwqxumUXTFnkQFd";
|
||||
String appSecret = "KOD3y6OxbHJ23wxAf68NFpUQXCQEPX";
|
||||
//687b2df479267e0210b79b6f
|
||||
String umAppkey = "687b2e1679267e0210b79b70";
|
||||
String appKey = "204918113";
|
||||
String appSecret = "v4UrIhhLZlo0adpmevyCfvThGFbrRer0";
|
||||
// 下面的url要和阿里云云市场购买的商品对应
|
||||
String url = "https://verify5.market.alicloudapi.com/api/v1/mobile/info?appkey=" + umAppkey;
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
Reference in New Issue
Block a user