using System.Net; namespace ET.Server { /// <summary> /// 抖音推送数据, http回调 /// </summary> [HttpHandler(SceneType.RouterManager, "/tk")] public class HttpCommentHandler: IHttpHandler { public async ETTask Handle(Entity domain, HttpListenerContext context) { string xroomId = context.Request.Headers["x-roomid"]; if (string.IsNullOrEmpty(xroomId)) { Log.Error($"抖音推送数据http回调 找不到请求头:x-roomid"); return; } string msgType = context.Request.Headers["x-msg-type"]; if (string.IsNullOrEmpty(msgType)) { Log.Error($"抖音推送数据http回调 找不到请求头:x-msg-type"); return; } long roomId = long.Parse(xroomId); switch (msgType) { case "live_comment": { // 直播间评论 Log.Debug($"收到抖音推送http回调 评论添加玩家回调..."); DouyinCallBackHelper.LiveComment(domain, context, roomId); break; } case "live_gift": { // 直播间送礼 Log.Debug($"收到抖音推送http回调 直播间刷礼物回调..."); DouyinCallBackHelper.LiveGift(domain, context, roomId); break; } case "live_like": { // 直播间点赞 Log.Debug($"收到抖音推送http回调 点赞10次增加等级回调..."); DouyinCallBackHelper.LiveLike(domain, context, roomId); break; } } await ETTask.CompletedTask; } } }