136 lines
4.9 KiB
C#
136 lines
4.9 KiB
C#
using System;
|
|
using WX.CRM.BLL.Base;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Isvr;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.Isvr
|
|
{
|
|
public class ISVR_INTERFACECALLLOG_BL : IISVR_INTERFACECALLLOG
|
|
{
|
|
ValidationErrors errors = new ValidationErrors();
|
|
public bool Create(ref ValidationErrors errors, WX.CRM.Model.Entity.ISVR_INTERFACECALLLOG model)
|
|
{
|
|
|
|
try
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
//var entry = db.ISVR_INTERFACECALLLOG.FirstOrDefault(m => m.LOGID == model.LOGID);
|
|
//if (entry != null)
|
|
//{
|
|
// errors.Add("该编码已经被占用!");
|
|
// return false;
|
|
//}
|
|
model.LOGID = new SEQUENCES_BL().Seq_base_get(WX.CRM.Model.Enum.PKIDType.LargeTable);
|
|
|
|
model.CTIME = DateTime.Now;
|
|
db.ISVR_INTERFACECALLLOG.Add(model);
|
|
return db.SaveChanges().GetResult();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
public bool AddCallLog(string content, string clientid, string sign, string url)
|
|
{
|
|
try
|
|
{
|
|
string clientKey = "";
|
|
if (!string.IsNullOrEmpty(content))
|
|
{
|
|
clientKey = string.Concat(content, "&clientid=", clientid, "&sign=", sign);
|
|
}
|
|
ISVR_INTERFACECALLLOG model = new ISVR_INTERFACECALLLOG();
|
|
model.CLIENTIP = Utility.GetClientIp();
|
|
model.CLIENTKEY = clientKey;
|
|
model.CLIENTURL = url;
|
|
Create(ref errors, model);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
//public string checkData()
|
|
//{
|
|
// using (crmContext db = new crmContext())
|
|
// {
|
|
// DateTime stratTime = Convert.ToDateTime("2015-3-4 13:52:19");
|
|
// DateTime endtime = Convert.ToDateTime("2015-3-5 9:45:00");
|
|
// SecurityHelper sqlheper = new SecurityHelper();
|
|
// string msg = string.Empty;
|
|
// var log = db.ISVR_INTERFACECALLLOG.Where(p => p.CLIENTURL.Trim() == "ResourceService/JoinActive" && p.CTIME > stratTime && p.CTIME <= endtime).ToList();
|
|
// foreach (ISVR_INTERFACECALLLOG tt in log)
|
|
// {
|
|
// //8fYIIKMSFVzjFI7x562gWv1dzWMRdonh+VZhMInzZukBAxTbpNL4nJSNkfmoIaxiZIfkNq9woO3dTEME1xhVLwSI2ohiyTSQclientid:UPWEBSITEsign:js2za9CvSSK1T8kfHsnLEA==
|
|
// string str = tt.CLIENTKEY;
|
|
// string[] str2 = str.Split(':');
|
|
// string arr = str2[0].Replace("clientid", "");
|
|
// string arr2 = str2[1].Substring(0, str2[1].Length - 4);
|
|
// string sign = str2[2];
|
|
|
|
// string param = sqlheper.decyptData(arr2, arr);
|
|
|
|
// JionActiveModel jActive = new JionActiveModel();
|
|
|
|
// jActive = Utility.JSONToObject<JionActiveModel>(param);
|
|
|
|
// string key = "ay.Compass.ay";
|
|
|
|
// TEMP_INTERFACECALLOG logdata = new TEMP_INTERFACECALLOG();
|
|
|
|
// logdata.CTIME = DateTime.Now;
|
|
// logdata.CAMPAIGNID = jActive.campaignId;
|
|
// logdata.CHKSUM = Utility.EncryptMD5(key + jActive.mobile + jActive.username);
|
|
// logdata.MOBILE = jActive.mobile;
|
|
// logdata.USERNAME = jActive.username;
|
|
// logdata.DISABLED = 0;
|
|
// if(!string.IsNullOrWhiteSpace( jActive.mobile))
|
|
// {
|
|
// logdata.RESID = ResUtil.CreateResId(jActive.mobile);
|
|
// }
|
|
|
|
// SaveTest(logdata);
|
|
|
|
// }
|
|
|
|
// return msg;
|
|
|
|
// }
|
|
//}
|
|
|
|
|
|
|
|
//public bool SaveTest(TEMP_INTERFACECALLOG logdata)
|
|
//{
|
|
// using (crmContext db = new crmContext())
|
|
// {
|
|
// logdata.PKID = new SEQUENCES_BL().Seq_base_get();
|
|
// db.TEMP_INTERFACECALLOG.Add(logdata);
|
|
// return db.SaveChanges().GetResult();
|
|
// }
|
|
//}
|
|
//public PostData()
|
|
//{
|
|
|
|
//
|
|
// string canshu="username=" + jActive.username + "&mobile=" + jActive.mobile + "&from=" + jActive.campaignId + "&chksum=" + Utility.EncryptMD5(key + jActive.mobile + jActive.username);
|
|
// string url = "http://192.168.1.52:1080/Handler/SyncNumberToResourceSystem.ashx?"+canshu;
|
|
|
|
// msg = Utility.PostData(url, Encoding.UTF8);
|
|
//}
|
|
|
|
}
|
|
}
|