|
@@ -0,0 +1,40 @@
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Net;
|
|
|
+
|
|
|
+namespace ET.Server
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 获取版本号,用于强更
|
|
|
+ /// </summary>
|
|
|
+ [HttpHandler(SceneType.RouterManager, "/get_version")]
|
|
|
+ public class HttpGetVersionHandler : IHttpHandler
|
|
|
+ {
|
|
|
+ public async ETTask Handle(Entity domain, HttpListenerContext context)
|
|
|
+ {
|
|
|
+ VersionInfo info = null;
|
|
|
+
|
|
|
+ // 查询配置的版本号
|
|
|
+ List<VersionInfo> list = await DBManagerComponent.Instance.GetZoneDB(1).Query<VersionInfo>(d => d.Version > 0);
|
|
|
+
|
|
|
+ if (list is { Count: > 0 })
|
|
|
+ {
|
|
|
+ info = list[0];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ info = new VersionInfo();
|
|
|
+ info.Id = IdGenerater.Instance.GenerateId();
|
|
|
+ info.Version = 100;
|
|
|
+ info.Url = "https://d.apkpure.com/b/APK/com.tencent.tmgp.sgame?version=latest";
|
|
|
+
|
|
|
+ await DBManagerComponent.Instance.GetZoneDB(1).Save<VersionInfo>(info);
|
|
|
+ }
|
|
|
+
|
|
|
+ HttpGetVersionResponse res = new HttpGetVersionResponse();
|
|
|
+ res.Version = info.Version;
|
|
|
+ res.Url = info.Url;
|
|
|
+ HttpHelper.Response(context, res);
|
|
|
+ await ETTask.CompletedTask;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|