|
@@ -9,12 +9,12 @@ namespace ET.Server
|
|
|
[FriendOf(typeof (GameDouyinComponent))]
|
|
|
public static class GameDouyinComponentSystem
|
|
|
{
|
|
|
- public class GameDouyinComponentAwakeSystem: AwakeSystem<GameDouyinComponent, bool>
|
|
|
+ public class GameDouyinComponentAwakeSystem: AwakeSystem<GameDouyinComponent>
|
|
|
{
|
|
|
- protected override void Awake(GameDouyinComponent self, bool tokenIsNull)
|
|
|
+ protected override void Awake(GameDouyinComponent self)
|
|
|
{
|
|
|
Log.Info($"创建抖音组件...");
|
|
|
- self.TokenIsNull = tokenIsNull;
|
|
|
+ self.InitAccessToken();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -29,19 +29,11 @@ namespace ET.Server
|
|
|
{
|
|
|
protected override void Update(GameDouyinComponent self)
|
|
|
{
|
|
|
- if (self.TokenIsNull)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
if (TimeHelper.ClientNow() < self.AccessTokenTime)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- Log.Info($"AccessToken刷新...");
|
|
|
self.InitAccessToken();
|
|
|
- Log.Info($"AccessToken刷新完成, AccessToken:{self.AccessToken}, AccessTokenTime:{self.AccessTokenTime}");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -80,6 +72,8 @@ namespace ET.Server
|
|
|
self.AccessToken = Convert.ToString(jObject.SelectToken("data").SelectToken("access_token"));
|
|
|
long time = Convert.ToInt64(jObject.SelectToken("data").SelectToken("expires_in"));
|
|
|
self.AccessTokenTime = TimeHelper.ClientNow() + time * 1000;
|
|
|
+
|
|
|
+ Log.Info($"AccessToken刷新完成, AccessToken:{self.AccessToken}, AccessTokenTime:{self.AccessTokenTime}");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -130,10 +124,6 @@ namespace ET.Server
|
|
|
/// <param name="roomId"></param>
|
|
|
public static void TopGifts(this GameDouyinComponent self, long roomId)
|
|
|
{
|
|
|
- if (self.TokenIsNull)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
if (string.IsNullOrEmpty(self.AccessToken.Trim()))
|
|
|
{
|
|
|
Log.Error($"TopGifts...AccessToken为null");
|