1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Linq;
- using System.Data;
- using System.Threading;
- using Library;
- using LitJson;
- using System.Collections.Generic;
- namespace MySystem
- {
- public class PushHelper
- {
- public readonly static PushHelper Instance = new PushHelper();
- private PushHelper()
- {
- }
- string NoticeUrl = "http://cybsp.888cyb.com/v1/cybsp/bindChangeNotify/hd";
- string AesSecret = "kvS4TIRh7Yulg4nr";
- //要执行的方法
- public void Do(SortedList<string, string> obj)
- {
- try
- {
- string PushData = "";
- string PushDataEncrypt = "";
- PushData = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
- LogHelper.Instance.WriteLog("原始数据:" + PushData, "好哒推送数据日志");
- string content = EncryptHelper.Encrypt1(obj, AesSecret);
- LogHelper.Instance.WriteLog("加密数据:" + content, "好哒推送数据日志");
- obj = new SortedList<string, string>();
- obj.Add("type", "好哒商户绑定信息");
- obj.Add("notice_id", Guid.NewGuid().ToString());
- obj.Add("timestamp", DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8));
- obj.Add("content", content);
- string requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
- PushDataEncrypt = requestJson;
- LogHelper.Instance.WriteLog("请求参数:" + PushDataEncrypt, "好哒推送数据日志");
- LogHelper.Instance.WriteLog("请求地址:" + NoticeUrl, "好哒推送数据日志");
- string result = function.PostWebRequest(NoticeUrl, requestJson, "application/json");
- LogHelper.Instance.WriteLog("返回报文:" + result + "\n\n", "好哒推送数据日志");
- }
- catch(Exception ex)
- {
- LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString() + "\n\n", "好哒推送数据异常");
- }
- }
- }
- }
|