使用场景

C# 服务器后台调用其他服务器并处理

场景

 		/// <summary>
/// 获取用户信息
/// </summary>
/// <param name="userIds"></param>
/// <returns></returns>
private PHPUserListModel GetUserInfoList(List<int> userIds)
{
JavaScriptSerializer js = new JavaScriptSerializer();
string jsonData = js.Serialize(userIds);//序列化
string html = string.Empty;
long tick = CommonHelper.GetTimestamp(DateTime.Now);//时间戳
string postData = string.Format("uidArr={0}&type={1}&time={2}&token={3}", jsonData, 2, tick, CreateMD5(tick + _commonSettings.PHPServerKey));
HttpHelper http = new HttpHelper();
html = http.GetHtml(string.Format("{0}/Customer/getUserInfo", _commonSettings.PHPServerUrl), "post", postData).Html;
PHPUserListModel result = CommonHelper.ParseJson<PHPUserListModel>(html);
return result;
}

知识点

05-02 04:45