Esempio n. 1
0
        /// <summary>
        /// 获取群组小程序码和群组名称等内容
        /// </summary>
        /// <param name="path">小程序码跳转路径</param>
        /// <param name="groupID">群组ID</param>
        /// <returns></returns>
        public string GetQRCodeAndGroupDetail(string path, string groupID)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetQRCodeAndGroupDetail方法获取到的参数:path:" + path + "-----groupID:" + groupID);
            Dictionary <string, object> dic = new Dictionary <string, object>();
            JavaScriptSerializer        js  = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            //获取小程序码图片的路径
            string QRCodePath = GetQRCode_Group(path, groupID);

            dic.Add("QRCodePath", QRCodePath);
            //获取群组名称和简介
            GroupEL groupEL = new GroupEL();

            groupEL.ID = long.Parse(groupID);
            groupEL.ExecuteEL(3);
            string groupName      = groupEL.GroupName;
            string groupIntroduce = groupEL.Introduce.Length < 20? groupEL.Introduce: groupEL.Introduce.Substring(0, 20) + "...";

            dic.Add("GroupName", groupName);
            dic.Add("GroupIntroduce", groupIntroduce);
            //获取群成员公司名称(最多5个)
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();

            userGroupEL.GroupID = long.Parse(groupID);
            DataTable dt = userGroupEL.ExecDT(34);

            HF.Cloud.BLL.Common.Logger.Error("GetQRCodeAndGroupDetail方法获取到的公司个数:" + dt.Rows.Count);
            List <string> companyNameList = new List <string>();

            if (dt != null && dt.Rows.Count > 0)
            {
                if (dt.Rows.Count <= 5)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        companyNameList.Add(dt.Rows[i]["CompanyName"].ToString());
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        companyNameList.Add(dt.Rows[i]["CompanyName"].ToString());
                    }
                }
            }
            dic.Add("CompanyList", companyNameList);
            string returnJS = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetQRCodeAndGroupDetail方法返回的数据:returnJS:" + returnJS);
            return(returnJS);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取通知列表
        /// </summary>
        /// <param name="session">用户session</param>
        /// <param name="noticeType">标志要请求的通知类型,0全部通知,1个人通知,2系统通知</param>
        /// <returns></returns>
        public string GetNotice(string session, string noticeType)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到参数session:" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过session获取用户ID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到userID:" + userID);
            NoticeEL noticeEL = new NoticeEL();

            noticeEL.UserID = userID;
            DataTable dt = new DataTable();

            if (noticeType == "0")//全部通知
            {
                string sqlString = "select* from (" +
                                   "select N.ID as NID, S.ID as SID, N.UserID_Friend,N.GroupID," +
                                   "ISNULL(N.UserID, S.UserID) as UserID," +
                                   "ISNULL(N.NoticeType, S.NoticeType) as NoticeType," +
                                   "N.NoticeState, S.NoticeTitle, S.NoticeContent, s.AddressUrl," +
                                   "ISNULL(N.IsLook, S.IsLook) as IsLook," +
                                   "ISNULL(N.CreateTime, S.CreateTime) as CreateTime," +
                                   "ISNULL(N.Valid, S.Valid) as Valid " +
                                   "from Notice as N full join Notice_System as S  on N.CreateTime = S.CreateTime) as T " +
                                   "WHERE[UserID] = " + userID +
                                   " and[Valid] = 1 order by CreateTime desc";

                HF.Cloud.BLL.Common.Logger.Error("GetNotice方法联表查询语句:" + sqlString);
                dt = noticeEL.ExecuteSqlString(sqlString);
            }
            if (noticeType == "1")//个人通知
            {
                dt = noticeEL.ExecDT(21);
            }
            if (noticeType == "2")//系统通知
            {
                Notice_SystemEL nsEL = new Notice_SystemEL();
                nsEL.UserID = userID;
                dt          = nsEL.ExecDT(21);
            }
            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到通知个数:" + dt.Rows.Count);
            SB_UserEL  userEL    = new SB_UserEL();
            CompanysEL companyEL = new CompanysEL();
            GroupEL    groupEL   = new GroupEL();

            foreach (DataRow dr in dt.Rows)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                if (noticeType == "0")
                {
                    if (dr["NoticeType"].ToString() == "2")        //如果是系统通知
                    {
                        dic.Add("NoticeID", dr["SID"].ToString()); //联合表里系统通知表的通知ID
                        string noticeTitleStr = dr["NoticeTitle"].ToString();
                        string noticeTitle    = noticeTitleStr.Length > 10 ? noticeTitleStr.Substring(0, 10) + "..." : noticeTitleStr;
                        dic.Add("NoticeTitle", noticeTitle);
                        string noticeContentStr = dr["NoticeContent"].ToString();
                        string noticeContent    = noticeContentStr.Length > 20 ? noticeContentStr.Substring(0, 20) + "..." : noticeContentStr;
                        dic.Add("NoticeContent", noticeContent);
                        dic.Add("AddressUrl", dr["AddressUrl"].ToString());
                        dic.Add("NoticeType", "2");
                        dic.Add("IsLook", dr["IsLook"].ToString());
                        dic.Add("CreateTime", dr["CreateTime"].ToString());
                    }
                    else
                    {
                        long userID_Friend = long.Parse(dr["UserID_Friend"].ToString());
                        //通过UserID_Friend获取用户头像名字公司ID
                        userEL.ID = userID_Friend;
                        userEL.ExecuteEL(4);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友名字:" + userEL.UserName);
                        string friend_Img       = userEL.ImgUrl;
                        string friend_Name      = userEL.UserName;
                        string friend_Session   = userEL.Session_True;
                        long   friend_CompanyID = userEL.CompanyID;

                        companyEL.ID = friend_CompanyID;
                        companyEL.ExecuteEL(2);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友公司名字:" + companyEL.CompanyName);
                        string friend_CompanyName = companyEL.CompanyName;
                        //获取群组相关
                        if (dr["NoticeType"].ToString() == "3")//3为群组审核通知
                        {
                            long groupID = long.Parse(dr["GroupID"].ToString());
                            groupEL.ID = groupID;
                            groupEL.ExecuteEL(3);
                            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到群组名称:" + groupEL.GroupName + "---群组ID:" + groupID);
                            dic.Add("GroupID", groupID.ToString());  //群组ID,入群审核用
                            dic.Add("GroupName", groupEL.GroupName); //群组名称,入群审核用
                        }

                        dic.Add("UserName", friend_Name);
                        dic.Add("Session", friend_Session);
                        dic.Add("ImgUrl", friend_Img);
                        dic.Add("CompanyName", friend_CompanyName);
                        dic.Add("NoticeID", dr["NID"].ToString());//NID这里是用的联表查询里的个人通知的ID
                        dic.Add("CreateTime", dr["CreateTime"].ToString());
                        dic.Add("NoticeType", dr["NoticeType"].ToString());
                        dic.Add("NoticeState", dr["NoticeState"].ToString());
                        dic.Add("IsLook", dr["IsLook"].ToString());
                    }
                }
                if (noticeType == "1")//个人通知
                {
                    long userID_Friend = long.Parse(dr["UserID_Friend"].ToString());
                    //通过UserID_Friend获取用户头像名字公司ID
                    userEL.ID = userID_Friend;
                    userEL.ExecuteEL(4);
                    HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友名字:" + userEL.UserName);
                    string friend_Img       = userEL.ImgUrl;
                    string friend_Name      = userEL.UserName;
                    string friend_Session   = userEL.Session_True;
                    long   friend_CompanyID = userEL.CompanyID;

                    companyEL.ID = friend_CompanyID;
                    companyEL.ExecuteEL(2);
                    HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到好友公司名字:" + companyEL.CompanyName);
                    string friend_CompanyName = companyEL.CompanyName;
                    //获取群组相关
                    if (dr["NoticeType"].ToString() == "3")//3为群组审核通知
                    {
                        long groupID = long.Parse(dr["GroupID"].ToString());
                        groupEL.ID = groupID;
                        groupEL.ExecuteEL(3);
                        HF.Cloud.BLL.Common.Logger.Error("GetNotice方法获取到群组名称:" + groupEL.GroupName + "---群组ID:" + groupID);
                        dic.Add("GroupID", groupID.ToString());  //群组ID,入群审核用
                        dic.Add("GroupName", groupEL.GroupName); //群组名称,入群审核用
                    }
                    dic.Add("UserName", friend_Name);
                    dic.Add("Session", friend_Session);
                    dic.Add("ImgUrl", friend_Img);
                    dic.Add("CompanyName", friend_CompanyName);
                    dic.Add("NoticeID", dr["ID"].ToString());//ID:这里是单个Notice表里的ID
                    dic.Add("CreateTime", dr["CreateTime"].ToString());
                    dic.Add("NoticeType", dr["NoticeType"].ToString());
                    dic.Add("NoticeState", dr["NoticeState"].ToString());
                    dic.Add("IsLook", dr["IsLook"].ToString());
                }
                if (noticeType == "2")                        //系统通知
                {
                    dic.Add("NoticeID", dr["ID"].ToString()); //系统通知表的通知ID
                    string noticeTitleStr = dr["NoticeTitle"].ToString();
                    string noticeTitle    = noticeTitleStr.Length > 10 ? noticeTitleStr.Substring(0, 10) + "..." : noticeTitleStr;
                    dic.Add("NoticeTitle", noticeTitle);
                    string noticeContentStr = dr["NoticeContent"].ToString();
                    string noticeContent    = noticeContentStr.Length > 20 ? noticeContentStr.Substring(0, 20) + "..." : noticeContentStr;
                    dic.Add("NoticeContent", noticeContent);
                    dic.Add("AddressUrl", dr["AddressUrl"].ToString());
                    dic.Add("NoticeType", "2");
                    dic.Add("IsLook", dr["IsLook"].ToString());
                    dic.Add("CreateTime", dr["CreateTime"].ToString());
                }

                list.Add(dic);
            }
            ////调用此接口后默认都查看通知了,把通知都变为已经查看
            //noticeEL.IsLook = 1;
            //int ra;
            //long noticQue = noticeEL.ExecNonQuery(3, out ra);
            //HF.Cloud.BLL.Common.Logger.Error("GetNotice方法更改为已经查看的记录数为:" + ra.ToString());
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("GetNotice方法返回json数据:" + strJson);
            return(strJson);
        }
