|
@@ -32,8 +32,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
|
{
|
|
|
private readonly IAzureCosmosDBV3Repository _cosmos;
|
|
|
private readonly ITimerWorkService _timerWorkService;
|
|
|
- private static ITopicClient topicClient;
|
|
|
- readonly string ServiceBusConnectionString = BaseConfigModel.Configuration["HaBookAuth:ServiceBus"];
|
|
|
+
|
|
|
|
|
|
public HomeworkController(IAzureCosmosDBV3Repository cosmos, ITimerWorkService timerWorkService)
|
|
|
{
|
|
@@ -97,7 +96,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
|
public async Task<BaseJosnRPCResponse> Upsert(JosnRPCRequest<HomeworkDto> request)
|
|
|
{
|
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
- topicClient = new TopicClient(ServiceBusConnectionString, Constants.TopicName);
|
|
|
+
|
|
|
//新增
|
|
|
if (string.IsNullOrEmpty(request.@params.homeWork.id))
|
|
|
|
|
@@ -128,8 +127,7 @@ namespace TEAMModelOS.Controllers.Learn
|
|
|
if (time <= 0) {
|
|
|
return builder.Data("请重新设置时间").build();
|
|
|
}
|
|
|
- await topicClient.ScheduleMessageAsync(message, new DateTimeOffset(DateTimeHelper.ConvertToDateTime(request.@params.homeWork.startTime)));
|
|
|
- await topicClient.SendAsync(message);
|
|
|
+
|
|
|
_timerWorkService.TimerWork<Homework>(request.@params.homeWork.startTime,200, new Dictionary<string, object> { { "id", request.@params.homeWork.id } });
|
|
|
}
|
|
|
|