67 lines
2.8 KiB
C#
67 lines
2.8 KiB
C#
using CRM.Core.BLL.EventBus.EventHandlers;
|
||
using CRM.Core.BLL.EventBus.Events;
|
||
using CRM.Core.BLL.Isvr;
|
||
using CRM.Core.BLL.Util;
|
||
using CRM.Core.Common.EventBus;
|
||
using CRM.Core.Common.WebHelper;
|
||
using CRM.Core.DTO.Res;
|
||
using CRM.Core.Model.Enum;
|
||
using System;
|
||
using System.Web;
|
||
using WX.CRM.Common;
|
||
|
||
namespace ZXDService
|
||
{
|
||
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“WeWorkService”。
|
||
// 注意: 为了启动 WCF 测试客户端以测试此服务,请在解决方案资源管理器中选择 WeWorkService.svc 或 WeWorkService.svc.cs,然后开始调试。
|
||
public class WeWorkService : IWeWorkService
|
||
{
|
||
private string clientKey = WX.CRM.Common.Utility.GetSettingByKey("CRMClientKey");
|
||
ISVR_INTERFACECALLLOG_BL logHelper = new ISVR_INTERFACECALLLOG_BL();
|
||
SecurityHelper sHelper = new SecurityHelper();
|
||
|
||
|
||
public WeWorkService()
|
||
{
|
||
EventBus.Instance.Subscribe(new WeWorkAssignStatusEventHandler());
|
||
}
|
||
|
||
public string SetAssignStatus(string content, string clientid, string sign)
|
||
{
|
||
string retMsg = string.Empty;
|
||
try
|
||
{
|
||
logHelper.AddCallLog(content, clientid, sign, "WeWorkService/SetAssignStatus");
|
||
if (clientKey == "nj_crm")
|
||
{
|
||
clientid = SecurityHelper.OrderClientIdKey;
|
||
}
|
||
//验证是否非法请求
|
||
if (!sHelper.CheckClientValid(clientid, content, sign))
|
||
{
|
||
LogHelper.Info("非法请求content:" + content + ",clientid=" + clientid + ",sign=" + sign);
|
||
//return JsonHelper.ObjDivertToJson(new { result = false, retcode = (int)EnumInterfaceErrcode.非法请求 });
|
||
return HttpUtility.UrlEncode(sHelper.encyptData(clientid, JsonHelper.ObjDivertToJson(new { result = false, retcode = (int)EnumInterfaceErrcode.非法请求 })));
|
||
}
|
||
|
||
content = sHelper.decyptData(clientid, content); //解密操作
|
||
|
||
var model = JsonHelper.JsonDivertToObj<AssignStatusDto>(content);
|
||
|
||
//LogHelper.Info("企微状态更新:" + model.ToJson());
|
||
|
||
EventBus.Instance.Publish(new WeWorkAssignStatusEvent(model));
|
||
|
||
retMsg = JsonHelper.ObjDivertToJson(new { result = true, retcode = (int)EnumInterfaceErrcode.调用成功 });
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error(ex.ToString());
|
||
retMsg = JsonHelper.ObjDivertToJson(new { result = false, retcode = (int)EnumInterfaceErrcode.系统错误 });
|
||
}
|
||
|
||
return HttpUtility.UrlEncode(sHelper.encyptData(clientid, retMsg));
|
||
}
|
||
}
|
||
}
|