移动系统liao
2024-08-27 1571dee924ea10cdcb55300cf02f70c6208c0333
cylsg/cylsg.redis/EzCoreNetRedisService.cs
@@ -1,5 +1,6 @@
using Furion;
using Furion.DependencyInjection;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -99,6 +100,25 @@
            return Data;
        }
        public long Incrby(string key)
        {
         return  RedisHelper.IncrBy(key);
        }
        public string Get32sn()
        {
            string formattedDate = DateTime.Now.ToString("yyyyMMdd");
            var sn = Incrby($"CreatSnKey:{formattedDate}");
            if(sn<1)
            {
                //设置有效期限为24小时
                SetTtl($"CreatSnKey:{formattedDate}", 24 * 60 * 60);
            }
            string re = "Ez" + formattedDate + sn.ToString();
            return re;
        }
    }
}