83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using CRM.Core.BLL.Util;
|
|
using CRM.Core.Model.Entity;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using WX.CRM.Common;
|
|
|
|
namespace CRM.Core.BLL.Isvr
|
|
{
|
|
public class ISVR_INTERFACECALLLOG_BL
|
|
{
|
|
ValidationErrors errors = new ValidationErrors();
|
|
public bool Create(ref ValidationErrors errors, ISVR_INTERFACECALLLOG model)
|
|
{
|
|
try
|
|
{
|
|
using (zxdContext db = new zxdContext())
|
|
{
|
|
//var entry = db.ISVR_INTERFACECALLLOG.FirstOrDefault(m => m.LOGID == model.LOGID);
|
|
//if (entry != null)
|
|
//{
|
|
// errors.Add("该编码已经被占用!");
|
|
// return false;
|
|
//}
|
|
|
|
model.CTIME = DateTime.Now;
|
|
db.ISVR_INTERFACECALLLOG.Add(model);
|
|
return db.SaveChanges().GetResult();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
LogHelper.Error(ex.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
public bool AddCallLog(string content, string clientid, string sign, string url)
|
|
{
|
|
try
|
|
{
|
|
var clientKey = string.Empty;
|
|
if (!string.IsNullOrEmpty(content))
|
|
{
|
|
//clientKey = string.Concat(content, "&clientid=", clientid, "&sign=", sign);
|
|
clientKey = "content=" + content + "&clientid" + clientid + "sign=" + sign;
|
|
}
|
|
var model = new ISVR_INTERFACECALLLOG
|
|
{
|
|
CLIENTIP = Utility.GetClientIp(),
|
|
CLIENTKEY = clientKey,
|
|
CLIENTURL = url,
|
|
CLIENTKEYENCODE = HttpUtility.UrlEncode(clientKey)
|
|
};
|
|
return Create(ref errors, model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public ISVR_INTERFACECALLLOG GetMode()
|
|
{
|
|
try
|
|
{
|
|
using (zxdContext db = new zxdContext())
|
|
{
|
|
return db.ISVR_INTERFACECALLLOG.FirstOrDefault();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|