示例#1
0
        public void SENDZANMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);

            var model = new SZHL_TSSQB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                Article ar0 = new Article();
                ar0.Title       = "您收到一个赞";
                ar0.Description = "话题:" + CommonHelp.RemoveHtml(model.HTNR) + "\r\n来自:" + UserInfo.User.UserRealName;
                ar0.Url         = model.ID.ToString();
                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                jsr = model.CRUser;

                if (!string.IsNullOrEmpty(jsr))
                {
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, "TSSQ", "A", jsr);
                }
            }
        }
示例#2
0
        public void TSGLMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            SZHL_TXSX TX   = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int       rwid = 0;

            int.TryParse(TX.MsgID, out rwid);
            SZHL_TSGL jy = new SZHL_TSGLB().GetEntity(d => d.ID == rwid);

            Article ar0 = new Article();

            ar0.Title       = TX.TXContent;
            ar0.Description = jy == null ? "" : jy.TSName;
            ar0.Url         = TX.MsgID;
            List <Article> al = new List <Article>();

            al.Add(ar0);
            if (!string.IsNullOrEmpty(TX.TXUser))
            {
                try
                {
                    //发送PC消息
                    UserInfo = new JH_Auth_UserB().GetUserInfo(TX.ComId.Value, TX.CRUser);
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, TX.TXMode, TX.TXContent, TX.MsgID, TX.TXUser, "A", 0, TX.ISCS);
                }
                catch (Exception)
                {
                }
            }

            //发送微信消息
            WXHelp wx = new WXHelp(UserInfo.QYinfo);

            wx.SendTH(al, TX.TXMode, "A", TX.TXUser);
        }
示例#3
0
        public void SENDWXMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);

            int msgid = Int32.Parse(tx.MsgID);

            var qyhd = new SZHL_QYHDNB().GetEntity(p => p.ID == msgid);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, qyhd.CRUser);
            if (qyhd != null)
            {
                ////发送消息
                string content = qyhd.FQF + "发起了以(" + qyhd.Title + ")为主题的" + (qyhd.Type == 0 ? "活动" : "投票");
                new JH_Auth_User_CenterB().SendMsg(UserInfo, "QYHD", content, qyhd.ID.ToString(), qyhd.CYR, qyhd.Type == 1 ? "A" : "B");

                ////发送微信消息
                Article ar = new Article();
                ar.Title       = content;
                ar.Description = "";
                //ar.PicUrl = qyhd.
                ar.Url = qyhd.ID.ToString();

                List <Article> Msgs = new List <Article>();
                Msgs.Add(ar);
                WXHelp wx = new WXHelp(UserInfo.QYinfo);
                wx.SendTH(Msgs, "QYHD", "B", qyhd.CYR);
            }
        }
示例#4
0
 /// <summary>
 /// 创建应用菜单
 /// </summary>
 /// <param name="context"></param>
 /// <param name="msg"></param>
 /// <param name="P1"></param>
 /// <param name="P2"></param>
 /// <param name="UserInfo"></param>
 public void CREATEMENU(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
 {
     try
     {
         int id    = Int32.Parse(P1);
         var model = new JH_Auth_ModelB().GetEntity(p => p.ID == id);
         if (model != null)
         {
             if (string.IsNullOrEmpty(model.Token) || string.IsNullOrEmpty(model.EncodingAESKey) || string.IsNullOrEmpty(model.AppID))
             {
                 msg.ErrorMsg = "Token、EncodingAESKey、企业号应用不能为空";
             }
             else
             {
                 WXHelp WX = new WXHelp(UserInfo.QYinfo);
                 List <Senparc.Weixin.Work.Entities.Menu.BaseButton> lm = new List <Senparc.Weixin.Work.Entities.Menu.BaseButton>();
                 WorkJsonResult rel = WX.WX_WxCreateMenuNew(Int32.Parse(model.AppID), model.ModelCode, ref lm);
                 if (rel.errmsg != "ok")
                 {
                     msg.ErrorMsg = "创建菜单失败";
                 }
             }
         }
         else
         {
             msg.ErrorMsg = "当前应用不存在";
         }
     }
     catch (Exception ex)
     {
         msg.ErrorMsg = "创建菜单失败";
     }
 }
示例#5
0
        /// <summary>
        /// 分享链接的信息
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void SENDWXMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);

            var model = new JH_Auth_WXMSGB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                Article ar0 = new Article();
                ar0.Title       = model.Title;
                ar0.Description = "您收到了" + tx.CRUserRealName + "创建的话题信息,请查阅";
                ar0.Url         = model.ID.ToString();
                ar0.PicUrl      = model.FileId;

                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                jsr = model.CRUser;
                //发送消息
                //string content = ar0.Description;
                //new JH_Auth_User_CenterB().SendMsg(UserInfo, "CRM", content, model.ID.ToString(), jsr, "A");
                if (!string.IsNullOrEmpty(jsr))
                {
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, "TSSQ", "D", jsr);
                }
            }
        }