Esempio n. 3
0
        /// <summary>
        /// 群组人员置顶 取消置顶  删除
        /// </summary>
        /// <param name="userID">人员ID</param>
        /// <param name="groupID">群组ID</param>
        /// <param name="cookie">操作的功能(top置顶distop取消置顶delete删除)</param>
        /// <returns></returns>
        public string EditUser(string session, string userID, string groupID, string cookie)
        {
            string retunStr = "";

            HF.Cloud.BLL.Common.Logger.Error("EditUser编辑群组人员方法,获取的参数userID:" + userID + "------groupID:" + groupID + "------cookie:" + cookie);
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();

            if (!string.IsNullOrEmpty(userID) && !string.IsNullOrEmpty(groupID) && !string.IsNullOrEmpty(cookie))
            {
                userGroupEL.UserID  = long.Parse(userID);
                userGroupEL.GroupID = long.Parse(groupID);
                if (cookie == "top")//置顶
                {
                    //获取当前置顶的istop最大值
                    int       maxIsTop    = 0;
                    DataTable dtUserGroup = userGroupEL.ExecDT(35);
                    if (dtUserGroup != null && dtUserGroup.Rows.Count > 0)
                    {
                        maxIsTop = Int32.Parse(dtUserGroup.Rows[0]["IsTop"].ToString());
                    }
                    userGroupEL.IsTop = maxIsTop + 1;
                    int  ra;
                    long returnVel = userGroupEL.ExecNonQuery(22, out ra);
                    if (ra > 0)
                    {
                        retunStr = GetGroupFriendList(session, groupID);
                    }
                    else
                    {
                        retunStr = "error";
                    }
                }
                if (cookie == "distop")//取消置顶
                {
                    userGroupEL.IsTop = 0;
                    int  ra;
                    long returnVel = userGroupEL.ExecNonQuery(23, out ra);
                    if (ra > 0)
                    {
                        retunStr = GetGroupFriendList(session, groupID);
                    }
                    else
                    {
                        retunStr = "error";
                    }
                }
                if (cookie == "del")//删除
                {
                    //不可删自己
                    //通过groupID获取群信息
                    GroupEL groupEL      = new GroupEL();
                    long    groupID_long = long.Parse(groupID);
                    groupEL.ID = groupID_long;
                    groupEL.ExecuteEL(3);
                    //群主ID
                    string userID_Group = groupEL.OwnerUserID.ToString();
                    //通过sesison 获取userID
                    SB_UserEL userEL = new SB_UserEL();
                    userEL.Session_True = session;
                    DataTable dtUserEl    = userEL.ExecDT(41);
                    string    userID_User = "";
                    if (dtUserEl != null && dtUserEl.Rows.Count > 0)
                    {
                        userID_User = dtUserEl.Rows[0]["ID"].ToString();
                    }
                    //如果不是群主
                    if (userID_Group != userID_User)
                    {
                        int  ra;
                        long returnVel = userGroupEL.ExecNonQuery(2, out ra);
                        if (ra < 0)
                        {
                            retunStr = "error";
                        }
                    }
                    retunStr = GetGroupFriendList(session, groupID);
                }
            }
            return(retunStr);
        }
