|
@@ -17,6 +17,9 @@ using WeChatCore.Enum;
|
|
|
|
|
|
namespace WeChatCore
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// weichat
|
|
|
+ /// </summary>
|
|
|
public static class WeiChat
|
|
|
{
|
|
|
#region 初始化微信机器人
|
|
@@ -35,10 +38,22 @@ namespace WeChatCore
|
|
|
CommonDefine.GetMsgSyncKey = GetSyncKey();
|
|
|
while (true)
|
|
|
{
|
|
|
- LogWriter.Write(string.Format("获取心跳信息..."), LogPathDefine.WeChatLogPath);
|
|
|
- KeepHeart(CommonDefine.GetMsgSyncKey);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ LogWriter.Write(string.Format("获取心跳信息..."), LogPathDefine.WeChatLogPath);
|
|
|
+ KeepHeart(CommonDefine.GetMsgSyncKey);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ LogWriter.Write(string.Format(ex.Message), LogPathDefine.ExceptionLogPath);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogWriter.Write(string.Format("下载验证码失败,请重试..."), LogPathDefine.WeChatLogPath);
|
|
|
+ throw new Exception("下载验证码失败,请重试...");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -560,6 +575,11 @@ namespace WeChatCore
|
|
|
me.FilePath = Environment.CurrentDirectory + "\\" + DirectoryDefine.MapImageMsgPath + "\\" + FileId + ".jpg";
|
|
|
me.MsgTime = DateTime.Now;
|
|
|
}
|
|
|
+ else if (ali.MsgType == 10000)
|
|
|
+ {
|
|
|
+ me.MsgType = MsgTypeEnum.SystemMsg;
|
|
|
+ me.MsgTime = DateTime.Now;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
me.MsgType = MsgTypeEnum.Text;
|