You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.4 KiB
38 lines
1.4 KiB
2 years ago
|
using COSSTS;
|
||
|
using Newtonsoft.Json;
|
||
|
using Znyc.CloudCar.Configuration;
|
||
|
using Znyc.CloudCar.IServices.Document;
|
||
|
using Znyc.CloudCar.Model.Dtos.Document;
|
||
|
using Znyc.CloudCar.Model.ViewModels.ReportsCallBack;
|
||
|
|
||
|
namespace Znyc.CloudCar.Services.Document
|
||
|
{
|
||
|
public class DocumentService : IDocumentService
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 上传图片
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public ResponseOutput UploadImageAsync()
|
||
|
{
|
||
|
Dictionary<string, object> values = new()
|
||
|
{
|
||
|
["bucket"] = AppSettingsConstVars.CosConfigBucket,
|
||
|
["region"] = AppSettingsConstVars.CosConfigRegion,
|
||
|
["allowPrefix"] = AppSettingsConstVars.CosConfigAllowPrefix,
|
||
|
["allowActions"] = AppSettingsConstVars.CosConfigAllowActions,
|
||
|
["durationSeconds"] = AppSettingsConstVars.CosConfigDurationSeconds,
|
||
|
["secretId"] = AppSettingsConstVars.CosConfigSecretId,
|
||
|
["secretKey"] = AppSettingsConstVars.CosConfigSecretKey
|
||
|
};
|
||
|
Dictionary<string, object> credential = STSClient.genCredential(values);
|
||
|
return new ResponseOutput()
|
||
|
{
|
||
|
Data = JsonConvert.DeserializeObject<ImageOutput>(JsonConvert.SerializeObject(credential)),
|
||
|
Successed = true,
|
||
|
Code = 1
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|