|
@@ -86,32 +86,33 @@ namespace TEAMModelOS.Services.Common
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid);
|
|
|
+ msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid,vote.times, "once");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- msgid = await VoteIng(vote, new RedisValue(), msgid, option, Field, curr, _azureRedis, userid);
|
|
|
+ msgid = await VoteIng(vote, new RedisValue(), msgid, option, Field, curr, _azureRedis, userid, vote.times, "once");
|
|
|
}
|
|
|
break;
|
|
|
case "day": //周期内每天
|
|
|
Field = $"{userid}-day-{now.ToString("yyyyMMdd")}";
|
|
|
value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
|
|
|
- msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis,userid);
|
|
|
+ msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis,userid, vote.times, now.ToString("yyyyMMdd"));
|
|
|
break;
|
|
|
case "week": //自然周
|
|
|
- Field = $"{userid}-week-{now.ToString("yyyy")}{GetWeek(now)}";
|
|
|
+ int week = GetWeek(now);
|
|
|
+ Field = $"{userid}-week-{now.ToString("yyyy")}{week}";
|
|
|
value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
|
|
|
- msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid);
|
|
|
+ msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid, vote.times,$"{now.ToString("yyyy")}{week}");
|
|
|
break;
|
|
|
case "month": //月份
|
|
|
Field = $"{userid}-month-{now.ToString("yyyyMM")}";
|
|
|
value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
|
|
|
- msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid);
|
|
|
+ msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid, vote.times, now.ToString("yyyyMM"));
|
|
|
break;
|
|
|
case "year"://年份
|
|
|
Field = $"{userid}-year-{now.ToString("yyyy")}";
|
|
|
value = _azureRedis.GetRedisClient(8).HashGet($"Vote:Record:{vote.id}", Field);
|
|
|
- msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid);
|
|
|
+ msgid = await VoteIng(vote, value, msgid, option, Field, curr, _azureRedis, userid, vote.times, now.ToString("yyyy"));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -127,7 +128,7 @@ namespace TEAMModelOS.Services.Common
|
|
|
}
|
|
|
return msgid;
|
|
|
}
|
|
|
- public static async Task<byte> VoteIng(Vote vote, RedisValue value, byte msgid, Dictionary<string, int> option, string Field, long curr, AzureRedisFactory _azureRedis,string userid)
|
|
|
+ public static async Task<byte> VoteIng(Vote vote, RedisValue value, byte msgid, Dictionary<string, int> option, string Field, long curr, AzureRedisFactory _azureRedis,string userid,string times,string endpoint)
|
|
|
{
|
|
|
if (!value.IsNullOrEmpty)
|
|
|
{
|
|
@@ -156,6 +157,8 @@ namespace TEAMModelOS.Services.Common
|
|
|
}
|
|
|
record.time = curr;
|
|
|
record.userid = userid;
|
|
|
+ record.times = times;
|
|
|
+ record.endpoint = endpoint;
|
|
|
//保存投票记录
|
|
|
bool status = await _azureRedis.GetRedisClient(8).HashSetAsync($"Vote:Record:{vote.id}", Field, record.ToJsonString());
|
|
|
//单独保存每个人方便查询的记录
|
|
@@ -177,7 +180,7 @@ namespace TEAMModelOS.Services.Common
|
|
|
if (option.Count <= vote.voteNum)
|
|
|
{
|
|
|
//保存投票记录
|
|
|
- VoteRecord record = new VoteRecord { opt = option, time = curr, userid = userid };
|
|
|
+ VoteRecord record = new VoteRecord { opt = option, time = curr, userid = userid ,times=times,endpoint=endpoint};
|
|
|
bool status = await _azureRedis.GetRedisClient(8).HashSetAsync($"Vote:Record:{vote.id}", Field, record.ToJsonString());
|
|
|
//单独保存每个人方便查询的记录
|
|
|
bool stuallstatus = await _azureRedis.GetRedisClient(8).HashSetAsync($"Vote:Record:{vote.id}:{userid}", Field, record.ToJsonString());
|