示例#6
0
        //同步关注状态
        public void TBGZSTATUS(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            try
            {
                JH_Auth_Branch branchModel = new JH_Auth_BranchB().GetEntity(d => d.DeptRoot == -1 && d.ComId == UserInfo.User.ComId);

                #region  步用户关注状态
                WXHelp wx = new WXHelp(UserInfo.QYinfo);
                GetDepartmentMemberInfoResult yg = wx.WX_GetDepartmentMemberInfo(branchModel.WXBMCode.Value);

                if (yg != null && yg.userlist != null)
                {
                    foreach (var u in yg.userlist)
                    {
                        JH_Auth_User user = new JH_Auth_UserB().GetEntity(d => d.ComId == UserInfo.User.ComId && d.UserName == u.userid);

                        if (user != null && u != null && (u.status == 1 || u.status == 4))
                        {
                            user.isgz = u.status.ToString();
                            new JH_Auth_UserB().Update(user);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msg.ErrorMsg = ex.Message;
            }
            #endregion
        }
示例#7
0
        /// <summary>
        /// 发送微信信息
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void SENDXZMSG(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            SZHL_TXSX TX  = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            Article   ar0 = new Article();

            ar0.Title       = TX.TXContent;
            ar0.Description = "";
            ar0.Url         = TX.MsgID;

            List <Article> al = new List <Article>();

            al.Add(ar0);
            if (!string.IsNullOrEmpty(TX.TXUser))
            {
                try
                {
                    //发送PC消息
                    UserInfo = new JH_Auth_UserB().GetUserInfo(TX.ComId.Value, TX.CRUser);
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, TX.TXMode, "A", TX.TXUser);
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, TX.TXMode, TX.TXContent, TX.MsgID, TX.TXUser);
                }
                catch (Exception)
                {
                }
                //发送微信消息
            }
        }
示例#8
0
        public void LCSPCHECK(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            SZHL_TXSX TX = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);

            //todo 需要根据PID找到对应的数据ID
            Article ar0 = new Article();

            ar0.Title       = TX.TXContent;
            ar0.Description = "";
            ar0.Url         = TX.MsgID;
            List <Article> al = new List <Article>();

            al.Add(ar0);
            JH_Auth_UserB.UserInfo UserTXInfo = new JH_Auth_UserB().GetUserInfo(TX.ComId.Value, TX.CRUser);
            if (!string.IsNullOrEmpty(TX.TXUser))
            {
                try
                {
                    //发送PC消息
                    new JH_Auth_User_CenterB().SendMsg(UserTXInfo, TX.TXMode, TX.TXContent, TX.MsgID, TX.TXUser, "A", TX.intProcessStanceid, TX.ISCS);
                }
                catch (Exception)
                {
                }

                //发送微信消息
                WXHelp wx = new WXHelp(UserTXInfo.QYinfo);
                wx.SendTH(al, TX.TXMode, "A", TX.TXUser);
            }
        }
示例#9
0
        public void SENDWXMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);

            int msgid = Int32.Parse(tx.MsgID);

            var model = new SZHL_XXFBB().GetEntity(p => p.ID == msgid);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, model.CRUser);
            if (model != null)
            {
                var item = new SZHL_XXFB_ITEMB().GetEntities(d => d.XXFBId == model.ID);
                if (item.Count() > 0)
                {
                    List <Article> Msgs = new List <Article>();
                    foreach (var v in item)
                    {
                        new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", model.CRUserName + "发布了一个企业信息", v.ID.ToString(), model.JSUser);

                        Article ar = new Article();
                        ar.Title       = v.XXTitle;
                        ar.Description = v.XXTitle;
                        ar.PicUrl      = v.ImageIds.Split(',')[0];
                        ar.Url         = v.ID.ToString();
                        Msgs.Add(ar);
                    }

                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(Msgs, "XXFB", "A", model.JSUser);
                }
            }
        }
