|
@@ -25,12 +25,13 @@ namespace TEAMModelOS.Controllers.Learn
|
|
[ApiController]
|
|
[ApiController]
|
|
public class VoteController : BaseController
|
|
public class VoteController : BaseController
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ private SnowflakeId SnowflakeId;
|
|
private readonly AzureCosmosFactory _cosmos;
|
|
private readonly AzureCosmosFactory _cosmos;
|
|
|
|
|
|
private readonly AzureServiceBusFactory _serviceBus;
|
|
private readonly AzureServiceBusFactory _serviceBus;
|
|
- public VoteController(AzureCosmosFactory cosmos, AzureServiceBusFactory serviceBus)
|
|
|
|
|
|
+ public VoteController(AzureCosmosFactory cosmos, AzureServiceBusFactory serviceBus, SnowflakeId _SnowflakeId)
|
|
{
|
|
{
|
|
|
|
+ SnowflakeId = _SnowflakeId;
|
|
_cosmos = cosmos;
|
|
_cosmos = cosmos;
|
|
_serviceBus = serviceBus;
|
|
_serviceBus = serviceBus;
|
|
}
|
|
}
|
|
@@ -48,7 +49,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
//新增
|
|
//新增
|
|
if (string.IsNullOrEmpty(request.@params.vote.id))
|
|
if (string.IsNullOrEmpty(request.@params.vote.id))
|
|
{
|
|
{
|
|
- request.@params.vote.id = Guid.NewGuid().ToString();
|
|
|
|
|
|
+ request.@params.vote.id = SnowflakeId.NextId()+"";
|
|
request.@params.vote.status = 100;
|
|
request.@params.vote.status = 100;
|
|
}
|
|
}
|
|
if (request.@params.vote.publishModel.Equals("0"))
|
|
if (request.@params.vote.publishModel.Equals("0"))
|
|
@@ -58,7 +59,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
|
|
|
|
} else if (request.@params.vote.publishModel.Equals("1")) {
|
|
} else if (request.@params.vote.publishModel.Equals("1")) {
|
|
|
|
|
|
- string msgId = Guid.NewGuid().ToString();
|
|
|
|
|
|
+ string msgId = SnowflakeId.NextId() + "";
|
|
long SequenceNumber = await _serviceBus.SendMessage<Vote>(Constants.TopicName, request.@params.vote.id, request.@params.vote.code, request.@params.vote.startTime, 200, msgId);
|
|
long SequenceNumber = await _serviceBus.SendMessage<Vote>(Constants.TopicName, request.@params.vote.id, request.@params.vote.code, request.@params.vote.startTime, 200, msgId);
|
|
request.@params.vote.sequenceNumber = SequenceNumber;
|
|
request.@params.vote.sequenceNumber = SequenceNumber;
|
|
}
|
|
}
|
|
@@ -70,7 +71,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
//设定结束时间
|
|
//设定结束时间
|
|
//_timerWorkService.TimerWork<Vote>(request.@params.vote.endTime, 300, new Dictionary<string, object> { { "id", request.@params.vote.id } });
|
|
//_timerWorkService.TimerWork<Vote>(request.@params.vote.endTime, 300, new Dictionary<string, object> { { "id", request.@params.vote.id } });
|
|
//设定结束时间
|
|
//设定结束时间
|
|
- string msgEndId = Guid.NewGuid().ToString();
|
|
|
|
|
|
+ string msgEndId = SnowflakeId.NextId() + "";
|
|
await _serviceBus.SendMessage<Vote>(Constants.TopicName, request.@params.vote.id, request.@params.vote.code, request.@params.vote.endTime, 300, msgEndId);
|
|
await _serviceBus.SendMessage<Vote>(Constants.TopicName, request.@params.vote.id, request.@params.vote.code, request.@params.vote.endTime, 300, msgEndId);
|
|
//清除作业
|
|
//清除作业
|
|
if (!request.@params.reset)
|
|
if (!request.@params.reset)
|