using Mall.ThirdCore.Oss;
using Microsoft.AspNetCore.Server.IISIntegration;
using System;
using System.Collections.Generic;
using System.Text;

namespace TestCore
{
    public class UploadHelper
    {

        /// <summary>
        /// 文件上传搭配腾讯
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static OssResult UploadFileToTencent(string filePath)
        {
            string Region = "ap-chengdu";
            string SecretId = "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd";
            string SecretKey = "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob";
            string Bucket = "viitto-1301420277";
            string fileStoragePath = string.Format("/{0}Mall/SaleBefore/Goods/", DateTime.Now.ToString("yyyy"));
            IOssService ossService = OssService.GetTencent(Region, SecretId, SecretKey, Bucket, fileStoragePath);
            OssResult result = ossService.UploadFile(filePath, null);
            return result;
        }
    }
}