Esempio n. 4
0
        /// <summary>
        /// 群组人员列表
        /// </summary>
        /// <param name="groupID">群组ID</param>
        /// <returns></returns>
        public string GetGroupFriendList(string session, string groupID)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到的参数groupID:" + groupID);
            JavaScriptSerializer                js   = new JavaScriptSerializer();
            Dictionary <string, object>         dic  = new Dictionary <string, object>();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过groupID获取群信息
            GroupEL          groupEL      = new GroupEL();
            SB_UserEL        userEL       = new SB_UserEL();
            UserUniteGroupEL userGroupEL  = new UserUniteGroupEL();
            long             groupID_long = long.Parse(groupID);

            groupEL.ID = groupID_long;
            groupEL.ExecuteEL(3);
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到群组名称:" + groupEL.GroupName);
            string groupName   = ""; //群名称
            long   ownerUserID = 0;  //群主userID
            string introduce   = ""; //群简介
            string isOpen      = ""; //1公开或0私密

            if (!string.IsNullOrEmpty(groupEL.GroupName))
            {
                groupName   = groupEL.GroupName;
                ownerUserID = groupEL.OwnerUserID;
                introduce   = groupEL.Introduce;
                isOpen      = groupEL.IsOpen.ToString();
            }
            //通过ownerUserID获取群主Name
            userEL.ID = ownerUserID;
            userEL.ExecuteEL(4);
            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到群主姓名:" + userEL.UserName);
            string ownerUserName = "";

            if (!string.IsNullOrEmpty(userEL.UserName))
            {
                ownerUserName = userEL.UserName;
            }
            string userSession = userEL.Session_True;

            //通过群ID获取群有多少人
            userGroupEL.GroupID = groupID_long;
            DataTable dt_Count = userGroupEL.ExecDT(31);

            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法获取到本群人数:" + dt_Count.Rows.Count);
            int groupCount = dt_Count.Rows.Count;

            foreach (DataRow dr in dt_Count.Rows)
            {
                //获取到userID
                string  userID   = dr["UserID"].ToString();
                UserBLL userBLL  = new UserBLL();
                string  userInfo = userBLL.GetUserInfoByUserID(userID);
                //把userInfo反序列化出来
                Dictionary <string, object> json_userInfo = new Dictionary <string, object>();
                json_userInfo = js.Deserialize <Dictionary <string, object> >(userInfo);
                //加上置顶字段 IsTop 2018-1-15
                json_userInfo.Add("IsTop", dr["IsTop"].ToString());
                list.Add(json_userInfo);
            }
            dic.Add("GroupName", groupName);
            dic.Add("GroupOwnerName", ownerUserName);
            dic.Add("Introduce", introduce);
            dic.Add("IsOpen", isOpen);
            dic.Add("GroupCount", groupCount.ToString());
            dic.Add("GroupID", groupID.ToString());
            dic.Add("IsGroupOwner", session == userSession?"1":"0");
            dic.Add("User", list);

            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetGroupFriendList方法返回的json数据:" + strJson);
            return(strJson);
        }