示例#10
0
文件: TXSXAPI.cs 项目: fl1029/QJCore
        /// <summary>
        /// 生日提醒
        /// </summary>
        public static void AUTOALERTSR()
        {
            try
            {
                List <JH_Auth_QY> QyModel = new JH_Auth_QYB().GetEntities(d => d.ComId != 0).ToList();
                WXHelp            wx      = new WXHelp(QyModel[0]);

                var qdata = new JH_Auth_UserB().GetEntities(d => d.Birthday != null);
                foreach (var item in qdata)
                {
                    if (item.Birthday.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
                    {
                        Article ar0 = new Article();
                        ar0.Title       = "生日提醒";
                        ar0.Description = "";
                        ar0.Url         = "http://www.baidu.com";
                        ar0.PicUrl      = "";
                        List <Article> al = new List <Article>();
                        al.Add(ar0);
                        wx.SendTPMSG("XXFB", al, item.UserName);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#11
0
        /// <summary>
        /// 同步通讯录
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1">初始化密码</param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>


        #region 企业号相关
        /// <summary>
        /// 将系统的组织架构同步到微信中去
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void TBBRANCHUSER(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            //判断是否启用微信后,启用部门需要同步添加微信部门
            if (UserInfo.QYinfo.IsUseWX == "Y")
            {
                #region  步部门

                //系统部门
                List <JH_Auth_Branch> branchList = new JH_Auth_BranchB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.WXBMCode == null).ToList();

                WXHelp wx = new WXHelp(UserInfo.QYinfo);
                //微信部门
                GetDepartmentListResult bmlist = wx.WX_GetBranchList("");
                foreach (JH_Auth_Branch branch in branchList)
                {
                    List <DepartmentList> departList = bmlist.department.Where(d => d.name == branch.DeptName).ToList();
                    WorkJsonResult        result     = null;
                    if (departList.Count() > 0)
                    {
                        branch.WXBMCode = int.Parse(departList[0].id.ToString());
                        result          = wx.WX_UpdateBranch(branch);
                    }
                    else
                    {
                        int branchWxCode = int.Parse(wx.WX_CreateBranchTB(branch).ToString());
                        branch.WXBMCode = branchWxCode;
                    }
                    new JH_Auth_BranchB().Update(branch);
                }

                #endregion

                #region  步人员
                JH_Auth_Branch branchModel = new JH_Auth_BranchB().GetEntity(d => d.DeptRoot == -1 && d.ComId == UserInfo.User.ComId);

                GetDepartmentMemberInfoResult yg       = wx.WX_GetDepartmentMemberInfo(branchModel.WXBMCode.Value);
                List <JH_Auth_User>           userList = new JH_Auth_UserB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.UserName != "administrator").ToList();
                foreach (JH_Auth_User user in userList)
                {
                    if (yg.userlist.Where(d => d.name == user.UserName || d.mobile == user.mobphone).Count() > 0)
                    {
                        wx.WX_UpdateUser(user);
                    }
                    else
                    {
                        wx.WX_CreateUser(user);
                    }
                }
                #endregion
            }
        }
示例#12
0
文件: MOBAPI.cs 项目: fl1029/QJCore
        /// <summary>
        /// 验证企业号签名
        /// </summary>
        /// <param name="token">企业号配置的Token</param>
        /// <param name="signature">签名内容</param>
        /// <param name="timestamp">时间戳</param>
        /// <param name="nonce">nonce参数</param>
        /// <param name="corpId">企业号ID标识</param>
        /// <param name="encodingAESKey">加密键</param>
        /// <param name="echostr">内容字符串</param>
        /// <param name="retEchostr">返回的字符串</param>
        /// <returns></returns>
        public bool CheckSignature(string token, string signature, string timestamp, string nonce, string corpId, string encodingAESKey, string echostr, ref string retEchostr)
        {
            int result = new WXHelp().CheckSignature(token, encodingAESKey, corpId, signature, timestamp, nonce, echostr, ref retEchostr);

            if (result != 0)
            {
                CommonHelp.WriteLOG("ERR: VerifyURL fail, ret: " + result);
                return(false);
            }

            return(true);

            //ret==0表示验证成功,retEchostr参数表示明文,用户需要将retEchostr作为get请求的返回参数,返回给企业号。
            // HttpUtils.SetResponse(retEchostr);
        }
示例#13
0
        public string ProcessWxIMG(string mediaIds, string strCode, JH_Auth_UserB.UserInfo UserInfo, string strType = ".jpg")
        {
            try
            {
                WXHelp wx  = new WXHelp(UserInfo.QYinfo);
                string ids = "";
                foreach (var mediaId in mediaIds.Split(','))
                {
                    string fileToUpload = wx.GetMediaFile(mediaId, strType);

                    string             md5     = CommonHelp.PostFile(UserInfo.QYinfo, fileToUpload);
                    System.IO.FileInfo f       = new FileInfo(fileToUpload);
                    FT_File            newfile = new FT_File();
                    newfile.ComId          = UserInfo.User.ComId;
                    newfile.Name           = f.Name;
                    newfile.FileMD5        = md5.Replace("\"", "").Split(',')[0];
                    newfile.zyid           = md5.Split(',').Length == 2 ? md5.Split(',')[1] : md5.Split(',')[0];
                    newfile.FileSize       = f.Length.ToString();
                    newfile.FileVersin     = 0;
                    newfile.CRDate         = DateTime.Now;
                    newfile.CRUser         = UserInfo.User.UserName;
                    newfile.UPDDate        = DateTime.Now;
                    newfile.UPUser         = UserInfo.User.UserName;
                    newfile.FolderID       = 3;
                    newfile.FileExtendName = f.Extension.Substring(1);
                    newfile.ISYL           = "Y";
                    new FT_FileB().Insert(newfile);

                    if (ids == "")
                    {
                        ids = newfile.ID.ToString();
                    }
                    else
                    {
                        ids += "," + newfile.ID.ToString();
                    }
                }

                return(ids);
            }
            catch (Exception ex)
            {
                CommonHelp.WriteLOG(ex.ToString());
                return("");
            }
        }
示例#14
0
        public void SENDMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int     Id         = int.Parse(P1);
            var     model      = new SZHL_YCGLB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId);
            string  strContent = "发起人:" + new JH_Auth_UserB().GetUserRealName(UserInfo.User.ComId.Value, model.CRUser) + "\r\n驾驶人:" + new JH_Auth_UserB().GetUserRealName(UserInfo.User.ComId.Value, model.JSR) + "\r\n您有新的用车通知,请尽快查看";
            Article ar0        = new Article();

            ar0.Title       = "用车通知";
            ar0.Description = strContent;
            ar0.Url         = model.ID.ToString();
            List <Article> al = new List <Article>();

            al.Add(ar0);
            //new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", strContent, model.ID.ToString(), model.JSR, "B", model.intProcessStanceid);

            WXHelp wx = new WXHelp(UserInfo.QYinfo);

            wx.SendTH(al, "YCGL", "A", model.JSR);
        }
示例#15
0
        public void SENDHTMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);

            var model = new SZHL_TSSQB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                Article ar0 = new Article();

                ar0.Title       = UserInfo.User.UserRealName + "发表了新话题";
                ar0.Description = CommonHelp.RemoveHtml(model.HTNR);
                ar0.Url         = model.ID.ToString();
                if (!string.IsNullOrEmpty(model.Files))
                {
                    ar0.PicUrl = model.Files.Split(',')[0];
                }
                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                if (!string.IsNullOrEmpty(model.CYR))
                {
                    jsr = model.CYR;
                }
                else
                {
                    jsr = new JH_Auth_UserB().GetEntities(p => p.ComId == UserInfo.QYinfo.ComId).Select(d => d.UserName).ToList().ListTOString(',');
                }
                //发送消息
                string content = ar0.Description;
                new JH_Auth_User_CenterB().SendMsg(UserInfo, "TSSQ", content, model.ID.ToString(), jsr, "A");
                if (!string.IsNullOrEmpty(jsr))
                {
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, "TSSQ", "A", jsr);
                }
            }
        }
