forked from sin365/AxibugEmuOnline
WebApi 检查版本和获取服务器IP
This commit is contained in:
parent
299d825f4a
commit
9fcd5d3c3e
@ -16,6 +16,9 @@ namespace AxibugEmuOnline.Web.Common
|
||||
public string DBPwd{get;set;}
|
||||
public string RomDir{get;set;}
|
||||
public string ImageDir { get; set; }
|
||||
public string ServerIp { get; set; }
|
||||
public ushort ServerPort { get; set; }
|
||||
public string ClientVersion { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +41,9 @@ namespace AxibugEmuOnline.Web.Common
|
||||
DBName = "DBName",
|
||||
RomDir = "./Rom",
|
||||
ImageDir = "./Img",
|
||||
ServerIp = "127.0.0.1",
|
||||
ServerPort = 10001,
|
||||
ClientVersion = "0.0.0.1"
|
||||
};
|
||||
|
||||
string jsonString = JsonSerializer.Serialize(sampleCfg, new JsonSerializerOptions()
|
||||
|
@ -13,6 +13,20 @@ namespace AxibugEmuOnline.Web.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult CheckStandInfo(int platform, string version)
|
||||
{
|
||||
Resp_CheckStandInfo resp = new Resp_CheckStandInfo()
|
||||
{
|
||||
needUpdateClient = 0,
|
||||
clientVersion = Config.cfg.ClientVersion,
|
||||
serverIp = Config.cfg.ServerIp,
|
||||
serverPort = Config.cfg.ServerPort,
|
||||
downLoadUrl = ""
|
||||
};
|
||||
return new JsonResult(resp);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult NesRomList(string SearchKey,int Ptype,int GType,int Page, int PageSize)
|
||||
{
|
||||
@ -117,6 +131,16 @@ namespace AxibugEmuOnline.Web.Controllers
|
||||
ALLINONE,
|
||||
}
|
||||
|
||||
class Resp_CheckStandInfo
|
||||
{
|
||||
public int needUpdateClient { get; set; }
|
||||
public string serverIp { get; set; }
|
||||
public ushort serverPort { get; set; }
|
||||
public string clientVersion { get; set; }
|
||||
public string downLoadUrl { get; set; }
|
||||
}
|
||||
|
||||
|
||||
class Resp_GameList
|
||||
{
|
||||
public int page { get; set; }
|
||||
|
@ -2,6 +2,41 @@
|
||||
|
||||
这里说明,WebApi类的接口
|
||||
|
||||
### 基本信息检查
|
||||
|
||||
```
|
||||
{WebHost}/api/NesRomList?platform=<平台编号>&version=<版本>
|
||||
```
|
||||
Request:
|
||||
|
||||
```
|
||||
http://emu.axibug.com/api/CheckStandInfo?platform=1&version=1.0.0.0
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```
|
||||
{
|
||||
"needUpdateClient": 0,
|
||||
"serverIp": "139.186.160.243",
|
||||
"serverPort": 10492,
|
||||
"clientVersion": "0.0.0.1",
|
||||
"downLoadUrl": ""
|
||||
}
|
||||
```
|
||||
|
||||
序列化C#实体类示例
|
||||
|
||||
```
|
||||
class Resp_CheckStandInfo
|
||||
{
|
||||
public int needUpdateClient { get; set; }
|
||||
public string serverIp { get; set; }
|
||||
public ushort serverPort { get; set; }
|
||||
public string clientVersion { get; set; }
|
||||
public string downLoadUrl { get; set; }
|
||||
}
|
||||
```
|
||||
|
||||
### Nes游戏列表
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user