public void TestSendMsg1() { MyJsonClass myJsonObj = new MyJsonClass(); myJsonObj.m_strDeskNumber = "1"; myJsonObj.m_strLocalIp = "127.0.0.1"; myJsonObj.m_strState = "登录"; myJsonObj.userType = "Unity"; myJsonObj.MsgType = "message"; myJsonObj.socketType = "tcp"; myJsonObj.targetUserType = "targetUserType"; myJsonObj.message = "我测试一下发送数据"; string json = JsonUtility.ToJson(myJsonObj); SendMsg(json); }
public FileContentResult GetUserTaxReturn(string userId, int taxYear) { byte[] bytes = new byte[64000]; string contentType = "application/pdf"; FileContentResult taxReturn = new FileContentResult(bytes, contentType); var home = new HomeController(); string jsonResult = new JavaScriptSerializer().Serialize(home.GetSingleUserTaxReturn(User.Identity.GetUserId(), taxYear).Data); MyJsonClass response = JsonConvert.DeserializeObject <MyJsonClass>(jsonResult); if (response.status == 0 && response != null) { if (response.fileContentType == "application/pdf") { bytes = response.fileContents; return(File(bytes, response.fileContentType, response.fileName)); } } return(taxReturn); }