示例#16
0
        public void SENDMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int Id    = int.Parse(P1);
            var model = new SZHL_HYGLB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId);
            var rm    = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId);

            Article ar0 = new Article();

            ar0.Title       = "会议通知";
            ar0.Description = "发起人:" + new JH_Auth_UserB().GetUserRealName(UserInfo.User.ComId.Value, model.CRUser) + "\r\n您有新的会议[" + model.Title + "],会议室[" + rm.Name + "],请尽快查看吧";
            ar0.Url         = model.ID.ToString();
            List <Article> al = new List <Article>();

            al.Add(ar0);
            //new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", strContent, model.ID.ToString(), model.JSR, "B", model.intProcessStanceid);

            WXHelp wx = new WXHelp(UserInfo.QYinfo);

            wx.SendTH(al, "HYGL", "A", model.CYUser);
        }
示例#17
0
        public void REGISTERYS(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string       strXM    = P2;
            string       strPhone = P1;
            JH_Auth_User user1    = new JH_Auth_UserB().GetUserByUserName(10334, P1);

            if (user1 != null)
            {
                msg.ErrorMsg = "用户已存在";
                return;
            }
            JH_Auth_User user = new JH_Auth_User();

            user.UserName     = strPhone;
            user.mobphone     = strPhone;
            user.UserRealName = P2;
            user.UserPass     = CommonHelp.GetMD5("abc123");
            user.ComId        = 10334;
            user.BranchCode   = 1728;
            user.CRDate       = DateTime.Now;
            user.CRUser       = "******";
            user.logindate    = DateTime.Now;
            user.IsUse        = "Y";
            if (!new JH_Auth_UserB().Insert(user))
            {
                msg.ErrorMsg = "添加用户失败";
            }
            else
            {
                JH_Auth_QY QY = new JH_Auth_QYB().GetEntity(d => d.ComId == 10334);
                WXHelp     wx = new WXHelp(QY);
                wx.WX_CreateUser(user);

                //添加默认员工角色
                JH_Auth_UserRole Model = new JH_Auth_UserRole();
                Model.UserName = user.UserName;
                Model.RoleCode = 1219;
                Model.ComId    = user.ComId;
                new JH_Auth_UserRoleB().Insert(Model);
            }
        }
示例#18
0
        /// <summary>
        /// 信息发布审核
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void SHXXFB(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string strSql = string.Format("UPDATE SZHL_XXFB set SHStatus={0} ,SHYJ='{1}',SHDate=getdate() where ID in ({2}) and ComId={3}", P2, context.Request["jy"] ?? "", P1, UserInfo.User.ComId);

            new SZHL_XXFBB().ExsSql(strSql);
            int[] Ids = P1.SplitTOInt(',');
            foreach (int ID in Ids)
            {
                SZHL_XXFB     model = new SZHL_XXFBB().GetEntity(d => d.ID == ID);
                SZHL_XXFBType type  = new SZHL_XXFBTypeB().GetEntity(d => d.ID == model.XXFBType);
                //判断审核状态为审核通过,给接收人发送消息
                if (model.SHStatus == 1)
                {
                    if (type.ISzjfb.ToLower() == "true")  //判断审核通过直接发布
                    {
                        SUREXXFB(context, msg, ID.ToString(), P2, UserInfo);
                    }
                    else
                    {
                        //给接收人发送消息
                        SZHL_TXSX tx = new SZHL_TXSX();
                        tx.ComId   = UserInfo.User.ComId;
                        tx.APIName = "XXFB";
                        tx.TXMode  = "XXFB";
                        tx.MsgID   = model.ID.ToString();
                        tx.CRUser  = UserInfo.User.UserName;
                        tx.FunName = "SENDWXMSG_CHECK";
                        tx.Date    = model.FBTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                        TXSX.TXSXAPI.AddALERT(tx); //时间为发送时间
                    }
                }
                else
                if (model.SHStatus == -1)    //退回发送PC消息及微信消息
                {
                    string strMsg = UserInfo.User.UserRealName + "退回了您发布的企业信息";
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", strMsg, model.ID.ToString(), model.CRUser);
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendWXRText(strMsg, "XXFB", model.CRUser);
                }
            }
        }
示例#19
0
        public void SENDWQMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);

            var model = new SZHL_WQQDB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                Article ar0 = new Article();

                ar0.Title       = "外勤签到提醒";
                ar0.Description = "签到人:" + UserInfo.User.UserRealName + "\r\n签到位置:" + model.Position + "\r\n签到备注:" + CommonHelp.RemoveHtml(model.QDContent) + "\r\n签到时间:" + model.CRDate;
                ar0.Url         = model.ID.ToString();
                if (!string.IsNullOrEmpty(model.Files))
                {
                    ar0.PicUrl = model.Files.Split(',')[0];
                }
                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                if (!string.IsNullOrEmpty(model.HBUser))
                {
                    jsr = model.HBUser;

                    //发送消息
                    string content = ar0.Description;
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, "WQQD", content, model.ID.ToString(), jsr, "A");
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        WXHelp wx = new WXHelp(UserInfo.QYinfo);
                        wx.SendTH(al, "WQQD", "A", jsr);
                    }
                }
            }
        }
