fix 消费二维码使用时间戳

This commit is contained in:
2024-06-09 00:22:25 +08:00
parent c8b232ee66
commit bbb34663c7
3 changed files with 28 additions and 8 deletions

View File

@@ -21,7 +21,6 @@ public class GainfoQrCodeService : IGainfoQrCodeService
public async Task<string> GetMyQrCodeAsync(bool isNeedRefresh = false)
{
var jinkoCode = _currentUser.GetUserClaim("jinko-code");
jinkoCode = "09992534";
jinkoCode.IsEmpty().ThrowIfTrue("无法获取二维码");
var now = DateTime.Now;
@@ -53,14 +52,16 @@ public class GainfoQrCodeService : IGainfoQrCodeService
private static string GenerateQrCode(string code)
{
var ts = DateTimeOffset.Now.ToUnixTimeMilliseconds();
//var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == code).SingleAsync();
var qrCode = string.Concat("consumer", ":", code, ":", Guid.NewGuid()).Replace("-", "");
//var qrCode = string.Concat("consumer", ":", code, ":", Guid.NewGuid()).Replace("-", "");
var qrCode = string.Concat("consumer", ":", code, ":");
return qrCode.ToArray().Select(x =>
{
var b = Encoding.ASCII.GetBytes(x.ToString());
int i = b[0];
return Convert.ToString(i);
}).Join(string.Empty);
}).Join(string.Empty) + ts;
}
}