59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using SuperSocket.SocketBase.Command;
|
||
using SuperSocket.SocketBase.Protocol;
|
||
using System;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.DataSynServer.Application;
|
||
using WX.CRM.DataSynServer.Domain;
|
||
|
||
namespace WX.CRM.DataSynServer.Socket.Command
|
||
{
|
||
public class ClientGet : CommandBase<ZxSession, StringRequestInfo>
|
||
{
|
||
public override void ExecuteCommand(ZxSession session, StringRequestInfo requestInfo)
|
||
{
|
||
//得到获取数据命令,查询数据库并发送数据
|
||
try
|
||
{
|
||
var body = requestInfo.Body;
|
||
//LogHelper.Info(body);
|
||
if (string.IsNullOrEmpty(body)) return;
|
||
var info = body.ToObject<SYNC_PUSH>();
|
||
|
||
if (string.IsNullOrEmpty(info.deptcode))
|
||
{
|
||
LogHelper.Info("DEPTCODE为空!");
|
||
return;
|
||
}
|
||
var data = new SyncPushService().GetList(50, info.deptcode);
|
||
foreach (var item in data)
|
||
{
|
||
session.SendMessage("ClientGetInfo", item);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error("服务端获取数据错误!" + ex.ToString());
|
||
}
|
||
}
|
||
}
|
||
|
||
public class ClientGetOk : CommandBase<ZxSession, StringRequestInfo>
|
||
{
|
||
public override void ExecuteCommand(ZxSession session, StringRequestInfo requestInfo)
|
||
{
|
||
try
|
||
{
|
||
var body = requestInfo.Body;
|
||
if (string.IsNullOrEmpty(body)) return;
|
||
var info = body.ToObject<SYNC_PUSH>();
|
||
|
||
new SyncPushService().PushSucc(info);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error("服务端确认客户端数据接收时错误:" + ex.ToString());
|
||
}
|
||
}
|
||
}
|
||
}
|