示例#20
0
        //发送审核消息
        public void SENDWXMSG_CHECK(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int ID    = Int32.Parse(tx.MsgID);
            var model = new SZHL_XXFBB().GetEntity(p => p.ID == ID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, model.CRUser);
            if (model != null)
            {
                if (model.SHStatus == 0 || model.SHStatus == 1) //如果已处理,则不再发消息
                {
                    string  wxflag = "B";                       //审核页面
                    string  JSUser = "";
                    Article ar0    = new Article();
                    if (model.SHStatus == 0)
                    {
                        JSUser    = model.SHUser;
                        ar0.Title = model.CRUserName + "发布了一个企业信息,请您审核";
                    }
                    else if (model.SHStatus == 1)
                    {
                        ar0.Title = new JH_Auth_UserB().GetUserRealName(UserInfo.QYinfo.ComId, model.SHUser) + "审核了一个企业信息,请您确认发布";
                        JSUser    = model.CRUser;
                        wxflag    = "C"; //发布确认页面
                    }
                    ar0.Description = "";
                    ar0.Url         = model.XXFBType.ToString();

                    List <Article> al = new List <Article>();
                    al.Add(ar0);

                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, "XXFB", ar0.Title, model.ID.ToString(), JSUser, wxflag);
                    wx.SendTH(al, "XXFB", wxflag, JSUser);
                }
            }
        }
示例#21
0
文件: TXSXAPI.cs 项目: fl1029/QJCore
        public static void AUTOALERT()
        {
            lock (islock)
            {
                var txLst = new SZHL_TXSXB().GetEntities(p => p.Status == "0");

                foreach (var model in txLst)
                {
                    try
                    {
                        bool canclose = false; //是否结束
                        bool cansend  = false; //是否发送提醒
                        bool upcount  = false; //是否更新次数
                        switch (model.TXType)
                        {
                        case "0":      //立即发送
                        {
                            cansend  = true;
                            canclose = true;
                            upcount  = true;
                        }
                        break;

                        case "1":      //仅一次
                        {
                            DateTime sd = DateTime.Parse(model.Date + " " + model.Hour + ":" + model.Minute + ":00");
                            if (DateTime.Now >= sd)
                            {
                                cansend  = true;
                                canclose = true;
                                upcount  = true;
                            }
                        }
                        break;

                        case "2":      //每个工作日
                        {
                            DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00");

                            if ((DateTime.Now.DayOfWeek == DayOfWeek.Monday ||
                                 DateTime.Now.DayOfWeek == DayOfWeek.Tuesday ||
                                 DateTime.Now.DayOfWeek == DayOfWeek.Wednesday ||
                                 DateTime.Now.DayOfWeek == DayOfWeek.Thursday ||
                                 DateTime.Now.DayOfWeek == DayOfWeek.Friday
                                 ) && DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
                            {
                                upcount = true;
                            }
                        }
                        break;

                        case "3":      //每天
                        {
                            DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00");

                            if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))))
                            {
                                upcount = true;
                            }
                        }
                        break;

                        case "5":      //每月
                        {
                            DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-" + model.Days + " " + model.Hour + ":" + model.Minute + ":00");

                            if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM") != DateTime.Now.ToString("yyyy-MM"))))
                            {
                                upcount = true;
                            }
                        }
                        break;

                        case "4":      //自定义
                        {
                            string Days = model.Days;
                            foreach (var d in Days.Split(','))
                            {
                                if (getWkDays(d) == DateTime.Now.DayOfWeek)
                                {
                                    DateTime sd = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Hour + ":" + model.Minute + ":00");
                                    if ((DateTime.Now > sd && (model.LstSendTime == null || model.LstSendTime.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))))
                                    {
                                        upcount = true;
                                    }
                                }
                            }
                        }
                        break;
                        }
                        if (upcount)
                        {
                            if (model.CFType == "1")
                            {
                                cansend = true;
                            }
                            else if (model.CFType == "2" && model.CFCount.Value > model.ZXCount) //次数
                            {
                                cansend = true;
                                if (model.CFCount.Value == model.ZXCount.Value + 1) //到次数,可以结束
                                {
                                    canclose = true;
                                }
                            }
                            else if (model.CFType == "3" && DateTime.Now < model.CFJZDate.Value)
                            {
                                cansend = true;
                            }

                            new SZHL_TXSXB().ExsSql("update SZHL_TXSX set ZXCount=isnull(ZXCount,0)+1,LstSendTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where ID=" + model.ID);
                        }
                        if (cansend)
                        {
                            bool smsg   = false;
                            bool swx    = false;
                            bool swxapi = false;
                            if (model.Type == "0") //短信和微信
                            {
                                smsg = true;
                                swx  = true;
                            }
                            else if (model.Type == "1")  //短信
                            {
                                smsg = true;
                            }
                            else if (model.Type == "2") //微信
                            {
                                swx = true;
                            }
                            else if (model.Type == "3")  //调接口
                            {
                                swxapi = true;
                            }

                            if (smsg)  //发短信
                            {
                                foreach (var m in model.TXUser.Split(','))
                                {
                                    object u = new SZHL_TXSXB().ExsSclarSql("select mobphone from JH_Auth_User where UserName='******' and comid='" + model.ComId + "'");
                                    if (u != null)
                                    {
                                        new SZHL_DXGLB().SendSMS(u.ToString(), model.CRUserRealName + "给您添加了提醒\n" + model.TXContent, model.ComId.Value);
                                    }
                                }
                            }
                            if (swx) //发微信
                            {
                                Article a = new Article();
                                a.Title = "日程提醒";

                                a.Description = model.CRUserRealName + "给您添加了提醒\n" + model.TXContent;
                                a.Url         = model.ID.ToString();

                                List <Article> al = new List <Article>();
                                al.Add(a);
                                JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB().GetUserInfo(model.ComId.Value, model.CRUser);

                                try
                                {
                                    new JH_Auth_User_CenterB().SendMsg(UserInfo, model.TXMode, model.TXContent, model.ID.ToString(), model.TXUser, "A", 0, model.ISCS);
                                }
                                catch (Exception)
                                {
                                }

                                WXHelp wx = new WXHelp(UserInfo.QYinfo);
                                wx.SendTH(al, model.TXMode, model.WXLink, model.TXUser);
                            }
                            if (swxapi)  //调接口
                            {
                                try
                                {
                                    Msg_Result Model = new Msg_Result()
                                    {
                                        Action = model.FunName, ErrorMsg = ""
                                    };

                                    // 1.Load(命名空间名称),GetType(命名空间.类名)
                                    Type type = Assembly.Load("QJY.API").GetType("QJY.API." + model.APIName + "Manage");
                                    //2.GetMethod(需要调用的方法名称)
                                    MethodInfo method = type.GetMethod(model.FunName.ToUpper());
                                    // 3.调用的实例化方法(非静态方法)需要创建类型的一个实例
                                    object obj = Activator.CreateInstance(type);
                                    //4.方法需要传入的参数
                                    JObject  JsonData   = new JObject();
                                    object[] parameters = new object[] { JsonData, Model, JsonConvert.SerializeObject(model), "", null };
                                    method.Invoke(obj, parameters);
                                    //TEST
                                }
                                catch (Exception ex)
                                {
                                    canclose = true;
                                    new JH_Auth_LogB().Insert(new JH_Auth_Log()
                                    {
                                        LogType    = "TXSX",
                                        LogContent = ex.ToString(),
                                        CRDate     = DateTime.Now
                                    });
                                }
                            }
                        }
                        if (canclose)
                        {
                            new SZHL_TXSXB().ExsSql("update SZHL_TXSX set Status='1' where ID=" + model.ID);
                        }
                    }
                    catch (Exception ex)
                    {
                        string ss = ex.Message;
                    }
                }
            }
        }
