Ejemplo n.º 1
0
        public override string Handle()
        {
            UserInfoService      UserBLL      = new UserInfoService();
            WechatMsgInfoService WechatMsgBLL = new WechatMsgInfoService();

            if (WechatMsgBLL.GetList(p => p.MsgId == MsgId).Count() != 0)
            {
                return("success");
            }
            WechatMsgInfo info = new WechatMsgInfo();

            info.CreateUserID = UserBLL.GetList(p => p.Name == DicInfo.Admin).FirstOrDefault().ID;
            info.AddDate      = DateTime.Now;
            info.Status       = 1;
            info.ToUserName   = ToUserName;
            info.FromUserName = FromUserName;
            info.CreateTime   = CreateTime;
            info.MsgType      = MsgType;
            info.Content      = PicUrl;
            info.MsgId        = MsgId;
            info.XMLDom       = XmlDom;
            WechatMsgBLL.Create(info);

            return("success");
        }
Ejemplo n.º 2
0
        public override string Handle()
        {
            UserInfoService      UserBLL      = new UserInfoService();
            WechatMsgInfoService WechatMsgBLL = new WechatMsgInfoService();

            UserInfo infoUser = UserBLL.GetList(p => p.WechatOpenID == FromUserName).FirstOrDefault();

            if (infoUser == null)
            {
                infoUser = UserBLL.GetList(p => p.Name == DicInfo.Admin).FirstOrDefault();
            }
            if (WechatMsgBLL.GetList(p => p.MsgId == MsgId).Count() != 0)
            {
                return("success");
            }
            WechatMsgInfo info = new WechatMsgInfo();

            info.CreateUserID = infoUser.ID;
            info.AddDate      = DateTime.Now;
            info.Status       = 1;
            info.ToUserName   = ToUserName;
            info.FromUserName = FromUserName;
            info.CreateTime   = CreateTime;
            info.MsgType      = MsgType;
            info.Content      = Content;
            info.MsgId        = MsgId;
            info.XMLDom       = XmlDom;
            WechatMsgBLL.Create(info);

            var PowerKey = string.Empty;// PowerInfo.P_通知管理.PP微信消息.PPP微信会话管理.接口新消息推送;

            var listUser = UserBLL.GetList(p => p.RuleInfo.Any(r => r.PowerActionInfo.Any(pa => pa.NewID == PowerKey)));

            foreach (var item in listUser)
            {
                if (string.IsNullOrEmpty(item.WechatOpenID))
                {
                    continue;
                }
                new Eval.BLL.WechatService.TemplateMsg().ResponseTemplateMsgNewWechatMsg(info, item.WechatOpenID);
            }
            return(ResponseText("消息收到,相关人员将稍候回复您"));
        }