public string Notice(string sourceID, NoticeRequest1006 sendData) { string data = JsonUtils.Serialize(sendData); TxtLoger.SavaLogToTXT("推送,前data为:" + data, "a"); var signData = new SignData(sourceID); string signStr = signData.Sign(data); var obj = new { data = Base64Utils.EncodeBase64String(data), signdata = Base64Utils.EncodeBase64String(signStr), }; TxtLoger.SavaLogToTXT("obj是 数据是:" + obj.ToJson(), "a"); return(JsonUtils.Serialize(obj)); }
//public ActionResult Index() //{ // BaseRequest baseRequest; // var verifyResult = Verify(out baseRequest); // //loger.Info(string.Format("请求数据验证结果:编号:{0};信息:{1}", (int)verifyResult.Code, verifyResult.ErrorMessage)); // if (verifyResult.IsPass) // { // var response = Excute(baseRequest); // Notice(response, baseRequest.SourceID); // } // else // { // if (verifyResult.Code != EnumPlatform.EResponseCode.不存在此机构) // { // var response = BaseResponse.CreateBaseResponse(verifyResult.Code, verifyResult.ErrorMessage, null); // Notice(response, baseRequest.SourceID); // }; // } // ViewBag.aa = baseRequest.SourceID; // ViewBag.bb = baseRequest.BizCode; // //return Json(JsonUtils.Serialize(verifyResult)); // //return View(JsonUtils.Serialize(verifyResult)); // return View(); //} /// <summary> /// 返回数据给第三方 /// </summary> /// <param name="response"></param> /// <param name="sourceId"></param> private void Notice(BaseResponse response, string sourceId) { if (sourceId == null) { sourceId = "10001"; } var responseData = JsonUtils.Serialize(response); var signData = new SignData(sourceId); var signstr = signData.Sign(responseData); //loger.Info(string.Format("处理结果数据(base64编码前):{0}", responseData)); //loger.Info(string.Format("处理结果较验码(base64编码前):{0}", signstr)); var httpMessage = new HttpMessage { data = Base64Utils.EncodeBase64String(responseData), signdata = Base64Utils.EncodeBase64String(signstr) }; TxtLoger.SavaLogToTXT("data=" + Base64Utils.EncodeBase64String(responseData) + " ,signdata=" + Base64Utils.EncodeBase64String(signstr), "a"); //var responseStr = JsonUtils.Serialize(httpMessage); //WriteResponse(httpMessage.ToString()); WriteResponse(JsonUtils.Serialize(httpMessage)); }
static void WriteTable(string[] words) { if (lasthash == null) { Console.WriteLine("get block hash first."); return; } WriteTask write = new WriteTask(); //必须添加上一个块的hash,要不然服务器不会接受的 write.extData = new System.Collections.Generic.Dictionary <string, byte[]>(); write.extData["lasthash"] = lasthash; //createtable 123; //write.CreateTable(new TableInfo(new byte[] { 0x01, 0x02, 0x03 }, "hello world", "", DBValue.Type.String)); write.Put(new byte[] { 0x01, 0x02, 0x03 }, "123".ToBytes_UTF8Encode(), DBValue.FromValue(DBValue.Type.String, "balabala")); var srcdata = write.ToBytes(); var wiftest = "L2CmHCqgeNHL1i9XFhTLzUXsdr5LGjag4d56YY98FqEi4j5d83Mv";//对应地址 AdsNmzKPPG7HfmQpacZ4ixbv9XJHJs2ACz 作为服务器配置的writer var prikey = ThinNeo.Helper_NEO.GetPrivateKeyFromWIF(wiftest); var pubkey = ThinNeo.Helper_NEO.GetPublicKey_FromPrivateKey(prikey); var address = ThinNeo.Helper_NEO.GetAddress_FromPublicKey(pubkey); SignData signdata = SignData.Sign(prikey, srcdata); var b = signdata.VerifySign(address, srcdata); Console.WriteLine("sign result=" + b); var msg = client.Post_write(srcdata, signdata); Console.WriteLine("post write result block[" + msg.blockid + "] = " + msg.blockhash.ToString_Hex()); }