Esempio n. 5
0
        /// <summary>
        /// 我的群组列表
        /// </summary>
        /// <param name="session">session</param>
        /// <returns></returns>
        public string GetMyGroups(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到的参数session:" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //通过Session获取UerID
            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到的UserID:" + userID);
            //通过userID获取GroupID
            UserUniteGroupEL userGroupEL = new UserUniteGroupEL();

            userGroupEL.UserID = userID;
            DataTable dt = userGroupEL.ExecDT(3);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群组个数为:" + dt.Rows.Count);
            GroupEL   groupEL = new GroupEL();
            SB_UserEL userEL  = new SB_UserEL();

            foreach (DataRow dr in dt.Rows)
            {
                //通过群ID获取群信息
                long groupID = (long)dr["GroupID"];
                groupEL.ID = groupID;
                groupEL.ExecuteEL(3);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群组名称:" + groupEL.GroupName);
                string groupName   = "";
                long   ownerUserID = 0;
                string createTime  = "";
                if (!string.IsNullOrEmpty(groupEL.GroupName))
                {
                    groupName   = groupEL.GroupName;
                    ownerUserID = groupEL.OwnerUserID;
                    createTime  = groupEL.CreateTime;
                }
                //通过ownerUserID获取群主Name
                userEL.ID = ownerUserID;
                userEL.ExecuteEL(4);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到群主姓名:" + userEL.UserName);
                string ownerUserName = "";
                if (!string.IsNullOrEmpty(userEL.UserName))
                {
                    ownerUserName = userEL.UserName;
                }
                //通过群ID获取群有多少人
                userGroupEL.GroupID = groupID;
                DataTable dt_Count = userGroupEL.ExecDT(31);
                HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法获取到本群人数:" + dt_Count.Rows.Count);
                int groupCount = dt_Count.Rows.Count;

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("GroupName", groupName);
                dic.Add("GroupOwnerName", ownerUserName);
                dic.Add("CreateTime", createTime);
                dic.Add("GroupCount", groupCount.ToString());
                dic.Add("GroupID", groupID.ToString());
                list.Add(dic);
            }

            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("GetMyGroups方法返回的json数据:" + strJson);
            return(strJson);
        }