using AppletMvcService.Common; using CRM.Core.Common.WebHelper; using CRM.Core.DTO.Ord; using CRM.Core.DTO.Res; using Newtonsoft.Json; using OfficeOpenXml; using Oracle.ManagedDataAccess.Client; using ResTool; using System; using System.Collections.Generic; using System.ComponentModel.Design; using System.Configuration; using System.Data; using System.Data.SQLite; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.Configuration; using System.Web.Script.Serialization; using System.Windows.Forms; using System.Xml; using WeChatServerServices.WxDbJob; using WX.CRM.BLL.Base; using WX.CRM.BLL.Res; using WX.CRM.BLL.SSO; using WX.CRM.BLL.Util; using WX.CRM.BLL.weapp; using WX.CRM.BLL.Wx; using WX.CRM.Common; using WX.CRM.CRMServices.SqlHelper; //using WX.CRM.Common.Employee; //using WX.CRM.CRMServices.Res_AlloCate; //using WX.CRM.CRMServices.SSO; using WX.CRM.CRMServices.WeiXin; using WX.CRM.DAL; using WX.CRM.DAL.Redis; using WX.CRM.IBLL.Res; using WX.CRM.IBLL.Util; using WX.CRM.Model.DTO; using WX.CRM.Model.Entity; using WX.CRM.Model.EntitySync; using WX.CRM.Model.Enum; using WX.CRM.Model.MAP; using WX.Interface.Security; namespace TEST1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { //DateTime time = DateTimeTool.GetTimeFromLinuxShortTime(0); //string s = time.ToString("yyyy-MM-dd HH:mm:ss:ffff"); //string x = ""; // new Wx_PushDataManagerBySQL_BL().web_push_updateServiceOnlineInsert("ivanxu2",DateTime.Now); //var att = "UploadFile/att/87680350-c26f-403f-a154-e083a388a90f.jpg"; //var filename = Path.GetFileName(att); //var filePaths = att.Replace(filename, "");//去掉开头的/,然后再按照/拆分文件路径 //var dic = @"D:\web\Core.Web\"; //上传文件的一级目录 //var fullPath = Path.Combine(dic, filePaths); //DateTime startDate = DateTime.Parse("2008-1-1"); //DateTime endDate = DateTime.Parse("2010-10-31"); //int totalMonth = endDate.Year * 12 + endDate.Month - startDate.Year * 12 - startDate.Month; //MessageBox.Show(totalMonth.ToString()); //var sDate = Convert.ToDateTime("2017/12/13 16:00:08"); //var eDate = Convert.ToDateTime("2018/12/13 16:00:08"); ////var allMonth = Math.Abs(eDate.Month - sDate.Month) + 12 * (eDate.Year - sDate.Year); ////var useMonth = Math.Abs(DateTime.Now.Month - sDate.Month) + 12 * (DateTime.Now.Year - sDate.Year); //var allMonth = eDate.Year * 12 + eDate.Month - sDate.Year * 12 - sDate.Month; //var useMonth = DateTime.Now.Year * 12 + DateTime.Now.Month - sDate.Year * 12 - sDate.Month; //decimal avgPrice = decimal.Parse("99") / allMonth; //MessageBox.Show("allMonth:" + allMonth.ToString()); //MessageBox.Show("useMonth:" + useMonth.ToString()); //MessageBox.Show("月份差:" + (allMonth - useMonth - 1)); //MessageBox.Show("平均价格:" + avgPrice.ToString("f2")); //MessageBox.Show((avgPrice * (allMonth - useMonth - 1)).ToString()); //var str = "8157:50% 6068:25% 8211:25%"; //int index = str.IndexOf(" "); //if (index > -1) //{ // var arr = Regex.Split(str, @"\s{2,}"); // foreach (var item in arr) // { // MessageBox.Show(item); // } //} //else //{ // MessageBox.Show("未找到"); //} //var dd = Convert.ToDateTime("2019-01-01").AddDays(30) - DateTime.Now; //MessageBox.Show(dd.Ticks.ToString()); //MessageBox.Show(dd.TotalSeconds.ToString()); //MessageBox.Show(dd.Days + "天" + dd.Hours + "小时"); //List str = new List() { "z", "c", "b" }; //MessageBox.Show(string.Join(",", str)); //str.Reverse(); //MessageBox.Show(string.Join(",", str)); //var ch = 1001; //var list = new List() { new { companyCode = "DNZZ", min = 1, max = 999 }, new { companyCode = "DNZZ", min = 1001, max = 1999 }, new { companyCode = "QBJZ", min = 2100, max = 2199 } }; //var company = list.FirstOrDefault(p => p.min <= ch && p.max >= ch); //MessageBox.Show(company.companyCode); //var aa = int.Parse("20000010"); //MessageBox.Show(aa.ToString()); //var url = "http://192.168.4.231:806/ResourceService.svc/Distribute"; //var url = "http://localhost:18739/ResourceService.svc/Distribute"; //var para = new { eid = 10000, mobile = "13416115228", typeid = 2222, fromtag = "aaa" }.ToJson(); //var response = Utility.PostAjaxData(url, para, Encoding.UTF8); //MessageBox.Show(response); //var str = "ab"; //var arr = new List(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); //foreach (var item in arr) //{ // MessageBox.Show(item); //} //var str = "111122"; //var s = str.Substring(0, 4); //MessageBox.Show(s); //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); //SecurityHelper sHelper = new SecurityHelper(); ////cntent:pYgbH3bL3pCLYP+vWdrHTGhfctlMOkSBBFq1/oguDh4hCEP33LaBJvyWE+LRNanUsJyCmzY50fR5yL/hCeE0LkUJxTI+3bkkfu+hbHw21rHbjeF8Sq+et+Kp7awUfmj2I6iSr5anZ4viSxIEtl4Tx9D3P33tok1Bwxm4N5It+Urw8KoLcUGZxsP6njgKUibshv0YAb7ZE3TxqzFtoLobyqqFA7zlM1zSPSsFO2WBQ3JJv/5Ml9BE/uJ0aKL3BWTgh16SejnkviITmnnwT5KGXvHW2VlriT02,clientid:UPWEBSITE,sign:QHfgo3euyBmLgLnBYb6KIQ== //var clientid = "UPWEBSITE"; //var content = "pYgbH3bL3pCLYP+vWdrHTGhfctlMOkSBBFq1/oguDh4hCEP33LaBJvyWE+LRNanUsJyCmzY50fR5yL/hCeE0LkUJxTI+3bkkfu+hbHw21rHbjeF8Sq+et+Kp7awUfmj2I6iSr5anZ4viSxIEtl4Tx9D3P33tok1Bwxm4N5It+Urw8KoLcUGZxsP6njgKUibshv0YAb7ZE3TxqzFtoLobyqqFA7zlM1zSPSsFO2WBQ3JJv/5Ml9BE/uJ0aKL3BWTgh16SejnkviITmnnwT5KGXvHW2VlriT02"; //var sign = "QHfgo3euyBmLgLnBYb6KIQ=="; //for (int i = 0; i < 10; i++) //{ // sw.Start(); // sHelper.CheckClientValid(clientid, content, sign); // sw.Stop(); // TimeSpan ts = sw.Elapsed; // LogHelper.Info("----" + ts.Milliseconds.ToString() + "ms"); //} //MessageBox.Show("ok"); //var json = "{}"; ////var json = "{\"eid\":26201,\"callback\":\"http://app.hc.dn8188.com/activity/00000269.html?unionid=o5bj2wciVgHv7E1QwLa1vqxws0Ko&username=up0000022\",\"isWeb\":true,\"business_name\":\"永顺盈家季度版\",\"business_type\":0,\"tradetype\":1,\"payeename\":\"\",\"payerno\":\"20000044\"}"; ////var json = "{\"callback\":\"http://app.hc.dn8188.com/activity/00000269.html?unionid=o5bj2wciVgHv7E1QwLa1vqxws0Ko&username=up0000022\",\"isWeb\":true,\"business_name\":\"永顺盈家季度版\",\"business_type\":0,\"tradetype\":1,\"payeename\":\"\",\"payerno\":\"20000044\"}"; //var data = JsonHelper.JsonDivertToObj(json); //if (data.eid.HasValue) // MessageBox.Show(data.eid.ToString()); //else // MessageBox.Show("ok"); //var txt = "aa啊打发111"; ////string rgs = "^(?!\\D+$)(?![^a-z]+$)[a-zA-Z\\d]$"; ////string rgs = "^\\w+$"; //string rgs = "[\u4E00-\u9FA5]"; //Regex reg = new Regex(rgs); //MessageBox.Show(reg.IsMatch(txt).ToString()); //var rejectStr = "[1,2,3]".Replace("[", "").Replace("]", ""); //var list = new List(rejectStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)).Select(x => Convert.ToInt32(x)); //MessageBox.Show(list.ToJson()); //var para = new { uid = "pengjb" }; //MessageBox.Show(para.ToJson()); //var ret = BlowFish.encode("{\"uid\": \"pengjb\"}"); //var ret = BlowFish.encode(para.ToJson()); ////MessageBox.Show(Convert.ToBase64String(Encoding.UTF8.GetBytes(ret))); //MessageBox.Show(ret); //var roles = "[CKHT][SH][TNBHG]"; //if (!roles.Contains("[CKHT]") || !roles.Contains("[SH]") || !roles.Contains("[TNBHG]")) //{ // MessageBox.Show("TNBHG"); //} //else //{ // MessageBox.Show("error"); //} //var model = new JionActiveDto() //{ // account = "15810583121", // accounttype = 0, // campaignId = "TNB26001", //}; //var json = JsonConvert.SerializeObject(model); //var para = new SecurityHelper().createSignEncodingStr(json); //MessageBox.Show(para); //var enstr = new WX.Interface.Security.EncDecUtil().encyptData(JsonHelper.ObjDivertToJson(new { result = false, retcode = 10015 }), "1622a92d"); //MessageBox.Show(enstr); //var url = "http://localhost:18739/ResourceService.svc/SyncRegUser?content=a&clientid=a&sign=a"; //var response = Utility.PostData(url, Encoding.UTF8); //MessageBox.Show(response); //Join?content={content}&clientid={clientid}&sign={sign} //var model = new JionActiveDto() //{ // account = "13800138000", // accounttype = 0, // campaignId = "test" //}; //var json = JsonConvert.SerializeObject(model); //var para = new SecurityHelper().createSignEncodingStr(json); ////Console.WriteLine(para); ////var url = "http://47.107.128.102:8096/ResourceService.svc/Join"; //var url = "http://192.168.11.45:806//ResourceService.svc/Join"; //var rep = Utility.PostData(url + "?" + para, Encoding.UTF8); ////Console.WriteLine(rep); //MessageBox.Show(rep); //var jiemi = new SecurityHelper().decyptData("UPWEBSITE", rep); //Console.WriteLine(jiemi); //var url = "http://47.107.128.102:7033/ExamService.svc/Save"; ////var url = "http://192.168.11.46:8096/ExamService.svc/Save"; //var url = "http://192.168.11.46:8096/ResSaleRule.svc/Save"; //var url = "http://localhost:55047/ResSaleRule.svc/Save"; //var para = JsonConvert.SerializeObject(new { appid = "a", appuserid = "a", papaerid = 34, subject = "[{\"subjectId\":1, \"answer\":\"A\"},{\"subjectId\":2, \"answer\":\"A\"}]" }); ////var subjectpara = new List() { 1, 2 }; ////var para = JsonConvert.SerializeObject(new { appid = "a", appuserid = "a", papaerid = 1, subject = subjectpara }); ////MessageBox.Show(para); //var res = Utility.PostAjaxData(url, para, Encoding.UTF8); //var list = new List() { 1, 2, 3 }; //var para = "[{\"EID\":6029,\"INNERUSERID\":1257205535.0,\"UNAME\":\"陈凤兰\",\"LEVELNO\":2.0,\"NUM\":20.0,\"RATE\":17.142857142857142857142857140,\"ISLIMIT\":0.0,\"LIMITNUM\":null,\"ISVALID\":1.0,\"CTIME\":\"2021-04-16 16:31:31\",\"SALEGROUPID\":15.0,\"DEPTRATE\":60.0}]"; ////var para = JsonConvert.SerializeObject(new { appid = "a", appuserid = "a", papaerid = 34, subject = "[{\"subjectId\":1, \"answer\":\"A\"},{\"subjectId\":2, \"answer\":\"A\"}]" }); ////var subjectpara = new List() { 1, 2 }; ////var para = JsonConvert.SerializeObject(new { appid = "a", appuserid = "a", papaerid = 1, subject = subjectpara }); ////MessageBox.Show(para); //var res = Utility.PostAjaxData(url, para, Encoding.UTF8); //var url = "http://192.168.11.46:8096/ResSaleRule.svc/Reset"; //var ch = 1000; //var para = new { ch }.ToJson(); //var rsp = Utility.PostAjaxData(url, para, Encoding.UTF8); ////var rsp = Utility.PostData(url + "?ch=1000", Encoding.UTF8); ////var rsp = Utility.HttpPostData(url, "ch=1000", Encoding.UTF8); //var rspObj = JsonConvert.DeserializeAnonymousType(rsp, new { result = false, retcode = 0, retmsg = string.Empty }); //MessageBox.Show(rspObj.ToJson()); //using (StreamReader sr = new StreamReader("C:\\Users\\Administrator\\Desktop\\463_1_1708111651247040\\coursechapter.txt", Encoding.UTF8)) //{ // var str = sr.ReadToEnd(); // var list = str.ToObject>(); // var data = list.Where(p => p.igrade == 1 && p.itype == 1); // using (ExcelPackage package = new ExcelPackage()) // { // ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("exam_subject"); // worksheet.Cells[1, 1].Value = "id"; // worksheet.Cells[1, 2].Value = "itembankid"; // worksheet.Cells[1, 3].Value = "subjecttype"; // worksheet.Cells[1, 4].Value = "subject"; // worksheet.Cells[1, 5].Value = "options"; // worksheet.Cells[1, 6].Value = "rightanswer"; // worksheet.Cells[1, 7].Value = "remark"; // worksheet.Cells[1, 8].Value = "itembanktype"; // var i = 2; // foreach (var item in data) // { // var filename = "C:\\Users\\Administrator\\Desktop\\463_1_1708111651247040\\coursesubject" + item.ichapterid + ".txt"; // using (var file = new StreamReader(filename, Encoding.UTF8)) // { // var subjectList = file.ReadToEnd().ToObject>(); // foreach (var subject in subjectList) // { // var type = 1; // if(subject.ctitle.Contains("Ⅱ") && subject.ctitle.Contains("Ⅲ")) // { // type = 2; // } // var question = subject.cquestion; // question = question.Replace(" B.", "\r\n").Replace(" C.", "\r\n").Replace(" D.", "\r\n").Replace(" B.", "\r\n").Replace(" C.", "\r\n").Replace(" D.", "\r\n"); // question = question.Replace("A:", "").Replace("B:", "").Replace("C:", "").Replace("D:", "").Replace("A.", "").Replace("B.", "").Replace("C.", "").Replace("D.", "").Replace("A.", "").Replace("B.", "").Replace("C.", "").Replace("D.", "").Replace("A、", "").Replace("B、", "").Replace("C、", "").Replace("D、", "").Replace("\r\n", "##"); // worksheet.Cells[i, 1].Value = subject.isubjectid; // worksheet.Cells[i, 2].Value = item.ichapterid; // worksheet.Cells[i, 3].Value = type; // worksheet.Cells[i, 4].Value = subject.ctitle; // worksheet.Cells[i, 5].Value = question; // worksheet.Cells[i, 6].Value = subject.canswer; // worksheet.Cells[i, 7].Value = subject.cdescription; // worksheet.Cells[i, 8].Value = 1; // i++; // } // } // } // using (SaveFileDialog saveFileDialog1 = new SaveFileDialog()) // { // saveFileDialog1.Title = "另存为"; // saveFileDialog1.FileName = "题目.xlsx"; //设置默认另存为的名字,可选 // saveFileDialog1.Filter = "Excel 文件(*.xls)|*.xls|Excel 文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; // saveFileDialog1.AddExtension = true; // if (saveFileDialog1.ShowDialog() == DialogResult.OK) // { // package.SaveAs(new FileInfo(saveFileDialog1.FileName)); // } // } // } //MessageBox.Show(data.ToJson()); //using (ExcelPackage package = new ExcelPackage()) //{ // ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("exam_itembank"); // worksheet.Cells[1, 1].Value = "id"; // worksheet.Cells[1, 2].Value = "title"; // worksheet.Cells[1, 3].Value = "type"; // worksheet.Cells[1, 4].Value = "typname"; // var i = 2; // foreach (var item in data) // { // worksheet.Cells[i, 1].Value = item.ichapterid; // worksheet.Cells[i, 2].Value = item.cchaptername; // worksheet.Cells[i, 3].Value = 2; // worksheet.Cells[i, 4].Value = "基础知识"; // i++; // } // using (SaveFileDialog saveFileDialog1 = new SaveFileDialog()) // { // saveFileDialog1.Title = "另存为"; // saveFileDialog1.FileName = "newExcelName.xlsx"; //设置默认另存为的名字,可选 // saveFileDialog1.Filter = "Excel 文件(*.xls)|*.xls|Excel 文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; // saveFileDialog1.AddExtension = true; // if (saveFileDialog1.ShowDialog() == DialogResult.OK) // { // package.SaveAs(new FileInfo(saveFileDialog1.FileName)); // } // } //} //} //var sysChannel = "27100,27199"; //decimal curChannel = 0; //var channelArr = sysChannel.Split('|'); //var regChannel = 27100; //foreach (var arr in channelArr) //{ // var chs = arr.Split(','); // var minChannel = int.Parse(chs[0]); // var maxChannel = int.Parse(chs[1]); // //MessageBox.Show(minChannel.ToString() + "|" + maxChannel.ToString()); // if (regChannel >= minChannel && regChannel <= maxChannel) // { // curChannel = regChannel; // } //} //MessageBox.Show(curChannel.ToString()); //var name = "二维码已过期"; //var price = "¥9800"; //var productName = "二维码已过期"; //var dituPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ditu.png"); //var wxPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wx.png"); ////var aliPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wx.png"); //var qrcodePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "11.jpg"); //using (Image imgbig = new Bitmap(dituPath)) //{ // using (Graphics g = Graphics.FromImage(imgbig)) // { // //var name_font = new Font("微软雅黑", 60, FontStyle.Bold); // //g.DrawString(name, name_font, Brushes.Black, 40, 80); // //var name_font = new Font("微软雅黑", 30, FontStyle.Bold); // //g.DrawString(name, name_font, Brushes.Black, 40, 80); // var productName_font = new Font("微软雅黑", 60, FontStyle.Bold); // //var productName_format = new StringFormat{ Alignment = StringAlignment.Center }; // SizeF productName_size = g.MeasureString(productName, productName_font); // var productName_x = (imgbig.Width - productName_size.Width) / 2; // var productName_y = (imgbig.Width - productName_size.Height) / 2; // //var productName_y = 200; // g.DrawString(productName, productName_font, Brushes.Orange, productName_x, productName_y); // //var price_font = new Font("微软雅黑", 40, FontStyle.Bold); // //SizeF price_size = g.MeasureString(productName, productName_font); // //var price_x = (imgbig.Width - productName_size.Width) / 2; // ////var productName_y = (imgbig.Width - productName_size.Height) / 2; // //var price_y = 290; // //g.DrawString(price, price_font, Brushes.Black, price_x, price_y); // ////二维码 // //var img = QRCodeHelper.CombinImage(Image.FromFile(qrcodePath), wxPath); // ////计算图片大小 // //float w = imgbig.Width / 4; // //float pw = w / (img.Width * (float)0.6); // //float ph = w / (img.Height * (float)0.6); // //if (pw > ph) // //{ // // pw = ph; // //} // //int mw = (int)(pw * img.Width); // //int mh = (int)(pw * img.Height); // ////计算图片在二维上的x,y坐标 // //int x = (imgbig.Width - mw) / 2; // //int y = (imgbig.Height - mh) / 2 + 80; // //g.DrawImage(img, x, y, mw, mh); // } // imgbig.Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString()) + ".jpg"); //} //var mobile = "13416115228"; //if (!mobile.Contains(",") && mobile.Length > 11) //{ // MessageBox.Show("1"); //} //else //{ // MessageBox.Show("2"); //} //var time = DateTime.Parse("2021/5/1 9:00:00"); //var st = "|" + time.ToShortTimeString() + "|"; //var t = DateTime.Parse(DateTime.Now.ToShortDateString() + " " + (string.IsNullOrEmpty(time.ToShortTimeString()) ? "00:00:00" : time.ToShortTimeString())).AddDays(1); //MessageBox.Show(st.ToString()); //var url = "http://localhost:18739/WeiXinService.svc/WeWorkAssignStatus/put"; //var t = new { appid = "ww89347c2378b6e050", userid = "SanBu1401", status = 3, errcode = -1, ch = 1000 }; //var rep = Utility.PostAjaxData(url, t.ToJson(), Encoding.UTF8); //MessageBox.Show(rep.ToJson()); //var obj = Utility.JSONToObject(rep); //var model = new CRM.Core.DTO.Res.AssignStatusDto() { // appid = "ww89347c2378b6e050", // userid = "SanBu1401", // status = 4, // errcode = 400, // ch = 1000 //}; //string json = Utility.ConvertToJSON(model); //json = new SecurityHelper().createSignEncodingStr(json); //string url = "http://192.168.11.46:8096/WeWorkService.svc/AssignStatus/Set"; //string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8); //var url = "http://sys.hc.dn8188.com/Work/getqr.html"; //var rsp = Utility.PostAjaxData(url, new { appid = "ww89347c2378b6e050", userid = "CaoPing01" }.ToJson(), Encoding.UTF8); //MessageBox.Show(rsp); //var lastCode = "Q2002201"; //var prefix = lastCode.Substring(0, 5); //var suffix = lastCode.Substring(5, lastCode.Length - 5); //MessageBox.Show("prefix:" + prefix + "---suffix:" + suffix); //var url = "http://192.168.11.46:8096/ResourceService.svc/Activity/Add"; //var para = new { tag = "test001", tagname = "测试001", ch = 1000 }.ToJson(); //var rsp = Utility.PostAjaxData(url, para, Encoding.UTF8); //MessageBox.Show(rsp); //var content = HttpUtility.UrlEncode("8fYIIKMSFVzOkfq4Rb8cxexjib9XKnBPRijYcQwZRsFyHSSN4LcMjbW/VevE1iST71iWy+dEiZ2IAV+yp6xmWrA0uvuCxVc7SP7OEDCm773ZrhymqbBBgMWp3hOXi+3naw6BcrRXY8sNfSTxTEPpjbI5so70ySp2oimmAQ0+x4ibIAyB17FdSytgM1n/7HQFxvywECj5qM9L5rnEtwihTLk434PZakz+GHBd3BGgxRQpvI6rFO5MOIZdOydQLL0rMlJraHfc2campw6Vi9nNvCpTkavqSx2g4TWlb07Hm3vYXUJAgd1GSJD7Q5JQ0LRB"); //var clientid = "UPWEBSITE"; //var sign = HttpUtility.UrlEncode("CojDhNj9GtKjHUpN/kMt0Q=="); //var para = "content=" + content + "&clientid=" + clientid + "&sign=" + sign; //var time = (long)Utility.ConvertDateTimeInt(DateTime.Now); //var message = JsonConvert.SerializeObject(new { account = "dn.crm", time }); //var para = new SecurityHelper().createSignEncodingStr(message); //var assignUrl = "http://post.hc.dn8188.com/Rights/assign.html"; //var assign = new AssignQuery("dn0375611", 2153, 2153, "4_reg"); //var rsp = Utility.HttpPostData(assignUrl + "?" + para, assign.ToJson(), Encoding.UTF8); //var ret = JsonConvert.DeserializeObject(rsp); //LogHelper.Info("获取分配" + ret.ToJson()); //MessageBox.Show(ret.ToJson()); //Dictionary gyjList = new Dictionary() { { "1175", 0 }, { "1181", 0 } }; ////Dictionary gyjList = new Dictionary() { { "1175", 3980 }, { "1181", 31572 } }; //OrderModuleDto order = new OrderModuleDto() { moduleid = "1175", opendays = 30 }; //List orderItem = new List() { new OrderModuleDto() { moduleid = "1181", opendays = 90 }, new OrderModuleDto() { moduleid = "1175", opendays = 30 } }; //decimal orderPrice = 8888; //decimal shengyuPrice = 0; //decimal modulePrice = 0; ////分母 //decimal deno = 0; ////分子 //decimal num = 0; //foreach (var item in orderItem) //{ // decimal gyj = 0; // if (gyjList.TryGetValue(item.moduleid, out gyj)) // { // //找到模块公允价 // //var gyj = gyjList.First(p => p.Key == item.moduleid).Value; // if (gyj == 0) // { // gyj = orderPrice + shengyuPrice; // } // //公允价*时长 // deno += gyj * item.opendays.Value; // } // else // { // //deno = 1; // deno += 1 * item.opendays.Value == 0 ? 1 : item.opendays.Value; // } //} //if (gyjList.ContainsKey(order.moduleid)) //{ // //找到模块公允价 // decimal gyj = 0; // //var gyj = gyjList.First(p => p.Key == order.moduleid).Value; // if (gyjList.TryGetValue(order.moduleid, out gyj)) // { // if (gyj == 0) // { // gyj = orderPrice + shengyuPrice; // } // } // //公允价*时长 // num = (orderPrice + shengyuPrice) * gyj * order.opendays.Value; // modulePrice = Convert.ToDecimal(num) / Convert.ToDecimal(Convert.ToDecimal(deno == 0 ? 1 : deno)); //} //else //{ // if (order.opendays.Value == 0) // order.opendays = 1; // modulePrice = Convert.ToDecimal(orderPrice + shengyuPrice) * (order.opendays.Value / deno); //} //MessageBox.Show(modulePrice.ToString()); //var aa = new List() { 10 }; //var bb = 0; //if (aa != null && aa.Any()) //{ // bb = aa.Max(p => p); //} //var cc = bb + 1; //MessageBox.Show(bb.ToString()); //MessageBox.Show(cc.ToString()); //var key = "1633a92d"; //var str = "1005608116080815" + "100" + "2022-08-10 15:52:00" + "1660118006000" + key; //MessageBox.Show(str); //EncDecUtil util = new EncDecUtil(); //var sign = util.signData(str, key); ////var sign = HmacMD5(str, key); //MessageBox.Show(sign.ToString()); //var content = "{\"szzyOrderId\":\"1002611116111710\",\"findalTime\":1668148112369}"; //var dto = JsonConvert.DeserializeAnonymousType(content, new { szzyOrderId = string.Empty, findalTime = Int64.MinValue }); //MessageBox.Show(dto.ToJson()); //var findaltime = DateTimeTool.GetTimeFromLinuxTime(dto.findalTime); //MessageBox.Show(findaltime.ToString()); //"g6lOqRTcz6I9OoK1dpRwAw ==" //var time = DateTimeTool.ConvertDateTimeLong(DateTime.Now); //MessageBox.Show(time.ToString()); //http://onsprocuct.soft.dn8188.com/commonTransfer var data = new { depprice = 9632.89, channel = 26001, mobile = "13806188267", orderuselist = new List { new ptorder { szzyOrderId = "1048805168053212" } } }; var obj = new { data, url = "http://qm.dn8188.com:8096/OrderPayService.svc/OrderPay/Use" }; var para = new SecurityHelper().createSignEncodingStr(obj.ToJson(), "PT1WEBSITE"); MessageBox.Show(para); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } public class ptorder { public string szzyOrderId { get; set; } } private void button2_Click(object sender, EventArgs e) { WX_RCONTACT_BL _rcontact = new WX_RCONTACT_BL(); var ret = true; decimal pici = _rcontact.extractToBeFriendsDataFromMsg(2, "wxid_jo5nnmegwumv21", "wxid_d39x3018s3m812", DateTimeTool.GetTimeFromLinuxTime(1482917638000), ref ret); } private void button3_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); Dictionary dic = new Dictionary(); RES_RESOURCEMOBILE_BL mobilebl = new RES_RESOURCEMOBILE_BL(); while ((line = sr.ReadLine()) != null) { string mobile = line.ToString(); //string phone = Utility.GetMobile(line.ToString()); if (string.IsNullOrWhiteSpace(mobile)) { continue; } mobileList.Add(mobile.Trim()); } using (ExcelPackage package = new ExcelPackage()) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("test"); worksheet.Cells[1, 1].Value = "手机号"; worksheet.Cells[1, 2].Value = "resid"; worksheet.Cells[1, 3].Value = "加密手机号码"; worksheet.Cells[1, 4].Value = "星号手机号码"; var i = 2; foreach (var item in mobileList) { worksheet.Cells[i, 1].Value = item; worksheet.Cells[i, 2].Value = ResUtil.CreateResId(item); worksheet.Cells[i, 3].Value = new SecurityHelper().encyptData(clientid, item); worksheet.Cells[i, 4].Value = Utility.NumberFormat(item); i++; } using (SaveFileDialog saveFileDialog1 = new SaveFileDialog()) { saveFileDialog1.Title = "另存为"; saveFileDialog1.FileName = "newExcelName.xlsx"; //设置默认另存为的名字,可选 saveFileDialog1.Filter = "Excel 文件(*.xls)|*.xls|Excel 文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; saveFileDialog1.AddExtension = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { package.SaveAs(new FileInfo(saveFileDialog1.FileName)); } } } } } private void button4_Click(object sender, EventArgs e) { Wx_MsgConfig msg = new WX_RCONTACT_BL().GetMsgConfig("wxid_z8hkvrx4h2l322"); } private void btnUpload_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); Dictionary dic = new Dictionary(); while ((line = sr.ReadLine()) != null) { string phone = Utility.GetMobile(line.ToString()); if (string.IsNullOrWhiteSpace(phone)) { continue; } if (!dic.ContainsKey(phone)) { mobileList.Add(phone); dic.Add(phone, phone); } } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } private void button18_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); Dictionary dic = new Dictionary(); RES_RESOURCEMOBILE_BL mobilebl = new RES_RESOURCEMOBILE_BL(); while ((line = sr.ReadLine()) != null) { string resid = line.ToString(); //string phone = Utility.GetMobile(line.ToString()); if (string.IsNullOrWhiteSpace(resid)) { continue; } //try //{ // string phone = mobilebl.GetNumberByResId(resid.Trim());//手机号解密 // //if (!dic.ContainsKey(phone)) // //{ // mobileList.Add(phone); //} //catch (Exception ex) //{ // LogHelper.Info("出错resid:" + resid); //} //// dic.Add(phone, phone); ////} mobileList.Add(resid); } mobileList = mobilebl.GetNumberByResIdList(mobileList).ToList(); SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } private void button5_Click(object sender, EventArgs e) { try { //var alive = new alive() //{ // username = "test", // lasttime = DateTime.Now.ToString() //}; var url = "http://192.168.1.45:809/WxMessageSvr.svc/TSExecInfo/Put"; WebClient webClient = new WebClient(); webClient.Encoding = Encoding.UTF8; webClient.Headers[HttpRequestHeader.ContentType] = "application/json"; //string result = webClient.UploadString(url, "POST", JsonConvert.SerializeObject(alive)); string result = webClient.UploadString(url, "POST", "{\"endTime\":0,\"isEnd\":0,\"isStart\":1,\"pici\":1206136209,\"starttime\":1516094559724}"); textBox1.Text = result; } catch (Exception ex) { LogHelper.Error(ex.ToString()); } } private void button6_Click(object sender, EventArgs e) { string number = textBox2.Text; bool xx = Utility.CheckIsNum(number); textBox2.Text += xx; } private void button7_Click(object sender, EventArgs e) { new Wx_DbRead().StartRead(); } private void button8_Click(object sender, EventArgs e) { textBox4.Text = ResUtil.CreateResId(textBox3.Text); } private void button9_Click(object sender, EventArgs e) { //new VipMobileToMySql().SatartInsert(); } private void button10_Click(object sender, EventArgs e) { //WSMG984VTfLKhFCfJh3mF20SaYp6IsFReQSCeo7c9zvimPfuFeUw1AJvUH8Mj+vZt01cnGUWoBthdHUfLRYrjwNoZa7YhvcN1OJQDtn30Gd5t0YbJSFEj84EIFh/iu0LUnlOba013+XWaKaikUiH830YxG+jU2qs0SaREh0hR64RE0ejkrIzAApjsl8WPYiCM6ybgipBla0/WIMFF8UJZIPXc6uW8vBGvynSyNsq90o=&clientid=UPWEBSITE&sign=pFS+IHDK0XNMXegM0z4ddw== //bool isTrue = new SecurityHelper().CheckClientValid("TDORDERSITE", "WSMG984VTfLKhFCfJh3mF20SaYp6IsFReQSCeo7c9zvimPfuFeUw1AJvUH8Mj+vZt01cnGUWoBthdHUfLRYrjwNoZa7YhvcN1OJQDtn30Gd5t0YbJSFEj84EIFh/iu0LUnlOba013+XWaKaikUiH830YxG+jU2qs0SaREh0hR64RE0ejkrIzAApjsl8WPYiCM6ybgipBla0/WIMFF8UJZIPXc6uW8vBGvynSyNsq90o=", "pFS+IHDK0XNMXegM0z4ddw=="); string jiema = new SecurityHelper().decyptData("UPWEBSITE", "8fYIIKMSFVwfb1Z7PLyAQ+Q9hI1wsOpcPqSC///xauhfLDtzJHfiBOvKwiAndm6JHl2x4z+rF5zJ6hdCXJgQ1TFzMQDdBNN/uRESfmPwAgoeaUpeEuqUm3mGRksVDQzboZZL/K0KkC70ukVAiDf2gaGpMxbnnIfnkYS8bW332EJBRrPc1QSF0wuPhFgah2Ae18DMRL0MpRIDyQL3gD/trmHYIkGknYXpJrPtnDZoEsEaT82H4iUJ2w=="); string ssd = jiema; //SecurityHelper sHelper =new SecurityHelper(); //string xxx = sHelper.decyptData("nj_crm", "fNZuPpG7nMK44T1fIOkL6g=="); //解密操作 //string sdfs = ""; //sdfs += "sdf"; } private void button11_Click(object sender, EventArgs e) { //new SendCrmMsg().Send(); var msg = "测试测试"; var mobile = "13416115228"; var url = "http://localhost:55047/SmsService.svc/PutSms"; var resid = ResUtil.CreateResId(mobile); //var para = "message=" + msg + "&resid=" + resid + "&mobile=" + mobile; var para = JsonConvert.SerializeObject(new { message = msg, resid = resid, mobile = mobile }); var res = Utility.PostAjaxData(url, para, Encoding.UTF8); MessageBox.Show(res); } private void button12_Click(object sender, EventArgs e) { //new SendBatchMsg().Send(); } private void button13_Click(object sender, EventArgs e) { string content = ""; int status = 200; try { SQLiteConnection cnn = new SQLiteConnection(); string dbfile = @"z:\dbuploadfile\20185\wxid_zrbb461j7p1c22-909ec4c-180524020129.db"; //string dbfile = @"\\192.168.1.171\weixin\dbuploadfile\20185\wxid_zrbb461j7p1c22-909ec4c-180524020129.db"; cnn.ConnectionString = "Data Source=" + dbfile; cnn.Open(); #region rcontact 读取 try { string sql = @" select username,alias,chatroomFlag ,conRemark ,domainList ,nickname ,pyInitial ,quanPin ,showHead ,type ,weiboFlag , weiboNickname ,conRemarkPYFull ,conRemarkPYShort ,verifyFlag ,encryptUsername ,deleteFlag , contactLabelIds,ifnull((select min(createtime)/1000 from message x where x.talker=a.username),strftime('%s','now'))ctime from rcontact a where a.type!=33 and a.username not like'gh_%' and a.username not like'%@chatroom' and a.username not like'%@stranger' and a.username !='filehelper' and a.type in(1,3,5,7,257) "; //用SQLite Expert管理器看表或者CMD看 SQLiteCommand cmd = cnn.CreateCommand(); cmd.CommandText = sql; SQLiteDataReader reader = cmd.ExecuteReader(); List rcontactList = new List(); string w = " "; StringBuilder build = new StringBuilder(); try { while (reader.Read()) { rcontact model = new rcontact(); model.username = reader.GetString(0); build.Append("1" + w); build.Append(model.username + w);// model.alias = reader.GetString(1); build.Append(model.alias + w);// model.chatroomFlag = reader.GetInt64(2); model.domainList = reader.GetString(4); model.nickname = reader.GetString(5); build.Append(model.nickname + w);// model.conRemark = reader.GetString(3); build.AppendLine(model.conRemark + w);// model.pyInitial = reader.GetString(6); model.quanPin = reader.GetString(7); model.showHead = reader.GetInt64(8); model.type = reader.GetInt64(9); model.weiboFlag = reader.GetInt64(10); model.weiboNickname = reader.GetString(11); model.conRemarkPYFull = reader.GetString(12); model.conRemarkPYShort = reader.GetString(13); model.verifyFlag = reader.GetInt64(14); model.encryptUsername = reader.GetString(15); model.deleteFlag = reader.GetInt64(16); model.contactLabelIds = reader.GetString(17); model.ctime = Convert.ToInt64(reader.GetValue(18)); rcontactList.Add(model); } } catch (Exception xs) { content += "[读取rcontact出错]"; status = 100; LogHelper.Error("rcontact数据读取错误:" + xs.ToString()); } finally { reader.Close(); } textBox5.Text = build.ToString(); } catch (Exception xx) { status = 100; content += "[读取rcontact出错]"; LogHelper.Error(xx.ToString()); } #endregion rcontact 读取 cnn.Close(); } catch (Exception xs) { status = 100; content += "[直接报错]"; LogHelper.Error(xs.ToString()); } } private void button14_Click(object sender, EventArgs e) { try { StringBuilder sub = new StringBuilder(); DateTime time = Convert.ToDateTime("2017/3/20 9:08:17"); List list = new List(); SecurityHelper shelper = new SecurityHelper(); using (crmContext db = new crmContext()) { list = db.ISVR_INTERFACECALLLOG.Where(m => m.CLIENTURL == "ResourceService/JoinActive" && m.CTIME >= time).OrderByDescending(m => m.CTIME).ToList(); } string w = " "; foreach (ISVR_INTERFACECALLLOG item in list) { sub.Append("1" + w); string content = shelper.decyptData("TDORDERSITE", item.CLIENTKEY.Substring(0, item.CLIENTKEY.IndexOf("&clientid="))); var model = JsonDivertToObj(content); sub.Append(model.username + w); sub.Append(model.mobile + w); sub.Append(model.kword + w); sub.Append(ResUtil.CreateResId(model.mobile) + w); //sub.AppendLine(content); sub.AppendLine(item.CTIME.Value.ToString("yyyy/MM/dd hh:mm:ss")); } textBox5.Text = sub.ToString(); } catch (Exception ex) { textBox5.Text = ex.ToString(); } } public static T JsonDivertToObj(string json) { JavaScriptSerializer script = new JavaScriptSerializer(); T dic = script.Deserialize(json); return dic; } private void button15_Click(object sender, EventArgs e) { //new SendCrmMsg().Send(); } private void button16_Click(object sender, EventArgs e) { SecurityHelper sHelper = new SecurityHelper(); long mobile = 15100000700; int carNo = 11600700; for (int i = 700; i < 750; i++) { mobile++; carNo++; SyncRegUserModel activeModel = new SyncRegUserModel(); activeModel.campaignId = "26300"; activeModel.companyId = 500; activeModel.mobile = "mobile"; activeModel.platform = "P"; activeModel.regDate = DateTime.Now; activeModel.userCardNo = carNo.ToString(); activeModel.username = "cs00_" + i; activeModel.mobile = mobile.ToString(); string json = Utility.ConvertToJSON(activeModel); json = sHelper.createSignEncodingStr(json); string url = "http://192.168.1.45:806/ResourceService.svc/SyncRegUserChangSha"; string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8); //Utility.GetStream(retmsg); } } private void button17_Click(object sender, EventArgs e) { string num = textBox6.Text; num = num.Replace("+86", ""); if (num.Length == 12 && num.StartsWith("01"))//长度必须是12位,且是01开头,必然是手机号,去除前面的0 { num = num.Substring(num.Length - 11, 11); } else if (num.Length > 12)//大于12位的,取后面的11位 { num = num.Substring(num.Length - 11, 11); }//小于等于11的不做处理 textBox7.Text = num; } private void button19_Click(object sender, EventArgs e) { string url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=8T9Mtqz5nRLl1ZH5_wMzuEMnd92DUTXJUr9JcpyupwZVlO7R0ncj7uXpW-aTE_7vX4kmzTvvGjzFrrzNbDRHbGd7o7akfC6hkyJUvjlzAaOulgFVYZfNLpSlOneIYB4YIHYcAAAEDU"; SuCai sucai = new SuCai(); sucai.count = 20; sucai.offset = 0; sucai.type = "image"; string resultJson = RequestHelper.CreatePostGetString(url, JsonConvert.SerializeObject(sucai), null, "", Encoding.UTF8, null); LogHelper.Info("返回值:" + resultJson); } private void button20_Click(object sender, EventArgs e) { try { string xxx = textBox5.Text; web_push_wxUserServiceModel t = JsonConvert.DeserializeObject(xxx); DateTime time = DateTimeTool.GetTimeFromLinuxShortTime(t.SubscribeTime); new WX_UserInfo_BL().weapp_userinfo_Storage(t.OpenId, t.NickName, t.Gender, t.Language, t.City, t.Province, t.Country, t.AvatarUrl, t.Type, t.UnionId, t.Subscribe, time, t.AccountNum); } catch (Exception ex) { } } private void button21_Click(object sender, EventArgs e) { try { string url = "http://192.168.1.132:7099/WxMessageSvr/AppletMsg?signature=697704691c8e3b8abe145eb28576411ec30bd54c×tamp=1501724222&nonce=1941521468"; string result = WebClientRequest(url, "{\"ToUserName\":\"gh_096d7b6a4e5e\",\"FromUserName\":\"oV5div1PbGhFRbCliW7tqJEA-sac\",\"CreateTime\":1501724222,\"MsgType\":\"text\",\"Content\":\"9999\",\"Event\":null,\"EventKey\":null,\"Ticket\":null,\"Latitude\":null,\"Longitude\":null,\"Precision\":null,\"MsgId\":6449856421516440225,\"PicUrl\":null,\"MediaId\":null}", Encoding.UTF8); } catch (Exception exx) { } } public static string WebClientRequest(string url, string postData, Encoding coding, string method = "POST") { WebClient webClient = new WebClient(); webClient.Encoding = coding; webClient.Headers[HttpRequestHeader.ContentType] = "application/json"; string result = webClient.UploadString(url, method, postData.ToString()); return result; } /// /// 提取数据库不存在数据 /// /// /// private void button22_Click(object sender, EventArgs e) { try { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; RES_RESOURCEMOBILE_BL mobilebl = new RES_RESOURCEMOBILE_BL(); List phoneList = new List(); Dictionary dicc = new Dictionary(); while ((line = sr.ReadLine()) != null) { try { string phone = line.ToString(); if (string.IsNullOrWhiteSpace(phone)) { continue; } string resid = ResUtil.CreateResId(phone); PhoneLogModel phoneLogModel = new PhoneLogModel { Method = System.Reflection.MethodBase.GetCurrentMethod().Name, userid = 0 }; string nphone = mobilebl.GetNumberByResId(resid, phoneLogModel);//手机号解密 if (string.IsNullOrEmpty(nphone)) { if (!dicc.ContainsKey(phone)) { dicc.Add(phone, phone); } //phoneList.Add(phone); } } catch (Exception sd) { } } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in dicc) { sw.WriteLine(item.Key); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } catch (Exception exs) { } } private void button23_Click(object sender, EventArgs e) { try { string dir = "E:\\phone"; DirectoryInfo d = new DirectoryInfo(dir); FileSystemInfo[] fsinfos = d.GetFileSystemInfos(); Dictionary dic = new Dictionary(); List mobileList = new List(); foreach (FileSystemInfo fsinfo in fsinfos) { string filename = fsinfo.FullName;//输出文件的全部路径 StreamReader sr = new StreamReader(filename, Encoding.Default); String line; while ((line = sr.ReadLine()) != null) { string phone = Utility.GetMobile(line.ToString()); if (string.IsNullOrWhiteSpace(phone)) { continue; } if (!dic.ContainsKey(phone)) { mobileList.Add(phone); dic.Add(phone, phone); } } } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(ResUtil.CreateResId(item)); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } catch (Exception ex) { } } private void button24_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); while ((line = sr.ReadLine()) != null) { string phone = line.ToString(); if (string.IsNullOrWhiteSpace(phone)) { continue; } //mobileList.Add(phone + "," + ResUtil.CreateResId(phone)); mobileList.Add(ResUtil.CreateResId(phone)); } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } private void button25_Click(object sender, EventArgs e) { new ResTool.TS.TSSendRes().StartPush(); } private void button26_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); while ((line = sr.ReadLine()) != null) { string phone = line.ToString(); if (string.IsNullOrWhiteSpace(phone)) { continue; } //mobileList.Add(phone + "," + ResUtil.CreateResId(phone)); mobileList.Add(UserMd5(phone)); } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } private string UserMd5(string str) { string cl = str; string pwd = ""; MD5 md5 = MD5.Create();//实例化一个md5对像 // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择  byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl)); // 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得 for (int i = 0; i < s.Length; i++) { // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符 pwd = pwd + s[i].ToString("x2"); } return pwd; } private void button27_Click(object sender, EventArgs e) { string xxx = textBox1.Text; if (IsNumber(xxx)) { MessageBox.Show("数字!"); } else { MessageBox.Show("非数字!"); } } /// /// 判断字符串是否是数字 /// public static bool IsNumber(string s) { if (string.IsNullOrWhiteSpace(s)) return false; const string pattern = "^[0-9]*$"; Regex rx = new Regex(pattern); return rx.IsMatch(s); } private void button28_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); List list = new List(); String line; string mobile = string.Empty; while ((line = sr.ReadLine()) != null) { mobile = line.Trim(); //if (string.IsNullOrWhiteSpace(mobile)) //{ // continue; //} var resInfo = new ResInitInfo { CNumber = sHelper.encyptData(clientid, mobile), //CNumber = string.Empty, ResId = ResUtil.CreateResId(mobile), //ResId = string.Empty, CustomerFrom = "Z0001001", ECNumber = Utility.NumberFormat(mobile) }; list.Add(resInfo); } //new OracleBulk_DAL().OracleBulkInsert("A_RES_INIT", Utility.ToOracleDataTable(list)); OracleHelper.OracleBulkInsert("A_RES_INIT", Utility.ToOracleDataTable(list)); MessageBox.Show("执行完成"); } } private void button29_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; string mobile = string.Empty; while ((line = sr.ReadLine()) != null) { mobile = line.Trim(); //if (string.IsNullOrWhiteSpace(mobile)) //{ // continue; //} if (!Utility.ChekMobile(mobile)) { MessageBox.Show(mobile); } } } } private void button30_Click(object sender, EventArgs e) { var path = @"C:\Users\Administrator\Desktop\22.jpg"; WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); wc.QueryString["fileName"] = "22.jpg"; byte[] buffer = wc.UploadFile(new Uri(@"http://192.168.1.132:8099/WxFileUpload2.ashx"), "POST", path); var msg = Encoding.UTF8.GetString(buffer); MessageBox.Show(msg); } private void button31_Click(object sender, EventArgs e) { var url = "/audio/439a71df5d8d41cf2fb84bdee1acb6b9.amr"; //var url = "/audio/439a71df5d8d41cf2fb84bdee1acb6b9.amr"; var webPath = Path.Combine(FileUnit.GetBaseDirectory(), "audio"); var exePath = Path.Combine(FileUnit.GetBaseDirectory(), "silk2mp3"); var fileNameWithoutExt = Path.GetFileNameWithoutExtension(url); var armPath = Path.Combine(webPath, "439a71df5d8d41cf2fb84bdee1acb6b9.amr"); var targetFileNamePcm = Path.Combine(webPath, fileNameWithoutExt + ".pcm"); var targetFileNameMp3 = Path.Combine(webPath, fileNameWithoutExt + ".mp3"); if (!System.IO.File.Exists(targetFileNameMp3)) { SilkConvertToMp3 amr = new SilkConvertToMp3(); amr.ConvertToPcm(exePath, armPath, targetFileNamePcm); //amr.ConvertToMp3(exePath, targetFileNamePcm, targetFileNameMp3); if (System.IO.File.Exists(targetFileNamePcm)) { amr.ConvertToMp3(exePath, targetFileNamePcm, targetFileNameMp3); } else { amr.ConvertAmrToMp3(exePath, armPath, targetFileNameMp3); } } MessageBox.Show("ok"); } private void button32_Click(object sender, EventArgs e) { //string enkey = WX.CRM.Common.Utility.GetSettingByKey("CRMClientKey"); var enkey = "UPWEBSITE"; var clientid = WX.Interface.Security.ClientKey.GetClientKey(enkey); var sHelper = new WX.Interface.Security.EncDecUtil(); var result = sHelper.encyptData(textBox8.Text, clientid.AccessKey); textBox9.Text = result; } private void button33_Click(object sender, EventArgs e) { //string enkey = WX.CRM.Common.Utility.GetSettingByKey("CRMClientKey"); var enkey = "UPWEBSITE"; //var enkey = "TDORDERSITE"; var clientid = WX.Interface.Security.ClientKey.GetClientKey(enkey); var sHelper = new WX.Interface.Security.EncDecUtil(); var result = sHelper.decyptData(textBox8.Text, clientid.AccessKey); textBox9.Text = result; } private void button34_Click(object sender, EventArgs e) { //var d1 = dateTimePicker1.Value.ToShortDateString(); //var d2 = dateTimePicker2.Value.ToShortDateString(); //var sql = "select distinct FileName,FileUrl from wx_filepath where CTime >= '" + d1 + "' and CTime < '" + d2 + "' and FileName not like 'wx:-%'"; //var ds = SqlHelper.Query(SqlHelper.DatabaseType.AYCRM, sql); //var dt = ds.Tables[0]; //var dic = new Dictionary(); //foreach (DataRow item in dt.Rows) //{ // //RedisString redis = new RedisString("wx:" + item[0].ToString()); // //redis.Set(item[1].ToString()); // if (!dic.ContainsKey(item[0].ToString())) // { // dic.Add(item[0].ToString(), item[1].ToString()); // } //} //var db = new RedisString(); //var result = db.StringBatch(dic); //MessageBox.Show(result ? "执行成功" : "执行失败"); } private void button35_Click(object sender, EventArgs e) { //var d1 = dateTimePicker1.Value.ToShortDateString(); //var d2 = dateTimePicker2.Value.ToShortDateString(); //try //{ // var dd = dateTimePicker1.Value; // var dd2 = dateTimePicker2.Value; // while (true) // { // if (dd2.Year < dd.Year) // { // MessageBox.Show("时间选择错误!"); // break; // } // var yearMonth = dd.ToString("yyyyMM"); // var sql = "select m.msgSvrId,m.username from wx_message" + yearMonth + " m where exists(select 1 from a_username3 a where a.username = m.username)"; // MessageBox.Show(sql); // var ds = SqlHelper.Query(SqlHelper.DatabaseType.AYCRM, sql); // var dt = ds.Tables[0]; // var fix = "wxmsgid:"; // var dic = new Dictionary(); // foreach (DataRow item in dt.Rows) // { // var key = fix + item[0].ToString() + "|" + item[1].ToString(); // if (!dic.ContainsKey(key)) // { // dic.Add(key, string.Empty); // } // } // var db = new RedisString(); // var result = db.StringBatch(dic); // MessageBox.Show(result ? "执行成功" : "执行失败"); // if (dd2.Year > dd.Year) // { // dd = dd.AddMonths(1); // } // else if (dd2.Year == dd.Year) // { // if (dd2.Month > dd.Month) // { // dd = dd.AddMonths(1); // } // else // { // break; // } // } // else // { // MessageBox.Show("时间选择错误!"); // } // } //} //catch (Exception ex) //{ // LogHelper.Error(ex.ToString()); //} //var sql = "select msgSvrId,username from wx_gen_message where cTime >= '" + d1 + "' and cTime < '" + d2 + "'"; //var ds = SqlHelper.Query(SqlHelper.DatabaseType.AYCRM, sql); //var dt = ds.Tables[0]; //var fix = "wxmsgid:"; //var dic = new Dictionary(); //foreach (DataRow item in dt.Rows) //{ // var key = fix + item[0].ToString() + "|" + item[1].ToString(); // if (!dic.ContainsKey(key)) // { // dic.Add(key, string.Empty); // } //} //var db = new RedisString(); //var result = db.StringBatch(dic); //MessageBox.Show(result ? "执行成功" : "执行失败"); } private void button36_Click(object sender, EventArgs e) { //var _url = "http://192.168.1.68/goip_post_sms.html?username=root&password=root"; //var _url = "http://localhost:10229/WebTest"; var _url = "http://localhost:10229/WebTest"; var para = "{\"type\":\"send-sms\",\"task_num\":1,\"tasks\":[{\"tid\":1,\"from\":\"1\",\"to\":\"13416115228\",\"sms\":\"测试短信\"}]}"; HttpWebRequest request = null; request = WebRequest.Create(_url) as HttpWebRequest; request.Method = "POST"; request.ContentType = "application/json;charset=utf-8"; // request.ContentType = "application/json"; //如果需要POST数据 if (!string.IsNullOrEmpty(para)) { byte[] data = Encoding.UTF8.GetBytes(para.ToString()); request.ContentLength = data.Length; using (Stream stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } } using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); string result = reader.ReadToEnd(); MessageBox.Show(result); } } private void button37_Click(object sender, EventArgs e) { SecurityHelper sHelper = new SecurityHelper(); //string clientid = "TDORDERSITE"; //string content = "WSMG984VTfIWoRsi/ip/7AVY8/oVwxnwhqM/kUdhN14wDPsOJMK9JRagEp95wJVWSuKiy0UWosnvxKhKBuo6+rMUTQ1IN2GaP1IdMC2aBT/1y7uXZc4SDFm+uWiudBG/TNYbl0muM7i3QhxAFZJMjWljlvMZ8JP1opU1U5j0jOIBqypxyGVhX+ix89ZRnXlNb7sLccOg3DU="; var clientid = "UPWEBSITE"; var content = "delvAlmupXkNIYzx75OcSzeE8\\/t07dG3IqLY0reM\\/plP1nV37r4r2A=="; //content = HttpUtility.UrlDecode(content); content = sHelper.decyptData(clientid, content); //解密操作 MessageBox.Show(content); } private void button38_Click(object sender, EventArgs e) { new SSO_Organization_BL().StartDownLoad(); return; string clientid = "TDORDERSITE"; SecurityHelper sHelper2 = new SecurityHelper(); var json = "{\"orderid\":\"1781711217110817\",\"htid\":\"DN1781711217110817\",\"ip\":\"\"}"; var url3 = "http://localhost:55047/OrderService.svc/Contract/SignRet"; string content3 = sHelper2.encyptData(clientid, json); string sign3 = sHelper2.signData(clientid, content3); url3 += "?" + "content=" + HttpUtility.UrlEncode(content3) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign3); var qq3 = Utility.PostData(url3, Encoding.UTF8); /* var jsonbody = new { name = "CRM", mobile = "18200000000" }; MSecurityHelper sHelper = new MSecurityHelper(); var json = jsonbody.ToJson(); var content = sHelper.content(json); //解密操作 var sign = sHelper.sign(content); var headers = new Dictionary(); headers.Add("content", content); headers.Add("sign", sign); var postdata = new { name = "CRM", content = content, sign = sign }; //需要做成配置 var url = "http://10.111.10.145:9000/encrypt"; var urlResult = Utility.PostAjaxData(url, postdata.ToJson(), headers, Encoding.UTF8); var sss = JsonHelper.FromJson(urlResult); var sss22 = sHelper.decyptSign(sss.sign, sss.content);*/ return; var act_Bl = new WX.CRM.CRMServices.Res_AlloCate.WwHhuserAct(); act_Bl.Start(); //return; //string clientid = "TDORDERSITE"; //SecurityHelper sHelper2 = new SecurityHelper(); //var setEid = new //{ // Appid = "wwd4cd11d60db47118", // Userid = "230222-091112-16", // Ch = 7000, // Eid = 4051, // DeptId = 32 //}; //var url3 = "http://localhost:55047/WeWorkService.svc/WeWork/SetEid"; //string json3 = setEid.ToJson(); //string content3 = sHelper2.encyptData(clientid, json3); //string sign3 = sHelper2.signData(clientid, content3); //url3 += "?" + "content=" + HttpUtility.UrlEncode(content3) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign3); //var qq3 = Utility.PostData(url3, Encoding.UTF8); //string clientid = "TDORDERSITE"; //SecurityHelper sHelper2 = new SecurityHelper(); //var url22 = "http://localhost:55047/WeWorkService.svc/AssignStatus/Set"; //var t = new { appid = "ww89347c2378b6e050", userid = "SanBu1401", status = 3, assignstatusstatus=4, errcode = -1, ch = 7000 }; //string json22 = t.ToJson(); //string content22 = sHelper2.encyptData(clientid, json22); //string sign22 = sHelper2.signData(clientid, content22); //url22 += "?" + "content=" + HttpUtility.UrlEncode(content22) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign22); //var rep = Utility.PostData(url22, Encoding.UTF8); //MessageBox.Show(rep.ToJson()); //return; //var act_Bl = new WX.CRM.CRMServices.Res_AlloCate.WwHhuserAct(); //act_Bl.ChangeEidStart(); //return; //new SSO_Organization_BL().StartDownLoad(); //string regmobile = "008613709440178"; //regmobile = regmobile.Substring(4); //var url2 = "http://localhost:18739/ResourceService.svc/ChangeMobile"; //var obj = new { // mobile = "18826222483", // newsoftusername = "dn0002341", // type =1 //}; ////string json = "{\"username\":\"13985834619\",\"mobile\":\"13985834222\",\"campaignId\":\"27102\",\"deptcode\":\"TDOEM\",\"datatype\":\"stock\"}"; //string json2 = obj.ToJson(); //string content = sHelper2.encyptData(clientid, json2); //string sign = sHelper2.signData(clientid, content); //url2 += "?" + "content=" + HttpUtility.UrlEncode(content) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign); //var qq = Utility.PostData(url2, Encoding.UTF8); //MessageBox.Show(qq); return; try { //string url = "https://r2.soft.tcfortune.com/order/scgi/create_order"; ////string json = "{\"sProductId\=\"UPCFJC_20181101170549\",\"sUserName\=\"qbj\",\"iCount\=1,\"iBusType\=1,\"iCH\=21001,\"iPlat\=0,\"iSource\=1,\"iProductType\=1,\"sCouponCode\=null,\"sMobile\=\"15112168561\",\"sIP\=null,\"iTotalprice\=5600000,\"iTotaldays\=365,\"sExt1\=null,\"flag\=null,\"sCssId\=\"600000207\",\"iOriginalCH\=0,\"iCurrentCH\=21001,\"iAppversion\=null,\"sSignId\=null,\"iComplianceFlag\=0,\"sProtocolType\=null,\"sXua\=null,\"sGuid\=null}"; //string xx = "sProductId=UPCFJC_20181101170549&sUserName=qbj&iCount=1&iBusType=1&iCH=21001&iPlat=0&iSource=1&iProductType=1&sCouponCode=&sMobile=15112168561&sIP=null&iTotalprice=5600000&iTotaldays=365&sExt1=&flag=null&sCssId=600000207&iOriginalCH=0&iCurrentCH=21001&iAppversion=&sSignId=&iComplianceFlag=0&sProtocolType=&sXua=&sGuid="; //string xx2 = "sProductId=UPCFJC_20181101170549&sUserName=qbj&iCount=1&iBusType=1&iCH=21001&iPlat=0&sMobile=15112168561"; //string xx3 = "productId=UPCFJC_20181101170549&userName=qbj&count=1&busType=1&ch=21001&plat=0&source=1&productType=1&couponCode=&mobile=15112168561&ip=&totalPrice=5600000&totalDays=365&ext1=&flag=&cssId=600000207&originalCH=0¤tCH=21001&appversion=&signId=&complianceFlag=0&protocolType=&xua=&guid="; //string retmsg = Utility.GetData(url, xx3, Encoding.UTF8);//返回信息 //string url = "https://r2.soft.tcfortune.com/order/cgi/open_order"; //string json = "{\"sProductId\=\"UPCFJC_20181101170549\",\"sUserName\=\"qbj\",\"iCount\=1,\"iBusType\=1,\"iCH\=21001,\"iPlat\=0,\"iSource\=1,\"iProductType\=1,\"sCouponCode\=null,\"sMobile\=\"15112168561\",\"sIP\=null,\"iTotalprice\=5600000,\"iTotaldays\=365,\"sExt1\=null,\"flag\=null,\"sCssId\=\"600000207\",\"iOriginalCH\=0,\"iCurrentCH\=21001,\"iAppversion\=null,\"sSignId\=null,\"iComplianceFlag\=0,\"sProtocolType\=null,\"sXua\=null,\"sGuid\=null}"; //string xx4 = "orderId=1837211062110711&payId=1&=payType=1&payPrice=5600000&userName=qbj&couponCode=&isFree=0&payRemark="; //string retmsg = Utility.GetData(url, xx4, Encoding.UTF8);//返回信息 //SecurityHelper sHelper = new SecurityHelper(); //string url = "https://r2.soft.tcfortune.com/order/scgi/refund_order"; //string json = "{\"orderId\":\"xxdsdf码数的法定\"}"; //string clientid = "UPWEBSITE"; //string njson= sHelper.encyptData(clientid,json); //json = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey);//数据参数加密 //string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8);//实现中心点先入库 //string contentUrlEncode = HttpUtility.UrlEncode(content, Encoding.UTF8); //string signUrlEncode = HttpUtility.UrlEncode(sign, Encoding.UTF8); //重置密码 //string url = "https://r2.soft.tcfortune.com/order/scgi/reset_pwd"; //string clientid = "UPWEBSITE"; //string json = "{\"userName\":\"qbj86ddd\"}"; //string content = sHelper.encyptData(clientid, json); //string sign = sHelper.signData(clientid, content); ////bool sss=sHelper.CheckClientValid("UPWEBSITE", "8fYIIKMSFVyhEi1vhWbLOis3Et9DdiYcE/AO/k9FWIY/69V3t4xIkI15n7EGgQSKvRt0EcVULoqnUU6fdODg6fP7tr42Tyr2yInFxJxGkGHNmhNxju+ZvttUEWffqislhlItcHSESCR3SaYST9lvyeDkZ8WRW+umF4QGiq1td5x0egulF4kc4Q==", "+4GPl6YoN30T4X1Bcbvoyg=="); //var maxjson = new //{ // content = content, // clientId = clientid, // sign = sign //}; //string retmss = Utility.PostAjaxData(url, ObjDivertToJson(maxjson), Encoding.UTF8); //风控加密测试 //long longtime = DateTimeTool.ConvertDateTimeLong(DateTime.Now); //string url = "https://r2.soft.tcfortune.com/riskevaluate/pc/newcenter/risk.html?hqr="; //var json = new //{ // uid = "qbj104", // cid = "", // t = longtime, // hqrtime = longtime, // rd = 8086, // u = "0", // r = "[]" //}; //string varx = HttpUtility.UrlEncode(BlowFish.decode(ObjDivertToJson(json))); //url = url + varx; //===合同解密测试 //string content = HttpUtility.UrlDecode("Tze8bh50CYemAC577SJtzDFM%2Bztwn5KL"); //string xxxs = sHelper.decyptData("UPWEBSITE", content); //合同生成URL测试 //string url = "https://r2.soft.tcfortune.com/contract_sign_crm/signcontract" + // ""; //var json = new //{ // productName = "趋势锦囊", // period = "365天", // price = "56000.00元", // userId = "qbj104", // productLevel = 1, // productInvestTime = 1, // productInvestType = 1, // issupplement = 1, // orderId = "1837211142111812", // htid = "UP1837211142111812" //}; //string clientid = "UPWEBSITE"; //string content = sHelper.encyptData(clientid, ObjDivertToJson(json)); //string sign = sHelper.signData(clientid, content); //bool sss=sHelper.CheckClientValid("UPWEBSITE", "8fYIIKMSFVyhEi1vhWbLOis3Et9DdiYcE/AO/k9FWIY/69V3t4xIkI15n7EGgQSKvRt0EcVULoqnUU6fdODg6fP7tr42Tyr2yInFxJxGkGHNmhNxju+ZvttUEWffqislhlItcHSESCR3SaYST9lvyeDkZ8WRW+umF4QGiq1td5x0egulF4kc4Q==", "+4GPl6YoN30T4X1Bcbvoyg=="); //var maxjson = new //{ // content = content, // clientId = clientid, // sign = sign, // protocolType="" //}; //url = url + string.Format("?content={0}&sign={1}&clientId={2}&protocolType=", HttpUtility.UrlEncode(content), HttpUtility.UrlEncode(sign), clientid); //合同pdf测试 //string url = "https://r2.soft.tcfortune.com/contract/contractdetail/趋势锦囊-风险揭示书.pdf?content={0}&sign={1}&clientId=UPWEBSITE"; //string content = sHelper.encyptData(clientid, "R_UP1837211142111317"); //string sign = sHelper.signData(clientid, content); //string xx = string.Format(url, HttpUtility.UrlEncode(content), HttpUtility.UrlEncode(sign)); //string a1= sHelper.decyptData(clientid, HttpUtility.UrlDecode("Tze8bh50CYemAC577SJtzDFM%2Bztwn5KL")); // string a2 = sHelper.decyptData(clientid, HttpUtility.UrlDecode("nPB2qKomfqPECw4O096vKphrDoAwnfMq")); // string a3 = sHelper.decyptData(clientid, HttpUtility.UrlDecode("8OlpqiyQiM7Hwrty97JEeC19%2Fq2BS8lW")); //订单车查询接口测试 /*{ "retCode":10000, "retMsg":"Success", "stOrderInfo":{ "orderid":"1837211072111016", "username":"qbj", "productid":"UPCFJC_20181101170549", "count":1, "totaldays":365, "totalprice":0, "mobile":"", "status":220, "isrefund":0, "bustype":1, "source":2, "plat":0, "ch":21001, "couponid":"", "ip":"172.18.10.70", "cancelinfo":{ "canceluser":"", "canceltime":0, "cancelAmount":0 }, "ctime":1541567634, "ext1":"{\"isFree\":1,\"business_name\":\"趋势锦囊\",\"business_type\":0,\"tradetype\":1,\"payeename\":\"\",\"payerno\":\"20000001\"}","producttype":0,"flag":"","otime":1541567634,"productname":"趋势锦囊" } }*/ /* {"retCode":10000, "retMsg":"Success", "stOrderInfo":{ "orderid":"1837211122111315", "username":"qbj102", "productid":"UPCFJC_20181101170549", "count":1, "totaldays":365, "totalprice":5600000, "mobile":"15112168564", "status":220, "isrefund":0, "bustype":1, "source":1, "plat":0, "ch":21011, "couponid":"", "ip":"120.197.36.210", "cancelinfo":{ "canceluser":"", "canceltime":0, "cancelAmount":0 }," ctime":1542012074, "ext1":"{\"business_name\":\"趋势锦囊\",\"business_type\":0,\"tradetype\":1,\"payeename\":\"\",\"payerno\":\"20000022\"}","producttype":0,"flag":"","otime":1542021906,"productname":"趋势锦囊" } } */ #region 绑定,解绑手机 //var dto = new ResetMobileDto() { username = "up0000022", type = 1, oldmobile = "13416115229", newmobile = "" };//解绑 ////var dto = new ResetMobileDto() { username = "up0000022", type = 0, oldmobile = "", newmobile = "13416115228" };//绑定 ////var dto = new ResetMobileDto() { username = "up0000022", type = 2, oldmobile = "13416115228", newmobile = "13416115229" };//修改 //string url = "http://47.107.128.102:8096/ResourceService.svc/User/ResetMobile"; //string json = Utility.ObjectToJson(dto); ////string retmss = Utility.PostData(url, ObjDivertToJson(maxjson), Encoding.UTF8); //var para = sHelper.createSignEncodingStr(json); //var retmss = Utility.PostData(url + "?" + para, Encoding.UTF8); //MessageBox.Show(retmss); #endregion 绑定,解绑手机 /* var dto = new { appid = "443", appuserid = "881", sceneid = "4", scenetype = 1, eventid = 8, eventmemo = "{\"title\":\"222\"}", ctime = "2020-01-01 12:09:11", ip = "192.168.1.9" }; string url = "http://127.0.0.1:3001/actionlog/scgi/actionLogEnter"; string json = Utility.ObjectToJson(dto); var para = sHelper.createSignEncodingStr(json); var retmss = Utility.PostData(url + "?" + para, Encoding.UTF8); MessageBox.Show(retmss);*/ } catch (Exception xx) { } } public string ObjDivertToJson(object obj) { ScriptingJsonSerializationSection section = ConfigurationManager.GetSection("system.web.extensions/scripting/webServices/jsonSerialization") as ScriptingJsonSerializationSection; JavaScriptSerializer script = new JavaScriptSerializer(); script.MaxJsonLength = section != null ? section.MaxJsonLength : int.MaxValue; string json = script.Serialize(obj); return json; } private void BtnHt_Click(object sender, EventArgs e) { try { #region 删除合同,可以重签 if (string.IsNullOrWhiteSpace(TxtHt.Text)) { MessageBox.Show("软件用户名不能为空!"); return; } var dto = new { uid = TxtHt.Text.Trim() }; var url = "https://r2.soft.tcfortune.com/riskevaluate/pc/newcenter/del_risk"; var json = Utility.ObjectToJson(dto); var para = new SecurityHelper().createSignEncodingStr(json); //MessageBox.Show(url + "?" + para); var retmss = Utility.PostData(url, para, Encoding.UTF8); MessageBox.Show(retmss); #endregion 删除合同,可以重签 } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void BtnOrderCreate_Click(object sender, EventArgs e) { var upgradeOrderList = new List(); upgradeOrderList.Add(new OrderInfo() { orderid = "1840301162998518" }); upgradeOrderList.Add(new OrderInfo() { orderid = "1840301162998417" }); //需要修改productId,productType,totalPrice,totalDays,看情况ext1是否需要 CreateOrderReq suorder = new CreateOrderReq { productId = "UPCFZH_20190102160303", //productId = "UPCFJC_20181119180241", userName = "up0000022",//软件用户名 count = 1,//产品数量 busType = 1,// ch = 5001, source = 1, productType = 1,//0-单一产品、1-组合产品 mobile = "13416115228",//手机号码 totalPrice = 5800 * 100,//价格用分作为结算 //totalPrice = 99 * 100,//价格用分作为结算 //complianceFlag = 1,//合规 //signId = "", totalDays = 180, cssId = "10000", currentCH = 5001, ip = "127.0.0.1" //ext1 = "{\"upgradeOrderList\": " + upgradeOrderList.ToJson() + " }" , ext1 = (new { upgradeOrderList }).ToJson() }; var url = "https://r2.soft.tcfortune.com/order/scgi/create_order";//付费订单接口 string json = JsonHelper.ObjDivertToJson(suorder); LogHelper.Info("Node.JS接口参数json=>:" + json); json = JsonHelper.ObjDivertToJson(new SecurityHelper().createAjaxSignEncodingStr(JsonHelper.ObjDivertToJson(suorder), "UPWEBSITE")); string retmsg = Utility.PostAjaxData(url, json, Encoding.UTF8);//返回信息 LogHelper.Info("Node.JS接口返回数据json=>:" + retmsg); //retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg); CreateOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg); LogHelper.Info("创建订单返回结果:" + retmessage.ToJson()); MessageBox.Show(retmessage.retCode.ToString()); if (retmessage.retCode == 10000) { //LogHelper.Info("====调用NodeJs创建订单==="); //CreateOrderReq suorder2 = new CreateOrderReq //{ // productId = ordermodel.productcode, // userName = "up0000022", // count = 1,//产品数量 // busType = 1,// // ch = 5001, // source = 1, // productType = 0,//0-单一产品、1-组合产品 // mobile = "13416115228",//手机号码 // totalPrice = Convert.ToInt32(ordermodel.needpay.Value * 100),//价格用分作为结算 // totalDays = ordermodel.opendays.HasValue ? Convert.ToInt32(ordermodel.opendays.Value) : 0, // cssId = "10000", // currentCH = 5001, // ip = "127.0.0.1"//获取客户端IP //}; //var url2 = "https://r2.soft.tcfortune.com/order/scgi/create_open_free";//封装出来的接口 //var json2 = JsonHelper.ObjDivertToJson(new SecurityHelper().createAjaxSignEncodingStr(JsonHelper.ObjDivertToJson(suorder2), SecurityHelper.OrderClientIdKey)); //var retmsg2 = Utility.PostAjaxData(url2, json2, Encoding.UTF8);//返回信息 //CreateOrderRsp retmessage2 = JsonHelper.JsonDivertToObj(retmsg2); //LogHelper.Info("免费订单返回结果:" + retmessage2.ToJson()); } else { LogHelper.Error("retmessage:" + retmsg);//记录下单不成功 } } private void BtnReg_Click(object sender, EventArgs e) { #region 重新注册 //内容:{"username":"fc75678117","password":"3833933103","mobile":"13975678117","ch":2100,"plat":0,"ip":"222.246.85.200","clientip":"222.246.85.200","eid":"天60019","regDate":1545988981838} //var user = new //{ // username = "test004", // password = "test004", // mobile = "13800138004", // ch = 1000, // plat = 0, // ip = "171.113.85.239", // clientip = "171.113.85.239", // eid = "8888", // regDate = 1583762241181 //}; var user = new { username = "dndevv110", password = "123qwe123", mobile = "13501423456", channel = 7000, curChannel = 7000, plat = 0, ip = "192.168.91.238", clientip = "192.168.91.238", regDate = 1624430678384, eid = "", unionId = "", refeid = "123456", liveCode = "reg_5004", regSource = "soft_reg" }; string url = "http://localhost:55047/ResourceService.svc/User/SyncReg"; var para = new SecurityHelper().createSignEncodingStr(user.ToJson()); string retmss = Utility.PostData(url + "?" + para, Encoding.UTF8); MessageBox.Show(para); #endregion 重新注册 #region 参加活动 JoinActive(); #endregion 参加活动 } private void JoinActive() { JionActiveDto jionActiveDto = new JionActiveDto { account = "15678237601", ch = 7300, campaignId = "softlogin" }; string joinurl = "http://192.168.11.46:8096/ResourceService.svc/Join"; var para2 = new SecurityHelper().createSignEncodingStr(jionActiveDto.ToJson()); string ret = Utility.PostData(joinurl + "?" + para2, Encoding.UTF8); } private void GetOrderInfo_Click(object sender, EventArgs e) { SecurityHelper sHelper = new SecurityHelper(); string url = "https://r2.soft.tcfortune.com/order/scgi/get_order"; string clientid = "UPWEBSITE"; string json = "{\"orderId\":\"2282301163013114\"}"; string content = sHelper.encyptData(clientid, json); string sign = sHelper.signData(clientid, content); //bool sss = sHelper.CheckClientValid("UPWEBSITE", "8fYIIKMSFVyhEi1vhWbLOis3Et9DdiYcE/AO/k9FWIY/69V3t4xIkI15n7EGgQSKvRt0EcVULoqnUU6fdODg6fP7tr42Tyr2yInFxJxGkGHNmhNxju+ZvttUEWffqislhlItcHSESCR3SaYST9lvyeDkZ8WRW+umF4QGiq1td5x0egulF4kc4Q==", "+4GPl6YoN30T4X1Bcbvoyg=="); var maxjson = new { content = content, clientId = clientid, sign = sign }; string retmss = Utility.PostAjaxData(url, ObjDivertToJson(maxjson), Encoding.UTF8); MessageBox.Show(retmss); LogHelper.Info(retmss); } private void OpenOrder_Click(object sender, EventArgs e) { try { SecurityHelper sHelper = new SecurityHelper(); OpenOrderReq suorder = new OpenOrderReq(); suorder.orderId = "1840301172999914"; Random rd = new Random();//用于生成随机数 string DateStr = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");//日期 string str = DateStr + rd.Next(10000).ToString().PadLeft(4, '0');//带日期的随机数 suorder.payId = str;//先随机生成 suorder.payType = 1; suorder.payPrice = 99 * 100; suorder.userName = "up0000022"; suorder.isFree = 0; suorder.payRemark = "";//支付备注 //string json = string.Format("content={0}&clientid={1}&sign={2}", content, clientid, sign);//信息转发 string url = "https://r2.soft.tcfortune.com/order/scgi/open_order";//封装出来的接口 string json = JsonHelper.ObjDivertToJson(suorder); LogHelper.Info("Node.JS接口参数json=>:" + json); json = JsonHelper.ObjDivertToJson(sHelper.createAjaxSignEncodingStr(json, "UPWEBSITE")); string retmsg = Utility.PostAjaxData(url, json, Encoding.UTF8);//返回信息 LogHelper.Info("Node.JS接口返回数据json=>:" + retmsg); OpenOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg); if (retmessage.retCode == 10000) { MessageBox.Show(retmessage.ToJson()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void closeorder_Click(object sender, EventArgs e) { //关闭订单 SecurityHelper sHelper = new SecurityHelper(); string url = "https://r2.soft.tcfortune.com/order/scgi/close_order"; string clientid = "UPWEBSITE"; string json = "{\"userName\":\"up0000022\",\"orderId\":\"1840301162998417\",\"flag\":0}"; string content = sHelper.encyptData(clientid, json); string sign = sHelper.signData(clientid, content); //bool sss=sHelper.CheckClientValid("UPWEBSITE", "8fYIIKMSFVyhEi1vhWbLOis3Et9DdiYcE/AO/k9FWIY/69V3t4xIkI15n7EGgQSKvRt0EcVULoqnUU6fdODg6fP7tr42Tyr2yInFxJxGkGHNmhNxju+ZvttUEWffqislhlItcHSESCR3SaYST9lvyeDkZ8WRW+umF4QGiq1td5x0egulF4kc4Q==", "+4GPl6YoN30T4X1Bcbvoyg=="); var maxjson = new { content = content, clientId = clientid, sign = sign }; string retmss = Utility.PostAjaxData(url, ObjDivertToJson(maxjson), Encoding.UTF8); MessageBox.Show(retmss); } private void freeorder_Click(object sender, EventArgs e) { ////需要修改productId,productType,totalPrice,totalDays //CreateOrderReq suorder = new CreateOrderReq //{ // //productId = "UPCFZH_20190102160303", // productId = "UPCFJC_20201209093318_MFTY", // userName = "dn0001411",//软件用户名 // count = 1,//产品数量 // busType = 1,// // ch = 5001, // source = 1, // productType = 0,//0-单一产品、1-组合产品 // //mobile = "13416115228",//手机号码 // totalPrice =0,//价格用分作为结算 // //totalPrice = 99 * 100,//价格用分作为结算 // //complianceFlag = 1,//合规 // //signId = "", // totalDays = 180, // cssId = "10000", // currentCH = 5001, // ip = "127.0.0.1" //}; //var url = "http://192.168.11.141:10034/order/scgi/create_open_free";//免费订单接口 //string json = JsonHelper.ObjDivertToJson(suorder); //LogHelper.Info("Node.JS接口参数json=>:" + json); //json = JsonHelper.ObjDivertToJson(new SecurityHelper().createAjaxSignEncodingStr(JsonHelper.ObjDivertToJson(suorder), "UPWEBSITE")); //string retmsg = Utility.PostAjaxData(url, json, Encoding.UTF8);//返回信息 //LogHelper.Info("Node.JS接口返回数据json=>:" + retmsg); ////retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg); //CreateOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg); //LogHelper.Info("创建订单返回结果:" + retmessage.ToJson()); //MessageBox.Show(retmessage.retCode.ToString()); //if (retmessage.retCode == 10000) //{ //} //else //{ // LogHelper.Error("retmessage:" + retmsg);//记录下单不成功 //} SecurityHelper sHelper = new SecurityHelper(); var theModel = new freeordermodel { mobile = "", //needpay = 0, //opendays = 1, //ordertype = 1, //productId = 1094, remark = "风险客户", //source = "1", softusername = "dn0001411", productcode = "UPCFJC_20201209093318_MFTY",//小类代码 //teamserve = 1, //userid = 600000207, count = 365 * 3,//产品数 --免费产品始终一天,这里天数作为数量传递,达到天数效果 ctime = DateTimeTool.ConvertDateTimeInt(DateTime.Now).ToString(), //theModel.companycode = companyCode; //companycode = Utility.GetSettingOrNullByKey("DataClientCode"), ch = 0, days = 365 * 3 }; var url = "http://192.168.11.46:8096/OrderService.svc/FreeOrderByUserName/Open";//内部接口··开通免费订单接口 //var json = Utility.ConvertToJSON(theModel); var json = "{\"productcode\":\"UPCFJC_20201209093318_MFTY\",\"mobile\":\"\",\"remark\":\"风险客户\",\"softusername\":\"dn0001411\",\"ctime\":\"1657188498\",\"count\":1096,\"ch\":0}"; json = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); //LogHelper.Info("投顾订单" + model.ORDERID + (string.IsNullOrEmpty(model.WEBORDERID) ? "" : string.Format("({0})", model.WEBORDERID)) + "审核:" + url + "?" + json); string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8); retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg); CreateOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg);//返回信息 } private void SupplyOrder_Click(object sender, EventArgs e) { var upgradeOrderList = new List(); upgradeOrderList.Add(new OrderInfo() { orderid = "1840301162998518" }); upgradeOrderList.Add(new OrderInfo() { orderid = "1840301162998417" }); //需要修改productId,productType,totalPrice,totalDays,看情况ext1是否需要 CreateOrderReq suorder = new CreateOrderReq { productId = "UPCFJC_20181119180241", userName = "up0000022",//软件用户名 count = 1,//产品数量 busType = 1,// ch = 5001, source = 2, productType = 1,//0-单一产品、1-组合产品 mobile = "13416115228",//手机号码 totalPrice = 99 * 100,//价格用分作为结算 //complianceFlag = 1,//合规 //signId = "", totalDays = 365, cssId = "10000", currentCH = 5001, ip = "127.0.0.1" //ext1 = "{\"upgradeOrderList\": " + upgradeOrderList.ToJson() + " }" //, //ext1 = (new { upgradeOrderList }).ToJson() }; var url = "https://r2.soft.tcfortune.com/order/scgi/create_order";//付费订单接口 string json = JsonHelper.ObjDivertToJson(suorder); LogHelper.Info("Node.JS接口参数json=>:" + json); json = JsonHelper.ObjDivertToJson(new SecurityHelper().createAjaxSignEncodingStr(JsonHelper.ObjDivertToJson(suorder), "UPWEBSITE")); string retmsg = Utility.PostAjaxData(url, json, Encoding.UTF8);//返回信息 LogHelper.Info("Node.JS接口返回数据json=>:" + retmsg); //retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg); CreateOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg); LogHelper.Info("创建订单返回结果:" + retmessage.ToJson()); MessageBox.Show(retmessage.retCode.ToString()); if (retmessage.retCode == 10000) { } else { LogHelper.Error("retmessage:" + retmsg);//记录下单不成功 } } private void button39_Click(object sender, EventArgs e) { SecurityHelper sHelper = new SecurityHelper(); var url = "http://localhost:55047/ResourceService.svc/Join"; string clientid = "TDORDERSITE"; //string json = "{\"username\":\"13985834619\",\"mobile\":\"13985834222\",\"campaignId\":\"27102\",\"deptcode\":\"TDOEM\",\"datatype\":\"stock\"}"; string json = "{\"campaignId\":\"test\",\"deptcode\":\"QBJY\",\"accounttype\":0,\"account\":\"13416115228\"}"; string content = sHelper.encyptData(clientid, json); string sign = sHelper.signData(clientid, content); url += "?" + "content=" + HttpUtility.UrlEncode(content) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign); string retmss = HttpUtility.UrlDecode(Utility.PostData(url, Encoding.UTF8).Replace("\"", "")); //string retmss = HttpUtility.UrlDecode(Utility.PostData(url, Encoding.UTF8)); retmss = sHelper.decyptData(clientid, retmss); MessageBox.Show(retmss); } private void button40_Click(object sender, EventArgs e) { new WX.CRM.CRMServices.Res.AutoDial().start(); } private void button41_Click(object sender, EventArgs e) { try { int[] wocha = { 49, 55, 55, 53, 55, 54, 56, 54, 50, 57, 53 }; byte[] data = new byte[wocha.Length]; for (int i = 0; i < wocha.Length; i++) { data[i] = (byte)(wocha[i] & 0xff); } string wochaa = System.Text.Encoding.UTF8.GetString(data); } catch (Exception ae) { }; } private void button42_Click(object sender, EventArgs e) { //string FileUrl = "/uploadfile/201912/4f0af3166924e9cefddd666883e58b4f"; //string md5 = string.Empty; //int ganindex = FileUrl.LastIndexOf("/"); //if (FileUrl.IndexOf(".") == -1) //{ // md5 = FileUrl.Substring(ganindex+1, FileUrl.Length- ganindex-1); //} //else //{ // md5 = FileUrl.Substring(ganindex + 1, FileUrl.LastIndexOf(".")- ganindex - 1); //} string md5 = string.Empty; string fileName = "4f0af3166924e9cefddd666883e58b4f"; if (fileName.IndexOf(".") == -1) { md5 = fileName; } else { md5 = fileName.Substring(0, fileName.LastIndexOf(".")); } } private void button43_Click(object sender, EventArgs e) { //初始化一个OpenFileDialog类 OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); Dictionary dic = new Dictionary(); RES_RESOURCEMOBILE_BL mobilebl = new RES_RESOURCEMOBILE_BL(); while ((line = sr.ReadLine()) != null) { string mobile = line.ToString(); //string phone = Utility.GetMobile(line.ToString()); //if (string.IsNullOrWhiteSpace(mobile)) //{ // continue; //} mobileList.Add(mobile.Trim()); } using (ExcelPackage package = new ExcelPackage()) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("test"); worksheet.Cells[1, 1].Value = "手机号"; worksheet.Cells[1, 2].Value = "resid"; var i = 2; foreach (var item in mobileList) { if (string.IsNullOrEmpty(item)) { worksheet.Cells[i, 1].Value = ""; worksheet.Cells[i, 2].Value = ""; } else { worksheet.Cells[i, 1].Value = item; worksheet.Cells[i, 2].Value = ResUtil.CreateResId(item); } i++; } using (SaveFileDialog saveFileDialog1 = new SaveFileDialog()) { saveFileDialog1.Title = "另存为"; saveFileDialog1.FileName = "nixa.xlsx"; //设置默认另存为的名字,可选 saveFileDialog1.Filter = "Excel 文件(*.xls)|*.xls|Excel 文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; saveFileDialog1.AddExtension = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { package.SaveAs(new FileInfo(saveFileDialog1.FileName)); } } } } } private void button44_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 string clientid = Utility.GetSettingByKey("CRMClientKey"); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); Dictionary dic = new Dictionary(); RES_RESOURCEMOBILE_BL mobilebl = new RES_RESOURCEMOBILE_BL(); while ((line = sr.ReadLine()) != null) { string resid = line.ToString(); resid = resid.Trim('"'); //if (resid.Length == 24) mobileList.Add(resid); } mobileList = mobilebl.GetNumberByResIdListNoSql(mobileList).ToList(); SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } private void button45_Click(object sender, EventArgs e) { var Username = "donggao"; var Password = "clyuQwhLcUgQfV1r"; var Authorization = "Basic " + Utility.StrToBase64(Username + ":" + Password); //var start_time = DateTime.Parse("2020-05-01 00:00:00"); //var end_time = DateTime.Parse("2020-05-05 00:00:00"); //var dics = new Dictionary //{ // { "start_time", start_time.ToString("yyyy-MM-dd HH:mm:ss") }, // { "end_time", end_time.ToString("yyyy-MM-dd HH:mm:ss") } //}; //var param = Utility.GetParamSrc(dics); ////MessageBox.Show(param); //var res = Utility.PostAjaxData("http://agent.demo.taoniubang.com/orders/gift/queryOrderDG?" + param, string.Empty, Authorization, false); //MessageBox.Show(res); var rejectStr = "1"; //var orderNo = "TNBDG20051117273447342381"; //var thirdOrderNo = 1996405114075619; var orderNo = "TNBDG20051117284444501246"; var thirdOrderNo = 1996405114075518; var reasonIdList = new List(rejectStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)).Select(x => Convert.ToInt32(x)); var dics = new Dictionary { { "orderNo", orderNo }, { "thirdOrderNo", thirdOrderNo.ToString() }, { "reasonIdList", reasonIdList.ToJson() } }; var param = Utility.GetParamSrc(dics); MessageBox.Show(param); var sign = Utility.EncryptMD5(param).ToUpper(); MessageBox.Show(sign); var tnbPara = new { orderNo, thirdOrderNo, reasonIdList, sign }; //MessageBox.Show(tnbPara.ToJson()); //var res = Utility.PostAjaxData("http://api.taoniubang.com/orders/ruleAudit", tnbPara.ToJson(), Authorization, true); var res = Utility.PostAjaxData("http://agent.demo.taoniubang.com/orders/ruleAudit", tnbPara.ToJson(), Authorization, true); MessageBox.Show(res); } private void button46_Click(object sender, EventArgs e) { string mobile = "16619708806"; string mobile2 = "016619708806"; string mobile3 = "16619708806 "; string mobile4 = " 16619708806 "; string mobile5 = " 16619708806"; string mobile6 = "8616619708806"; string mobile7 = "+8618848414824"; string m = ResUtil.CreateResId(mobile); string m2 = ResUtil.CreateResId(mobile2); string mobile32 = ResUtil.CreateResId(mobile3); string mobile42 = ResUtil.CreateResId(mobile4); string mobile53 = ResUtil.CreateResId(mobile5); string mobile63 = ResUtil.CreateResId(mobile6); string mobile72 = ResUtil.CreateResId(mobile7); } private void button47_Click(object sender, EventArgs e) { string Destination = new SecurityHelper().decyptCtiNumStr(System.Web.HttpUtility.UrlDecode("yTJmLGJM30nHySJzVt%2FQnA%3D%3D")); string Source = new SecurityHelper().decyptCtiNumStr(System.Web.HttpUtility.UrlDecode("sNUxQusGeJJ7Jrpj4p41hg%3D%3D")); WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper(); string ss = sHelper.decyptData("UPWEBSITE", "delvAlmupXkNIYzx75OcSzeE8/t07dG3VB963BNblKkf+Eq6ua3y/w=="); } private void button48_Click(object sender, EventArgs e) { RfmDto model = new RfmDto() { ch = 2121, labelname = "消退", mobile = "13327995299", weight = 40, username = "zj922920", appid = "com.dongniu" }; var json = JsonConvert.SerializeObject(model); var para = new SecurityHelper().createSignEncodingStr(json); //Console.WriteLine(para); var url = "http://192.168.11.46:8096/ResourceService.svc/SynRfm"; var rep = Utility.PostData(url + "?" + para, Encoding.UTF8); SecurityHelper sHelper = new SecurityHelper(); string sa = sHelper.decyptData("UPWEBSITE", HttpUtility.UrlDecode(rep).Replace("\"", "")); string aax = ""; aax += ""; } //private void button2_Click(object sender, EventArgs e) //{ // SendGroupPercentToPromotion(""); // SendUserPercentToPromotion(); //} ///// ///// 同步到推广-组别比率 ///// //private void SendGroupPercentToPromotion(string gids) //{ // try // { // List list = wx_GroupPercent_BL.GetGroupPercentListJoinGroup(gids); // foreach (WX_GROUPPERCENT_Extend item in list) // { // web_push_updateGroup user = new web_push_updateGroup() // { // GroupId = item.GID.ToString(), // Isopen = 1, // Name = item.GNAME, // Proportion = item.DIV_PERCENT.Value // }; // new PushDataServices().SendData(user, "ZQZX", "web_push_updateGroup"); // } // } // catch (Exception e) { LogHelper.Error("组别比率新增推送数据出错:" + e.ToString()); } //} ///// ///// 同步到推广-员工比率 ///// ///// //private void SendUserPercentToPromotion(decimal[] groupIds) //{ // try // { // List list = wx_UserPercent_BL.GetUserPercentToPush(groupIds); // foreach (WX_USERPERCENT_Extend2 item in list) // { // web_push_updateEmployee user = new web_push_updateEmployee() // { // Isopn = 1, // EID = item.EID.ToString(), // GroupID = item.GID.ToString(), // Name = item.UNAME, // Proportion = item.DIV_PERCENT, // userid = item.UserId.ToString() // }; // new PushDataServices().SendData(user, "ZQZX", "web_push_updateEmployee"); // } // } // catch (Exception e) { LogHelper.Error("员工比率新增推送数据出错:" + e.ToString()); } //} /// /// 图片添加文字,文字大小自适应 /// /// 图片路径 /// 左上角定位(x1,y1) /// 右下角定位(x2,y2) /// 文字内容 /// 字体名称 /// 添加文字后的Bitmap对象 public static Bitmap AddText(string imgPath, string locationLeftTop, string locationRightBottom, string text, string fontName = "华文行楷") { Image img = Image.FromFile(imgPath); int width = img.Width; int height = img.Height; Bitmap bmp = new Bitmap(width, height); Graphics graph = Graphics.FromImage(bmp); // 计算文字区域 // 左上角 string[] location = locationLeftTop.Split(','); float x1 = float.Parse(location[0]); float y1 = float.Parse(location[1]); // 右下角 location = locationRightBottom.Split(','); float x2 = float.Parse(location[0]); float y2 = float.Parse(location[1]); // 区域宽高 float fontWidth = x2 - x1; float fontHeight = y2 - y1; float fontSize = fontHeight; // 初次估计先用文字区域高度作为文字字体大小,后面再做调整,单位为px Font font = new Font(fontName, fontSize, GraphicsUnit.Pixel); SizeF sf = graph.MeasureString(text, font); int times = 0; // 调整字体大小以适应文字区域 if (sf.Width > fontWidth) { while (sf.Width > fontWidth) { fontSize -= 0.1f; font = new Font(fontName, fontSize, GraphicsUnit.Pixel); sf = graph.MeasureString(text, font); times++; } Console.WriteLine("一开始估计大了,最终字体大小为{0},循环了{1}次", font.ToString(), times); } else if (sf.Width < fontWidth) { while (sf.Width < fontWidth) { fontSize += 0.1f; font = new Font(fontName, fontSize, GraphicsUnit.Pixel); sf = graph.MeasureString(text, font); times++; } Console.WriteLine("一开始估计小了,最终字体大小为{0},循环了{1}次", font.ToString(), times); } // 最终的得出的字体所占区域一般不会刚好等于实际区域 // 所以根据两个区域的相差之处再把文字开始位置(左上角定位)稍微调整一下 x1 += (fontWidth - sf.Width) / 2; y1 += (fontHeight - sf.Height) / 2; graph.DrawImage(img, 0, 0, width, height); graph.DrawString(text, font, new SolidBrush(Color.Black), x1, y1); graph.Dispose(); img.Dispose(); return bmp; } private void button49_Click(object sender, EventArgs e) { AutoBound.Bound(); } private void button50_Click(object sender, EventArgs e) { //SummaryMessage.Summary(); //SummaryMessage.Push(); } private void button51_Click(object sender, EventArgs e) { //SummaryMessagePush.Push(); } private void button52_Click(object sender, EventArgs e) { WWHHuserMonitor.Monitor(); } private void button53_Click(object sender, EventArgs e) { new WX_SZZYORDERDEPOSIT_BL().Delete(20000294); } private void button54_Click(object sender, EventArgs e) { /* OracleHelper.ExecuteOracleTransaction(); return;*/ SYNC_PUSH_SUCC info = new SYNC_PUSH_SUCC() { PKID = 59125259, PICI = 0, JSONTEXT = "{\"resid\":\"047012725787469725\",\"userid\":\"wm9jNKCAAAN64mDModNfWKOac_xjX5pg\",\"deptcode\":\"DNG8\"}", FILENAME = "23", ISBATCH = 1, CTIME = DateTime.Parse("2022-07-06 15:19:44"), SENDTIME = DateTime.Parse("2022-07-06 16:13:03"), BIDATATYPE = "Client_CloseOrder", DEPTCODE = "DNG8", CANREPEATNUM = 0 }; OracleParameter[] cmdParms = { new OracleParameter(){ ParameterName = ":PKID", OracleDbType = OracleDbType.Decimal, Value = info.PKID}, new OracleParameter(){ ParameterName = ":JSONTEXT", OracleDbType = OracleDbType.Clob, Value = info.JSONTEXT }, new OracleParameter(){ ParameterName = ":FILENAME", OracleDbType = OracleDbType.Varchar2, Value = info.FILENAME}, new OracleParameter(){ ParameterName = ":ISBATCH", OracleDbType = OracleDbType.Decimal, Value = info.ISBATCH}, new OracleParameter(){ ParameterName = ":CTIME", OracleDbType = OracleDbType.Date, Value = info.CTIME}, new OracleParameter(){ ParameterName = ":SENDTIME", OracleDbType = OracleDbType.Date, Value = info.SENDTIME}, new OracleParameter(){ ParameterName = ":BIDATATYPE", OracleDbType = OracleDbType.Varchar2, Value = info.BIDATATYPE}, new OracleParameter(){ ParameterName = ":DEPTCODE", OracleDbType = OracleDbType.Varchar2, Value = info.DEPTCODE }, new OracleParameter(){ ParameterName = ":CANREPEATNUM", OracleDbType = OracleDbType.Decimal, Value = info.CANREPEATNUM}, }; ExecuteOracleTransaction(cmdParms); } public static void ExecuteOracleTransaction(OracleParameter[] cmdParms) { OracleConnection conn = new OracleConnection(OracleHelper.AYCRMConn); if (conn.State == ConnectionState.Closed) conn.Open(); try { using (OracleTransaction trans = conn.BeginTransaction()) { String cmdText = @" INSERT INTO WSKUSER.SYNC_RECEIVE_SUCC A (A.PKID, A.PICI, A.JSONTEXT, A.FILENAME, A.ISBATCH, A.CTIME, A.SENDTIME, A.BIDATATYPE, A.DEPTCODE, A.CANREPEATNUM) VALUES (:PKID, :PICI, :JSONTEXT, :FILENAME, :ISBATCH, :CTIME, :SENDTIME, :BIDATATYPE, :DEPTCODE, :CANREPEATNUM)"; /* OracleParameter[] cmdParms = { new OracleParameter(){ ParameterName = ":PKID", OracleType = OracleType.Number, Value = info.PKID}, new OracleParameter(){ ParameterName = ":PICI", OracleType = OracleType.Number, Value = info.PICI}, new OracleParameter(){ ParameterName = ":JSONTEXT", OracleType = OracleType.Clob, Value = info.JSONTEXT }, new OracleParameter(){ ParameterName = ":FILENAME", OracleType = OracleType.VarChar, Value = info.FILENAME}, new OracleParameter(){ ParameterName = ":ISBATCH", OracleType = OracleType.Number, Value = info.ISBATCH}, new OracleParameter(){ ParameterName = ":CTIME", OracleType = OracleType.DateTime, Value = info.CTIME }, new OracleParameter(){ ParameterName = ":SENDTIME", OracleType = OracleType.DateTime, Value = info.SENDTIME}, new OracleParameter(){ ParameterName = ":BIDATATYPE", OracleType = OracleType.VarChar, Value = info.BIDATATYPE}, new OracleParameter(){ ParameterName = ":DEPTCODE", OracleType = OracleType.VarChar, Value = info.DEPTCODE }, new OracleParameter(){ ParameterName = ":CANREPEATNUM", OracleType = OracleType.Int32, Value = info.CANREPEATNUM}, };*/ string sql = "select count(*) ncount from wskuser.sync_receive_succ a where a.pkid=:pkid"; List param = new List() { new OracleParameter() { ParameterName = ":pkid", OracleDbType = OracleDbType.Decimal, Value = "59125256" } }; //bool isHasPkid = IsHasPkid(sql, param); //if (!isHasPkid) //{ ExecuteSqlCommand(conn, trans, cmdText, cmdParms); string strDelete = " delete from wskuser.sync_receive a where a.pkid='59125239' "; ExecuteSqlCommand(conn, trans, strDelete); trans.Commit(); //} } } catch (Exception ex) { } finally { conn.Close(); } } /// /// 判断是否存在Pkid /// /// /// /// private static bool IsHasPkid(string sql, List param) { bool isHas = false; try { DataTable tab = DataQueray(OracleHelper.AYCRMConn, CommandType.Text, sql, param.ToArray()).Tables[0]; int count = Convert.ToInt32(tab.Rows[0]["ncount"]); if (count > 0) isHas = true; } catch (Exception ex) { LogHelper.Error(ex.ToString()); } return isHas; } public string HmacMD5(string source, string key) { HMACMD5 hmacmd = new HMACMD5(Encoding.UTF8.GetBytes(key)); byte[] inArray = hmacmd.ComputeHash(Encoding.UTF8.GetBytes(source)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < inArray.Length; i++) { sb.Append(inArray[i].ToString("X2")); } hmacmd.Clear(); return sb.ToString(); } /// /// 返回一个dataset /// /// /// /// /// /// public static DataSet DataQueray(string connectionstring, CommandType cmdType, string cmdText, params OracleParameter[] commandParameters) { OracleConnection con = new OracleConnection(connectionstring); OracleCommand cmd = new OracleCommand(cmdText, con); try { cmd.CommandType = cmdType; cmd.Parameters.AddRange(commandParameters); OracleDataAdapter da = new OracleDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); cmd.Parameters.Clear(); return ds; } finally { if (con.State == ConnectionState.Open) con.Close(); } } private static void ExecuteSqlCommand(OracleConnection conn, OracleTransaction trans, string cmdText, OracleParameter[] cmdParms = null) { try { OracleCommand mycmd = new OracleCommand(cmdText); mycmd.Connection = conn; if (trans != null) mycmd.Transaction = trans; mycmd.CommandType = CommandType.Text; if (cmdParms != null) { foreach (OracleParameter parameter in cmdParms) { if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) && (parameter.Value == null)) { parameter.Value = DBNull.Value; } mycmd.Parameters.Add(parameter); } } mycmd.ExecuteNonQuery(); } catch (Exception) { throw; } } private void button55_Click(object sender, EventArgs e) { string clientid = "TDORDERSITE"; SecurityHelper sHelper2 = new SecurityHelper(); var setEid = new { username = "n15710171652", password = "", mobile = "15710171652", em = "", ch = 23000, channel = 23000, regDate = 1668148112369, }; var url3 = "http://localhost:18739/ResourceService.svc/SyncRegUser"; string json3 = setEid.ToJson(); string content3 = sHelper2.encyptData(clientid, json3); string sign3 = sHelper2.signData(clientid, content3); url3 += "?" + "content=" + HttpUtility.UrlEncode(content3) + "&clientid=" + clientid + "&sign=" + HttpUtility.UrlEncode(sign3); var qq3 = Utility.PostData(url3, Encoding.UTF8); } private void button56_Click(object sender, EventArgs e) { var result = Utility.EncryptMD5(textBox8.Text); textBox9.Text = result; } private void button57_Click(object sender, EventArgs e) { var sql = "select * from a_freeorder"; var ds = OracleHelper.DataQueray(OracleHelper.AYCRMConn, CommandType.Text, sql); var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { freeordermodel theModel = new freeordermodel(); theModel.mobile = dr["mobile"].ToString(); theModel.ordertype = 1; theModel.productId = 1008298; theModel.remark = ""; theModel.saledeptid = 0; theModel.source = "1"; theModel.softusername = dr["username"].ToString(); theModel.productcode = "UPCFJC_20240410045919_MFTY";//小类代码 theModel.needpay = 0; theModel.teamserve = 1; theModel.userid = 10000; theModel.productType = 0;//产品分类 theModel.opuser = 0; theModel.ctime = DateTimeTool.ConvertDateTimeInt(DateTime.Now).ToString(); //theModel.companycode = companyCode; theModel.companycode = dr["code"].ToString(); theModel.mainOrderId = null; theModel.count = Convert.ToInt32(dr["days"]); //产品数 --免费产品始终一天,这里天数作为数量传递,达到天数效果 theModel.ch = Convert.ToInt32(dr["ch"]); //var url = "http://120.77.165.155:8096/OrderService.svc/FreeOrder/Open";//内部接口··开通免费订单接口 var url = "http://qm.dn8188.com:8096/OrderService.svc/FreeOrder/Open"; var json = Utility.ConvertToJSON(theModel); json = new SecurityHelper().createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); LogHelper.Info("批量开通:" + url + "?" + json); string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8); retmsg = new SecurityHelper().decyptData(SecurityHelper.OrderClientIdKey, retmsg); CreateOrderRsp retmessage = JsonHelper.JsonDivertToObj(retmsg);//返回信息 LogHelper.Info(retmessage.ToJson()); } MessageBox.Show("ok"); } private void button58_Click(object sender, EventArgs e) { } //身份证识别性别 private void button59_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); //判断用户是否正确的选择了文件 if (fileDialog.ShowDialog() == DialogResult.OK) { //获取用户选择文件的后缀名 string extension = Path.GetExtension(fileDialog.FileName); //声明允许的后缀名 StreamReader sr = new StreamReader(fileDialog.FileName, Encoding.Default); String line; List mobileList = new List(); while ((line = sr.ReadLine()) != null) { string resid = line.ToString(); resid = resid.Trim('"'); //if (resid.Length == 24) mobileList.Add(getGenderByIdCard(resid.Trim())); } SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.Filter = "文本文件(.txt)|*.txt"; saveFile1.FilterIndex = 1; if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFile1.FileName.Length > 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFile1.FileName, false); try { foreach (var item in mobileList) { sw.WriteLine(item); //只要这里改一下要输出的内容就可以了 } } catch { throw; } finally { sw.Close(); } } } } /** * 根据身份编号获取性别 * * @param idCard 身份编号 * @return 性别(M - 男 , F - 女 , N - 未知) */ public static string getGenderByIdCard(string idCard) { try { string sGender; string sCardNum = idCard.Substring(16, 1); if (int.Parse(sCardNum) % 2 != 0) { sGender = "男";//男 } else { sGender = "女";//女 } return sGender; }catch(Exception e) { return ""; } } private void button60_Click(object sender, EventArgs e) { RSATool tool = new RSATool(); string privKey = "MIICXgIBAAKBgQCO772dmiRP4HaddeZTUieS4SWrNnbRPIgxoF5wLZNK1nel3hf7uffWkZ5lzjSuLig5sgPzU/oQgophIG9+NwoHeyXPgnhNV8zPluueHFrQzrSnq9jhUS1yxTezmYr+oxAQIyGQUZO21Sg1+2lqDyatPpRfN4JSKusAw9yOcbkHKQIDAQABAoGAArchNgZAnFfaSQF9X6XW5J5sVcVSGoV43OB8CsuC2dAbM8Z1VC3jPGtFxA9XxttPnlD4bD3zKS8hq9iu5YnsIdL7bt1hu2vOW2UGtIPfYtTMK49BcgYHk1zIlQh21Jt403SM0hDmbpy/R32QQ3cv5jWnVvlEqiULyOC0joe9vTUCQQDAv4dOl3v3HQ40cWoe7RUKqbn0bBM4xIx2fwMBJTMJFJFWBq97CwtvuwKnlWle5dRDLTrwt7rETfNPW898nb3jAkEAvdeci8MLDAQE9KeIyxJK1170ahwkxTcO8miI5o/u6AekWk+YuNJh871YKoxwqPtD/2cDQH3PLxwklvVJExJ0gwJBAJ7QcP1ZpcPLxfuCA21t7St3A4gYUJIyqIWuS1xzOSTfNI0MPySDyi2KijpoyoRtnEKpjunuiM3caIDX5hMIqf8CQQCfFzYoZa43RpMEl/VqAI1ZiUiYN7eU0fwjpvi7Bvm11tmjmTqqABx4Dz/4gDLVWaP1P9WY0RW0LAh5vVqcsgWTAkEAk27NKkvwGR37bcHF2QwxeQkY+5pamJhIGvEm+dbhOm9P1mmcujrfZ49Aegy3RiIBQACHRNgjC6sYZcrs/wPrXw=="; string publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsjPp7EaOpKkkoA4bAj5LkjGP19H1gJc8WPkO7KEx+3asZUHtDaB09Np+FzyStmfcdC75MaBy+s/a7wcovE9gk3t6IWkNFEVYvtIRns3ZwF64wX9x1OKpr/6qz9Tp4ncoJPGj4O8yEeItnOOP01RSA4bzmRf8a9wkDv5fT3qV+nwIDAQAB"; string data = "data={\"orderId\":\"1234567890\",\"appId\":\"5\",\"shopId\":\"45678\",\"ucid\":\"12345\"}×tamp=1737369893&type=order_status"; bool sign = tool.ValidationPublicKey(data, "BsfZgimlpzWBd54dSRDFBUVBDlr5KD5qzcl4jFiaa1/FKW26BCOtEwD6Il70vSd9ohMDxNSPk+ocOt6X1uP3ZoUPzzPj/nJyueYBwFu7vooc0Y0/XBR4anireWpr2S9eVrr99C33w9LG+zAcISGcP85gxjmvgJuM7oWIqUDmH4g=", publicKey); //string XX=sign(data, key); } /// /// 根据加密内容 私钥 生成签名 /// /// /// public string sign(string content, string privateKeyXml) { //string privateKeyXml = PemToXml(privateKey, true); var rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(privateKeyXml); //签名返回 using (var sha256 = new SHA256CryptoServiceProvider()) { var signData = rsa.SignData(Encoding.UTF8.GetBytes(content), sha256); return Convert.ToBase64String(signData); } } } public class SyncRegUserModel { public string username { get; set; } public string activeMobile { get; set; } public string mobile { get; set; } public string campaignId { get; set; } public string platform { get; set; } public string userCardNo { get; set; } public DateTime? regDate { get; set; } public int companyId { get; set; } } public class SuCai { public string type { get; set; } public int offset { get; set; } public int count { get; set; } } public class ResInitInfo { public string CNumber { get; set; } public string ResId { get; set; } public string CustomerFrom { get; set; } public string ECNumber { get; set; } } public class SilkConvertToMp3 { public void ConvertToPcm(string applicationPath, string fileName, string targetFileName) { string para = applicationPath + @"\silk_v3_decoder.exe " + fileName + " " + targetFileName + "&exit"; Cmd(para); } public void ConvertToMp3(string applicationPath, string fileName, string targetFilName) { string c = applicationPath + @"\ffmpeg.exe -y -f s16le -ar 24000 -ac 1 -i " + fileName + " " + targetFilName + "&exit"; ; Cmd(c); } public void ConvertAmrToMp3(string applicationPath, string fileName, string targetFilName) { string c = applicationPath + @"\ffmpeg.exe -i " + fileName + " " + targetFilName + "&exit"; ; Cmd(c); } private void Cmd(string c) { try { System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardInput = true; process.Start(); process.StandardInput.WriteLine(c); process.StandardInput.AutoFlush = true; //process.StandardInput.WriteLine("exit"); var reader = process.StandardOutput.ReadToEnd(); //截取输出流 process.WaitForExit(); process.Close(); } catch (Exception ex) { LogHelper.Error("转换录音文件失败:" + ex.ToString()); } } } public class OrderInfo { public string orderid { get; set; } } public class CeShi { public int? eid { get; set; } //public string callback { get; set; } //public bool isweb { get; set; } //public string business_name { get; set; } //public int business_type { get; set; } //public int tradetype { get; set; } //public string payeename { get; set; } //public string payerno { get; set; } } public class exambank { public string cchaptername { get; set; } public int ichapterid { get; set; } public int itype { get; set; } public int igrade { get; set; } } public class subject { public int isubjectid { get; set; } public string csubjecttype { get; set; } public string ctitle { get; set; } public string cquestion { get; set; } public string cdescription { get; set; } public string canswer { get; set; } } public class AccountInfo { public string appid { get; set; } public string appuserid { get; set; } public int uid { get; set; } public string mobile { get; set; } public string unionid { get; set; } public string ctime { get; set; } } public class AssignQuery { public AssignQuery(string appuserid, int channel, int curchannel, string remark) : this("com.dongniu", appuserid, string.Empty, channel, curchannel, 0, string.Empty, remark, string.Empty, string.Empty, string.Empty) { this.appuserid = appuserid; } public AssignQuery(string appid, string appuserid, string unionid, int channel, int curchannel, int type, string livecode, string remark, string remarkext, string memo, string eid) { this.appid = appid; this.appuserid = appuserid; this.unionid = unionid; this.channel = channel; this.curchannel = curchannel; this.type = type; this.livecode = livecode; this.remark = remark; this.remarkext = remarkext; this.memo = memo; this.eid = eid; } public string appid { get; set; } public string appuserid { get; set; } public string unionid { get; set; } public int channel { get; set; } public int curchannel { get; set; } public int type { get; set; }//1、返回二维码链接、0、不需要返回二码码链接 public string livecode { get; set; } //活码标识,30字符以内 public string remark { get; set; }//标记,30字符以内 public string remarkext { get; set; }//标记补充,30字符以内 public string memo { get; set; } public string eid { get; set; }//工号 } public class WeworkUserAssignMessage { public int errcode { get; set; } public string errmsg { get; set; } public WeworkUserAssignResult data { get; set; } } public class WeworkUserAssignResult { public int eid { get; set; } public int? groupid { get; set; } public string qr { get; set; } } public class datade { public string content { get; set; } public string sign { get; set; } } }