初始化
This commit is contained in:
56
Face.Web/Areas/App/Models/GetRoomInterface.cs
Normal file
56
Face.Web/Areas/App/Models/GetRoomInterface.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Face.Services.Manager;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Face.Web.Areas.App.Models
|
||||
{
|
||||
public static class GetRoomInterface
|
||||
{
|
||||
public static Roominfo.Root Roomport(test te)//房间api
|
||||
{
|
||||
try
|
||||
{
|
||||
string url = "https://www.boonlive-rcu.com/api/GetHostList";
|
||||
string date = $"jsonData={JsonConvert.SerializeObject(te)}";
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
request.Method = "Post";
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
StreamWriter sw = new StreamWriter(request.GetRequestStream());
|
||||
sw.Write(date);
|
||||
sw.Flush();
|
||||
|
||||
WebResponse response = request.GetResponse();
|
||||
Stream s = response.GetResponseStream();
|
||||
StreamReader sr = new StreamReader(s, Encoding.GetEncoding("UTF-8"));
|
||||
string Show = sr.ReadToEnd();
|
||||
Roominfo.Root info = JsonConvert.DeserializeObject<Roominfo.Root>(Show);//josn转换实体类
|
||||
sw.Dispose();
|
||||
sw.Close();
|
||||
sr.Dispose();
|
||||
sr.Close();
|
||||
s.Dispose();
|
||||
s.Close();
|
||||
return info;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
Roominfo.Root info = new Roominfo.Root() { IsSuccess = false};//josn转换实体类
|
||||
return info;
|
||||
}
|
||||
}
|
||||
public class test
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string creatDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user