配合前端程序重定向结果放result

返回格式
{"action":"Device/Login","code":301,"result":{"type":"1","url":"tcp://10.0.0.18:2233"}}
This commit is contained in:
arlen 2017-09-12 09:59:49 +08:00
parent cc461d1355
commit bd5bd86733
1 changed files with 3 additions and 5 deletions

View File

@ -200,10 +200,10 @@ void LinkClient::OnReceive(LinkMessage& msg)
//重定向
else if (code == 301)
{
auto server = js["result"].AsString();
auto rs = js["result"];
//重定向类型 0:临时 1:永久
auto type = js["type"].AsInt();
auto type = rs["type"].AsInt();
auto server = rs["url"].AsString();
//修改默认连接
if (type == 1)
{
@ -212,8 +212,6 @@ void LinkClient::OnReceive(LinkMessage& msg)
Cfg->Save();
}
debug_printf("\r\n重定向:type:%d,server:%d\r\n",type, server);
//设置连接服务器
Redirect(server);
return;