HttpDouyinApiCallbackHandler.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Net;
  2. namespace ET.Server
  3. {
  4. /// <summary>
  5. /// 抖音推送数据, http回调
  6. /// </summary>
  7. [HttpHandler(SceneType.RouterManager, "/tk")]
  8. public class HttpCommentHandler: IHttpHandler
  9. {
  10. public async ETTask Handle(Entity domain, HttpListenerContext context)
  11. {
  12. string xroomId = context.Request.Headers["x-roomid"];
  13. if (string.IsNullOrEmpty(xroomId))
  14. {
  15. Log.Error($"抖音推送数据http回调 找不到请求头:x-roomid");
  16. return;
  17. }
  18. string msgType = context.Request.Headers["x-msg-type"];
  19. if (string.IsNullOrEmpty(msgType))
  20. {
  21. Log.Error($"抖音推送数据http回调 找不到请求头:x-msg-type");
  22. return;
  23. }
  24. long roomId = long.Parse(xroomId);
  25. switch (msgType)
  26. {
  27. case "live_comment":
  28. {
  29. // 直播间评论
  30. Log.Debug($"收到抖音推送http回调 评论添加玩家回调...");
  31. DouyinCallBackHelper.LiveComment(domain, context, roomId);
  32. break;
  33. }
  34. case "live_gift":
  35. {
  36. // 直播间送礼
  37. Log.Debug($"收到抖音推送http回调 直播间刷礼物回调...");
  38. DouyinCallBackHelper.LiveGift(domain, context, roomId);
  39. break;
  40. }
  41. case "live_like":
  42. {
  43. // 直播间点赞
  44. Log.Debug($"收到抖音推送http回调 点赞10次增加等级回调...");
  45. DouyinCallBackHelper.LiveLike(domain, context, roomId);
  46. break;
  47. }
  48. }
  49. await ETTask.CompletedTask;
  50. }
  51. }
  52. }