diff --git a/WGShare.API/AntDeploy.json b/WGShare.API/AntDeploy.json index 83bbf8a..20d2005 100644 --- a/WGShare.API/AntDeploy.json +++ b/WGShare.API/AntDeploy.json @@ -115,11 +115,11 @@ "DockerConfig": { "Prot": "5192:5192", "AspNetCoreEnv": "", - "LastEnvName": "marking001", + "LastEnvName": "29dev", "RemoveDaysFromPublished": "10", "WorkDir": "", "Volume": "", - "Other": "--name wgshare-api -e ASPNETCORE_ENVIRONMENT=Production -e TZ=Asia/Shanghai", + "Other": "--name wgshare-api -e ASPNETCORE_ENVIRONMENT=Development -e TZ=Asia/Shanghai", "EnvPairList": [ { "EnvName": "29dev", diff --git a/WGShare.API/Controllers/Frontend/AgoraCallbackController.cs b/WGShare.API/Controllers/Frontend/AgoraCallbackController.cs new file mode 100644 index 0000000..0ceb99a --- /dev/null +++ b/WGShare.API/Controllers/Frontend/AgoraCallbackController.cs @@ -0,0 +1,41 @@ +using AgoraIO.Media; +using AgoraIO.Rtm; +using Mapster; +using Masuit.Tools; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using System.Net.Http; +using WGShare.API.Controllers.Basic; +using WGShare.API.Helpers; +using WGShare.Domain.AgoraApiResult; +using WGShare.Domain.Constant; +using WGShare.Domain.DTOs.Room; +using WGShare.Domain.Entities; +using WGShare.Domain.FriendlyException; +using WGShare.Domain.GeneralModel; +using Yitter.IdGenerator; + +namespace WGShare.API.Controllers.Frontend +{ + /// + /// Agora接口 + /// + [ApiExplorerSettings(GroupName = "frontend")] + [Route("agora-cb")] + public class AgoraCallbackController : BasicController + { + private readonly ILogger _logger; + + public AgoraCallbackController( + ILogger logger) + { + this._logger = logger; + } + + [HttpPost("event")] + public async Task Event() + { + return string.Empty; + } + } +} diff --git a/WGShare.API/Controllers/Frontend/HomeController.cs b/WGShare.API/Controllers/Frontend/HomeController.cs index 1bffb90..82c10c0 100644 --- a/WGShare.API/Controllers/Frontend/HomeController.cs +++ b/WGShare.API/Controllers/Frontend/HomeController.cs @@ -115,5 +115,14 @@ namespace WGShare.API.Controllers.Frontend privilegeExpiredTs); } + /// + /// 获取Agora配置 + /// + /// + [HttpGet("agora-conf")] + public string GetAgoraConfig() + { + return _configuration["Agora:appId"].ToString(); + } } } diff --git a/WGShare.API/Controllers/Frontend/UserController.cs b/WGShare.API/Controllers/Frontend/UserController.cs index f3c3a7b..673c26b 100644 --- a/WGShare.API/Controllers/Frontend/UserController.cs +++ b/WGShare.API/Controllers/Frontend/UserController.cs @@ -151,6 +151,7 @@ namespace WGShare.API.Controllers.Frontend using var stream = file.OpenReadStream(); var rows = stream.Query().ToList(); + rows.RemoveAll(x => x == null || string.IsNullOrWhiteSpace(x.Account)); if (rows.IsNullOrEmpty()) { throw Oops.Oh("无有效数据,请检查文件数据!"); diff --git a/WGShare.API/WGShare.API.xml b/WGShare.API/WGShare.API.xml index 96244da..16316fb 100644 --- a/WGShare.API/WGShare.API.xml +++ b/WGShare.API/WGShare.API.xml @@ -61,6 +61,11 @@ + + + Agora接口 + + 首页接口 @@ -86,6 +91,12 @@ + + + 获取Agora配置 + + + 会议室接口 diff --git a/WGShare.API/appsettings.Development.json b/WGShare.API/appsettings.Development.json index 6211bc7..fa7b4e5 100644 --- a/WGShare.API/appsettings.Development.json +++ b/WGShare.API/appsettings.Development.json @@ -7,7 +7,7 @@ "Console": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", + "Microsoft": "Warning" } //"FormatterName": "CustomTimePrefixingFormatter", //"FormatterOptions": { @@ -36,5 +36,13 @@ "Audience": "WGshareClient", // 过期 秒 "Expires": 86400 + }, + "Agora": { + "appId": "4a4f7be64fa1404ebda74784fe9ac381", + "appSecret": "255e05d96c794251b282a0de84242355", + "tokenExpireTimeInSecond": 7200, + "apiPrefix": "https://api.sd-rtn.com/", + "clientId": "80cdc24f7dfa4497a37d98da95a3c4a4", + "clientSecret": "8323581d4d464114b1f324b26cc62e09" } } diff --git a/WGShare.Domain/DTOs/AgoraCallback/EventBody.cs b/WGShare.Domain/DTOs/AgoraCallback/EventBody.cs new file mode 100644 index 0000000..d844ae5 --- /dev/null +++ b/WGShare.Domain/DTOs/AgoraCallback/EventBody.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WGShare.Domain.Enums; + +namespace WGShare.Domain.DTOs.AgoraCallback +{ + public class EventBody + { + /// + /// 通知 ID,标识来自声网业务服务器的一次事件通知。 + /// + public string noticeId { get; set; } + /// + /// 业务 ID。值为 1 表示实时通信业务。 + /// + public int productId { get; set; } + + /// + /// 通知的事件类型。详见频道事件类型。 + /// + public EventType eventType { get; set; } + + + /// + /// 声网消息服务器向你的服务器发送事件通知的 Unix 时间戳 (ms)。通知重试时该值会更新。 + /// + public int notifyMs { get; set; } + + /// + /// 会话 ID。 + /// + public string sid { get; set; } + + /// + /// 通知事件的具体内容。payload 因 eventType 而异,详见频道事件类型。 + /// + public string payload { get; set; } + } + + public class AgoraCallbackPayload + { + /// + /// 频道名称 + /// + public string channelName { get; set; } + } +} diff --git a/WGShare.Domain/Enums/EventType.cs b/WGShare.Domain/Enums/EventType.cs new file mode 100644 index 0000000..d4b54c2 --- /dev/null +++ b/WGShare.Domain/Enums/EventType.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WGShare.Domain.Enums +{ + /// + /// 声网频道事件类型 + /// + public enum EventType + { + /// + /// 创建频道。 + /// + channel_create = 101, + + /// + /// 销毁频道。 + /// + channel_destroy = 102, + + /// + /// 直播场景下,主播加入频道 + /// + broadcaster_join_channel = 103, + + /// + /// 直播场景下,主播离开频道 + /// + broadcaster_leave_channel = 104, + + /// + /// 直播场景下,观众加入频道 + /// + audience_join_channel = 105, + + /// + /// 直播场景下,观众离开频道 + /// + audience_leave_channel = 106, + + /// + /// 观众将角色切换为主播 + /// + client_role_change_to_broadcaster = 111, + + /// + /// 主播将角色切换为观众。 + /// + client_role_change__to_audience = 112 + } +}