示例#22
0
        /// <summary>
        /// 从企业微信同步到系统里
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void TBTXL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            try
            {
                int bmcount = 0;
                int rycount = 0;
                if (P1 == "")
                {
                    msg.ErrorMsg = "请输入初始密码";
                    return;
                }
                WXHelp wx = new WXHelp(UserInfo.QYinfo);
                #region 更新部门
                GetDepartmentListResult bmlist = wx.WX_GetBranchList("");
                foreach (var wxbm in bmlist.department.OrderBy(d => d.parentid))
                {
                    var bm = new JH_Auth_BranchB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.WXBMCode == wxbm.id);
                    if (bm == null)
                    {
                        #region 新增部门
                        JH_Auth_Branch jab = new JH_Auth_Branch();
                        jab.WXBMCode  = int.Parse(wxbm.id.ToString());
                        jab.ComId     = UserInfo.User.ComId;
                        jab.DeptName  = wxbm.name;
                        jab.DeptDesc  = wxbm.name;
                        jab.DeptShort = int.Parse(wxbm.order.ToString());

                        if (wxbm.parentid == 0)//如果是跟部门,设置其跟部门为-1
                        {
                            jab.DeptRoot = -1;
                        }
                        else
                        {
                            var bm1 = new JH_Auth_BranchB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.WXBMCode == wxbm.parentid);
                            jab.DeptRoot = bm1.DeptCode;
                            jab.Remark1  = new JH_Auth_BranchB().GetBranchNo(UserInfo.User.ComId.Value, jab.DeptRoot);
                        }


                        new JH_Auth_BranchB().Insert(jab);
                        jab.Remark1 = new JH_Auth_BranchB().GetBranchNo(UserInfo.User.ComId.Value, jab.DeptRoot) + jab.DeptCode;
                        new JH_Auth_BranchB().Update(jab);


                        bmcount = bmcount + 1;
                        #endregion
                    }
                    else
                    {
                        //同步部门时放弃更新现有部门
                    }
                }
                #endregion

                #region 更新人员
                JH_Auth_Branch branchModel = new JH_Auth_BranchB().GetEntity(d => d.DeptRoot == -1 && d.ComId == UserInfo.User.ComId);

                GetDepartmentMemberInfoResult yg = wx.WX_GetDepartmentMemberInfo(branchModel.WXBMCode.Value);
                foreach (var u in yg.userlist)
                {
                    var user = new JH_Auth_UserB().GetUserByUserName(UserInfo.QYinfo.ComId, u.userid);
                    if (user == null)
                    {
                        #region 新增人员
                        JH_Auth_User jau = new JH_Auth_User();
                        jau.ComId        = UserInfo.User.ComId;
                        jau.UserName     = u.userid;
                        jau.UserPass     = CommonHelp.GetMD5(P1);
                        jau.UserRealName = u.name;
                        jau.Sex          = u.gender == 1 ? "男" : "女";
                        if (u.department.Length > 0)
                        {
                            int id  = int.Parse(u.department[0].ToString());
                            var bm1 = new JH_Auth_BranchB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.WXBMCode == id);
                            jau.BranchCode = bm1.DeptCode;
                            jau.remark     = bm1.Remark1.Split('-')[0];//用户得部门路径
                        }
                        jau.mailbox  = u.email;
                        jau.mobphone = u.mobile;
                        jau.zhiwu    = string.IsNullOrEmpty(u.position) ? "员工" : u.position;
                        jau.IsUse    = "Y";

                        if (u.status == 1 || u.status == 4)
                        {
                            jau.isgz = u.status.ToString();
                        }
                        jau.txurl = u.avatar;

                        new JH_Auth_UserB().Insert(jau);

                        rycount = rycount + 1;
                        #endregion

                        //为所有人增加普通员工的权限
                        JH_Auth_Role rdefault = new JH_Auth_RoleB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.isSysRole == "Y" && p.RoleName == "员工");//找到默认角色
                        if (rdefault != null)
                        {
                            JH_Auth_UserRole jaurdefault = new JH_Auth_UserRole();
                            jaurdefault.ComId    = UserInfo.User.ComId;
                            jaurdefault.RoleCode = rdefault.RoleCode;
                            jaurdefault.UserName = jau.UserName;
                            new JH_Auth_UserRoleB().Insert(jaurdefault);
                        }
                    }
                    else
                    {
                        //同步人员时放弃更新现有人员
                        #region 更新人员
                        user.UserRealName = u.name;
                        if (u.department.Length > 0)
                        {
                            int id  = int.Parse(u.department[0].ToString());
                            var bm1 = new JH_Auth_BranchB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.WXBMCode == id);
                            user.BranchCode = bm1.DeptCode;
                        }
                        user.mailbox  = u.email;
                        user.mobphone = u.mobile;
                        user.zhiwu    = string.IsNullOrEmpty(u.position) ? "员工" : u.position;
                        user.Sex      = u.gender == 1 ? "男" : "女";
                        if (u.status == 1 || u.status == 4)
                        {
                            user.IsUse = "Y";
                            user.isgz  = u.status.ToString();
                        }
                        else if (u.status == 2)
                        {
                            user.IsUse = "N";
                        }
                        user.txurl = u.avatar;

                        new JH_Auth_UserB().Update(user);
                        #endregion
                    }

                    #region 更新角色(职务)
                    if (!string.IsNullOrEmpty(u.position))
                    {
                        var r = new JH_Auth_RoleB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.RoleName == u.position);

                        if (r == null)
                        {
                            JH_Auth_Role jar = new JH_Auth_Role();
                            jar.ComId        = UserInfo.User.ComId;
                            jar.RoleName     = u.position;
                            jar.RoleDec      = u.position;
                            jar.PRoleCode    = 0;
                            jar.isSysRole    = "N";
                            jar.IsUse        = "Y";
                            jar.leve         = 0;
                            jar.DisplayOrder = 0;

                            new JH_Auth_RoleB().Insert(jar);

                            JH_Auth_UserRole jaur = new JH_Auth_UserRole();
                            jaur.ComId    = UserInfo.User.ComId;
                            jaur.RoleCode = jar.RoleCode;
                            jaur.UserName = u.userid;
                            new JH_Auth_UserRoleB().Insert(jaur);
                        }
                        else
                        {
                        }
                    }
                    #endregion
                }
                #endregion



                msg.Result1 = bmcount;
                msg.Result2 = rycount;
            }
            catch (Exception ex)
            {
                msg.ErrorMsg = ex.ToString();
            }
        }
