1234567891011121314151617181920212223242526272829303132333435 |
- using Fw.Utility.UnifyResponse;
- using Hotline.CallCenter.Tels;
- using Hotline.XingTang.Dto;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.DependencyInjection;
- using NPOI.SS.Formula.Functions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using static System.Runtime.InteropServices.JavaScript.JSType;
- namespace Hotline.XingTang;
- public static class ServiceCollectionExtensions
- {
- public static IServiceCollection AddXingTangSDK(this IServiceCollection services)
- {
- services.AddScoped<ICallTelClient, CallTelClient>();
- services.AddScoped<INotifyService, NotifyService>();
- return services;
- }
- public static void UseXingTangApiEndpoints(this WebApplication app)
- {
- // 注册 POST 接口
- app.MapPost("/api/v1/XingTang/notify/status", async (INotifyService service, HttpContext context) =>
- {
- var input = await context.Request.ReadFromJsonAsync<NotifyInDto>();
- await service.NotifyStatus(input!);
- return Results.Ok(new ApiResponse(0, "ok", ""));
- });
- }
- }
|