示例#1
0
 public UtilitiesModule()
 {
     Get("/Image/Token", async ctx =>
     {
         var token = QiniuTool.GenerateToken();
         await ctx.Ajax(new { token });
     });
 }
示例#2
0
        public IActionResult Token()
        {
            var token  = QiniuTool.GenerateToken();
            var result = new ApiMessage();

            result.Data    = token;
            result.Message = "success!";
            result.Success = true;
            return(Json(result));
        }
示例#3
0
        public IActionResult GetToken(string fileType)
        {
            var token = QiniuTool.GenerateToken();

            return(Json(new
            {
                token = token,
                suffix = suffix
            }));
        }
示例#4
0
        public async Task <IActionResult> GetToken()
        {
            string token = "";

            //if (!memoryCache.TryGetValue("getToken", out token))
            //{
            //    token = qiniutool.GenerateToken();
            //    var cacheEntryOptions = new MemoryCacheEntryOptions()
            //        .SetSlidingExpiration(TimeSpan.FromSeconds(30));
            //    memoryCache.Set("getToken", token, cacheEntryOptions);
            //}
            token = qiniutool.GenerateToken();
            return(Json(new { token }));
        }
示例#5
0
        public IActionResult Token()
        {
            var result = new ApiMessage();

            try
            {
                var token = QiniuTool.GenerateToken();
                result.Data    = token;
                result.Message = "success!";
                result.Success = true;
            }
            catch (Exception exc)
            {
                result.SetFault(exc);
            }

            return(Json(result));
        }
示例#6
0
 public string TokenByParam(string fileName, string bucket, ZoneID zoneID)
 {
     return(QiniuTool.GenerateToken(fileName, bucket, zoneID));
 }
示例#7
0
 public string TokenByKey(string fileName)
 {
     return(QiniuTool.GenerateToken(fileName));
 }
示例#8
0
 public string Token()
 {
     return(QiniuTool.GenerateToken());
 }
示例#9
0
        public string GenerateQiniu()
        {
            var qiniu = new QiniuTool(settingService.File.AppKey, settingService.File.AppSecret, settingService.File.Bucket, settingService.File.Zone);

            return(qiniu.GenerateToken());
        }