示例#23
0
文件: MOBAPI.cs 项目: fl1029/QJCore
        public void GETSIGNAGURE(Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            try
            {
                WXHelp wx           = new WXHelp(UserInfo.QYinfo);
                string url          = P1;
                string jsapi_ticket = wx.GetTicket().ticket;
                string noncestr     = CreatenNonce_str();
                long   timestamp    = CreatenTimestamp();

                var string1Builder = new StringBuilder();
                string1Builder.Append("jsapi_ticket=").Append(jsapi_ticket).Append("&")
                .Append("noncestr=").Append(noncestr).Append("&")
                .Append("timestamp=").Append(timestamp).Append("&")
                .Append("url=").Append(url.IndexOf("#") >= 0 ? url.Substring(0, url.IndexOf("#")) : url);
                string string1 = string1Builder.ToString();

                byte[]        StrRes = Encoding.Default.GetBytes(string1);
                HashAlgorithm iSHA   = new SHA1CryptoServiceProvider();
                StrRes = iSHA.ComputeHash(StrRes);
                StringBuilder EnText = new StringBuilder();
                foreach (byte iByte in StrRes)
                {
                    EnText.AppendFormat("{0:x2}", iByte);
                }
                //return EnText.ToString();

                msg.Result =
                    new JObject(
                        new JProperty("appId", UserInfo.QYinfo.corpId),
                        new JProperty("noncestr", noncestr),
                        new JProperty("timestamp", timestamp),
                        new JProperty("signature", EnText.ToString())
                        );

                //通讯录权限验证
                if (!string.IsNullOrEmpty(P2) && P2 == "GROUP")
                {
                    var    g_ticket   = wx.GetGroup_Ticket();
                    string noncestr2  = CreatenNonce_str();
                    long   timestamp2 = CreatenTimestamp();

                    var string1Builder2 = new StringBuilder();
                    string1Builder2.Append("group_ticket=").Append(g_ticket.ticket).Append("&")
                    .Append("noncestr=").Append(noncestr2).Append("&")
                    .Append("timestamp=").Append(timestamp2).Append("&")
                    .Append("url=").Append(url.IndexOf("#") >= 0 ? url.Substring(0, url.IndexOf("#")) : url);
                    string string2 = string1Builder2.ToString();

                    byte[]        StrRes2 = Encoding.Default.GetBytes(string2);
                    HashAlgorithm iSHA2   = new SHA1CryptoServiceProvider();
                    StrRes2 = iSHA2.ComputeHash(StrRes2);
                    StringBuilder EnText2 = new StringBuilder();
                    foreach (byte iByte in StrRes2)
                    {
                        EnText2.AppendFormat("{0:x2}", iByte);
                    }

                    msg.Result1 =
                        new JObject(
                            new JProperty("group_id", g_ticket.group_id),
                            new JProperty("noncestr", noncestr2),
                            new JProperty("timestamp", timestamp2),
                            new JProperty("signature", EnText2.ToString())
                            );
                }
            }
            catch (Exception ex)
            {
                msg.ErrorMsg = ex.ToString();
            }
        }
