ComplianceServer/oldcode/ZXDService/WeWorkService.svc.cs

67 lines
2.8 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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));
}
}
}