示例#24
0
        /// <summary>
        /// 会议管理发送消息
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void SENDWXMSG(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);
            var model = new SZHL_HYGLB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                var     user = new JH_Auth_UserB().GetUserByUserName(model.ComId.Value, model.CRUser);
                var     rm   = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId);
                Article ar0  = new Article();
                ar0.Title       = "会议通知";
                ar0.Description = "发起人:" + user.UserRealName + "\r\n您有新的会议[" + model.Title + "],会议室[" + rm.Name + "],请尽快查看吧";
                ar0.Url         = model.ID.ToString();

                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                if (!string.IsNullOrEmpty(model.FQUser))
                {
                    jsr = model.FQUser;
                }
                if (!string.IsNullOrEmpty(model.CYUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.CYUser;
                    }
                    else
                    {
                        jsr = model.CYUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.ZCUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.ZCUser;
                    }
                    else
                    {
                        jsr = model.ZCUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.JLUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.JLUser;
                    }
                    else
                    {
                        jsr = model.JLUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.SXUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.SXUser;
                    }
                    else
                    {
                        jsr = model.SXUser;
                    }
                }

                UserInfo = new JH_Auth_UserB().GetUserInfo(model.ComId.Value, model.CRUser);
                if (!string.IsNullOrEmpty(jsr))
                {
                    //发送消息
                    string content = user.UserRealName + "邀请您参加会议:" + model.Title;
                    new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", content, model.ID.ToString(), jsr, "B", model.intProcessStanceid, tx.ISCS);

                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, "HYGL", "A", jsr);
                }

                if (model.TXSJ > 0)
                {
                    DateTime  dt  = model.StartTime.ToDateTime().AddMinutes(-model.TXSJ.Value);
                    SZHL_TXSX tx1 = new SZHL_TXSX();
                    tx1.ComId   = model.ComId;
                    tx1.APIName = "HYGL";
                    tx1.MsgID   = model.ID.ToString();
                    tx1.FunName = "SENDWXMSG_TX";
                    tx1.Date    = dt.ToString("yyyy-MM-dd HH:mm:ss");
                    tx1.CRUser  = model.CRUser;
                    tx1.CRDate  = DateTime.Now;
                    TXSX.TXSXAPI.AddALERT(tx1); //时间为发送时间

                    //TXSX.TXSXAPI.AddALERT(UserInfo.User.ComId.Value, "HYGL", "SENDWXMSG_TX", model.ID.ToString(), dt); //时间为发送时间
                }
            }
        }
示例#25
0
        /// <summary>
        /// 会议发送提醒信息
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void SENDWXMSG_TX(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var tx    = JsonConvert.DeserializeObject <SZHL_TXSX>(P1);
            int msgid = Int32.Parse(tx.MsgID);

            UserInfo = new JH_Auth_UserB().GetUserInfo(tx.ComId.Value, tx.CRUser);

            var model = new SZHL_HYGLB().GetEntity(p => p.ID == msgid && p.ComId == UserInfo.User.ComId);

            if (model != null)
            {
                var     rm  = new SZHL_HYGL_ROOMB().GetEntity(p => p.ID == model.RoomID && p.ComId == UserInfo.User.ComId);
                Article ar0 = new Article();
                ar0.Title       = "会议提醒";
                ar0.Description = "发起人:" + UserInfo.User.UserRealName + "\r\n您有会议[" + model.Title + "],会议室[" + rm.Name + "],将于" + model.StartTime.Value.ToString("yyyy-MM-dd HH:mm") + "开始,请及时参加";
                ar0.Url         = model.ID.ToString();

                List <Article> al = new List <Article>();
                al.Add(ar0);

                string jsr = string.Empty;
                if (!string.IsNullOrEmpty(model.FQUser))
                {
                    jsr = model.FQUser;
                }
                if (!string.IsNullOrEmpty(model.CYUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.CYUser;
                    }
                    else
                    {
                        jsr = model.CYUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.ZCUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.ZCUser;
                    }
                    else
                    {
                        jsr = model.ZCUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.JLUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.JLUser;
                    }
                    else
                    {
                        jsr = model.JLUser;
                    }
                }
                if (!string.IsNullOrEmpty(model.SXUser))
                {
                    if (!string.IsNullOrEmpty(jsr))
                    {
                        jsr = jsr + "," + model.SXUser;
                    }
                    else
                    {
                        jsr = model.SXUser;
                    }
                }

                ////发送消息
                string content = ar0.Description;
                new JH_Auth_User_CenterB().SendMsg(UserInfo, "HYGL", content, model.ID.ToString(), jsr, "B", model.intProcessStanceid, tx.ISCS);
                if (!string.IsNullOrEmpty(jsr))
                {
                    WXHelp wx = new WXHelp(UserInfo.QYinfo);
                    wx.SendTH(al, "HYGL", "A", jsr);
                }
            }
        }