コード例 #1
0
ファイル: CompanysBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 修改公司简介
        /// </summary>
        /// <param name="companyContent">公司内容</param>
        /// <returns></returns>
        public string UpdateCompanyIntroduce(string companyContent)
        {
            string resultStr = "";

            BLL.Common.Logger.Error("UpdateCompanyIntroduce方法修改公司简介接受到的参数companyContent:" + companyContent);
            JavaScriptSerializer js = new JavaScriptSerializer();
            var info = js.Deserialize <Dictionary <string, object> >(companyContent);

            if (!string.IsNullOrEmpty(info["CompanyID"].ToString()))
            {
                string companyIDStr        = info["CompanyID"].ToString();
                string companyIntroduceStr = info["Introduce"].ToString();

                CompanysEL companysEL = new CompanysEL();
                companysEL.ID        = long.Parse(companyIDStr);
                companysEL.Introduce = companyIntroduceStr;
                int  ra;
                long updateIntro = companysEL.ExecNonQuery(3, out ra);
                BLL.Common.Logger.Error("UpdateCompanyIntroduce方法修改公司简介结果(大于0成功):" + updateIntro);
                if (ra > 0)
                {
                    resultStr = "success";
                }
                else
                {
                    resultStr = "error";
                }
            }
            return(resultStr);
        }
コード例 #2
0
ファイル: CompanysBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 获取本人公司信息
        /// </summary>
        /// <param name="session">用户session</param>
        /// <returns></returns>
        public string GetMyCompanyInfo(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法接受的参数session:" + session);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();
            //通过session获取CompanyID
            SB_UserEL userEl = new SB_UserEL();

            userEl.Session_True = session;
            userEl.ExecuteEL(41);
            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法查询用户信息结果(大于0说明正确):" + userEl.ID);
            if (userEl.ID > 0)
            {
                long companyID = userEl.CompanyID;
                //通过公司ID获取公司信息
                CompanysEL companysEL = new CompanysEL();
                companysEL.ID = companyID;
                companysEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法查询公司信息结果公司名称:" + companysEL.CompanyName);
                dic.Add("CompanyID", companyID);
                dic.Add("CompanyName", companysEL.CompanyName);
                dic.Add("CompanyIcon", companysEL.CompanyIcon);
                dic.Add("Introduce", companysEL.Introduce);
                //通过companyID获取公司关键字
                string companyTags = GetCompanyTag_String(companyID.ToString());
                dic.Add("Tags", companyTags);
            }

            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetMyCompanyInfo方法返回的用户信息json数据:" + strJson);
            return(strJson);
        }
コード例 #3
0
ファイル: FriendsBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 好友列表
        /// </summary>
        /// <param name="session">本人session</param>
        /// <returns></returns>
        public string GetFriendList(string session)
        {
            HF.Cloud.BLL.Common.Logger.Error("FriendList获取到的session为" + session);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            //session获取用户UserID
            SB_UserEL userEL = new SB_UserEL();

            userEL.Session_True = session;
            userEL.ExecuteEL(41);
            HF.Cloud.BLL.Common.Logger.Error("userEL.ID:" + userEL.ID);
            if (userEL.ID > 0)
            {
                long userID = userEL.ID;
                //通过userID在好友表中查询好友列表
                FriendsEL frenEL = new FriendsEL();
                frenEL.UserID = userID;
                DataTable dt = frenEL.ExecDT(31);
                HF.Cloud.BLL.Common.Logger.Error("获取到好友列表,好友个数为:" + dt.Rows.Count);

                foreach (DataRow dr in dt.Rows)
                {
                    long userid_Friend = long.Parse(dr["UserID_Friend"].ToString());
                    //通过userid_Friend获取好友信息
                    userEL.ID = userid_Friend;
                    userEL.ExecuteEL(4);
                    string userName       = userEL.UserName;
                    string userTel        = userEL.UserTel;
                    string duty           = userEL.Duty;
                    string imgUrl         = userEL.ImgUrl;
                    string session_Friend = userEL.Session_True;
                    long   companyID      = userEL.CompanyID;
                    //通过companyID获取公司名称
                    CompanysEL compaEL = new CompanysEL();
                    compaEL.ID = companyID;
                    compaEL.ExecuteEL(2);
                    string companyName = compaEL.CompanyName;
                    HF.Cloud.BLL.Common.Logger.Error("好友名称:" + userEL.UserName + "公司名称:" + companyName);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("UserName", userName);
                    dic.Add("UserTel", userTel);
                    dic.Add("Duty", duty);
                    dic.Add("ImgUrl", imgUrl);
                    dic.Add("Session", session_Friend);
                    dic.Add("CompanyName", companyName);

                    list.Add(dic);
                }
            }
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("返回的好友列表json数据:" + strJson);
            return(strJson);
        }
コード例 #4
0
ファイル: FriendsBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 搜索好友
        /// </summary>
        /// <param name="friendName">好友名称</param>
        /// <returns></returns>
        public string SearchFriend(string session, string friendName)
        {
            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取的参数session:" + session + "---friendName:" + friendName);
            JavaScriptSerializer js = new JavaScriptSerializer();
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();

            UserBLL userBLL = new UserBLL();
            long    userID  = userBLL.GetUserIDBySession(session);

            FriendsEL friendEL = new FriendsEL();
            DataTable dt       = friendEL.ExecuteSqlString("select * from ViewFriends where UserID=" + userID + " and UserName like '%" + friendName + "%' and Friend_Valid=1");

            SB_UserEL userEL = new SB_UserEL();

            //userEL.UserName = friendName;
            //DataTable dt= userEL.ExecDT(45);
            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法获取的好友个数为:" + dt.Rows.Count);
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //这里都是用的视图ViewFriends里的字段
                    long userid = long.Parse(dr["SB_User_ID"].ToString());
                    //通过userid_Friend获取好友信息
                    userEL.ID = userid;
                    userEL.ExecuteEL(4);
                    string userName       = userEL.UserName;
                    string userTel        = userEL.UserTel;
                    string duty           = userEL.Duty;
                    string imgUrl         = userEL.ImgUrl;
                    string session_Friend = userEL.Session_True;
                    long   companyID      = userEL.CompanyID;
                    //通过companyID获取公司名称
                    CompanysEL compaEL = new CompanysEL();
                    compaEL.ID = companyID;
                    compaEL.ExecuteEL(2);
                    string companyName = compaEL.CompanyName;
                    HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法好友名称:" + userEL.UserName + "公司名称:" + companyName);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("UserName", userName);
                    dic.Add("UserTel", userTel);
                    dic.Add("Duty", duty);
                    dic.Add("ImgUrl", imgUrl);
                    dic.Add("Session", session_Friend);
                    dic.Add("CompanyName", companyName);

                    list.Add(dic);
                }
            }
            string strJson = js.Serialize(list);

            HF.Cloud.BLL.Common.Logger.Error("SearchFriend方法返回的好友列表json数据:" + strJson);
            return(strJson);
        }
コード例 #5
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userID">用户userID</param>
        /// <returns></returns>
        public string GetUserInfoByUserID(string userID)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法接受到的参数userID:" + userID);
            //通过session获取用户
            SB_UserEL userel = new SB_UserEL();

            userel.ID = long.Parse(userID);
            userel.ExecuteEL(4);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法获取用户姓名:" + userel.UserName);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(userel.UserName))
            {
                dic.Add("UserID", userID);
                dic.Add("UserName", userel.UserName);
                dic.Add("UserTel", userel.UserTel);
                dic.Add("Duty", userel.Duty);
                dic.Add("UserEmail", userel.UserEmail);
                dic.Add("Detail", userel.Detail);
                dic.Add("ImgUrl", userel.ImgUrl);
                dic.Add("Session", userel.Session_True);
                string companyName = "";
                string companyIcon = "";
                string companyID   = "";
                //通过公司ID查询公司名称
                CompanysEL compEL = new CompanysEL();
                compEL.ID = userel.CompanyID;
                compEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法查询公司名称结果公司名称:" + compEL.CompanyName);
                if (!string.IsNullOrEmpty(compEL.CompanyName))
                {
                    companyName = compEL.CompanyName;
                    companyIcon = compEL.CompanyIcon;
                    companyID   = compEL.ID.ToString();
                }
                dic.Add("CompanyName", companyName);
                dic.Add("CompanyIcon", companyIcon);
                dic.Add("CompanyID", companyID);
            }
            string strJson = js.Serialize(dic);

            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoByUserID方法返回的数据为:" + strJson);
            return(strJson);
        }
コード例 #6
0
ファイル: CompanysBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 添加公司或获取公司ID
        /// </summary>
        /// <param name="companyName">公司名称</param>
        /// <returns>返回值是公司ID</returns>
        public string AddOrSelectCompany(string companyName)
        {
            Common.Logger.Error("AddOrSelectCompany方法获取到的参数:" + companyName);
            string companyID = "";
            //先查询公司表中是否有此公司
            CompanysEL companyEL = new CompanysEL();

            companyEL.CompanyName = companyName;
            companyEL.ExecuteEL(21);
            Common.Logger.Error("AddOrSelectCompany方法查询公司表结果:" + companyEL.ID);
            if (companyEL.ID > 0)
            {
                //如果数据库中有此公司,则返回公司ID
                companyID = companyEL.ID.ToString();
                Common.Logger.Error("AddOrSelectCompany方法调用数据库中的" + companyName + "的ID为:" + companyID);
            }
            else
            {
                //调用天眼查接口,查询公司简介
                string url_GetBriefIntroduction = "https://way.jd.com/qichacha/GetBriefIntroduction?key=736be44d18e011e6b4fb1051721d3b62&companyName=" +
                                                  companyName + "&dtype=json&appkey=6831311b16156e8775fff0364cb69d67";
                string getIntroduceResult = GetResponse(url_GetBriefIntroduction);
                HF.Cloud.BLL.Common.Logger.Error("第一次天眼查查询公司简介GetBriefIntroduction接口结果:" + getIntroduceResult);

                JObject objIntro = JObject.Parse(getIntroduceResult);

                //公司头像
                string companyIcon = "";
                //公司简介
                string introduce = companyName;
                try
                {
                    companyIcon = objIntro["result"]["Result"]["Logo"].ToString();
                    Common.Logger.Error("AddOrSelectCompany方法查询公司头像结果:" + objIntro["result"]["Result"]["Logo"].ToString());
                }
                catch {
                    Common.Logger.Error("AddOrSelectCompany方法该公司没有logo:");
                }
                try
                {
                    //删除掉特殊字符
                    string contentStr        = objIntro["result"]["Result"]["Content"].ToString();
                    string contentStr_Change = contentStr.Replace("\"", "");
                    introduce = Regex.Replace(contentStr_Change, @"[<>abcdefghijklmnopqrstuvwxyzABCDEFJHIJKLMNOPQRSTUVWXYZ/\=]", string.Empty, RegexOptions.Compiled);
                    Common.Logger.Error("AddOrSelectCompany方法首次查询公司简介结果:" + objIntro["result"]["Result"]["Content"].ToString());
                }
                catch
                {
                    //说明此接口没有公司简介或公司简介为空,那么调用另外一个接口
                    string url_detail_info = "https://way.jd.com/jindidata/detail_info?name=" +
                                             companyName + "&appkey=6831311b16156e8775fff0364cb69d67";
                    string getdetail_info = GetResponse(url_detail_info);
                    Common.Logger.Error("第二次天眼查,公司简介没查到然后查询公司工商信息getdetail_info接口结果:" + url_detail_info);
                    JObject obj_detail_info = JObject.Parse(getdetail_info);
                    try
                    {
                        //删除掉特殊字符
                        string businessScopeStr        = obj_detail_info["result"]["result"]["baseInfo"]["businessScope"].ToString();
                        string businessScopeStr_Change = businessScopeStr.Replace("\"", "");
                        introduce = Regex.Replace(businessScopeStr_Change, @"[<>abcdefghijklmnopqrstuvwxyzABCDEFJHIJKLMNOPQRSTUVWXYZ/\=]", string.Empty, RegexOptions.Compiled);
                        Common.Logger.Error("第二次查询公司简介结果:" + obj_detail_info["result"]["result"]["baseInfo"]["businessScope"].ToString());
                    }
                    catch
                    {
                        //如果调用2个接口都查不到公司简介,内容的话就直接显示公司名称
                        introduce = companyName;
                    }
                }
                companyEL.CompanyIcon = companyIcon;
                companyEL.Introduce   = introduce;
                companyEL.CreateTime  = DateTime.Now.ToString();
                companyEL.Valid       = 1;
                int  outValue;
                long addCompanyRes = companyEL.ExecNonQuery(1, out outValue);
                Common.Logger.Error("AddOrSelectCompany方法添加公司结果(大于0说明成功):" + addCompanyRes);
                if (addCompanyRes > 0)
                {
                    companyID = addCompanyRes.ToString();
                }
                else
                {
                    companyID = "0";
                }
            }
            return(companyID);
        }
コード例 #7
0
ファイル: CompanysBLL.cs プロジェクト: radtek/shangwulink
        /// <summary>
        /// 获取好友公司信息
        /// </summary>
        /// <param name="companyID">companyID</param>
        /// <returns></returns>
        public string GetFriendCompanyInfo(string session, string companyID)
        {
            string strJson = "";

            HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法接受的参数session:" + session + "---companyID:" + companyID);
            if (!string.IsNullOrEmpty(session) && !string.IsNullOrEmpty(companyID))
            {
                JavaScriptSerializer        js  = new JavaScriptSerializer();
                Dictionary <string, object> dic = new Dictionary <string, object>();

                SB_UserEL userEL = new SB_UserEL();
                userEL.Session_True = session;
                userEL.ExecuteEL(41);
                string isMyCompany = "";//是否是自己公司
                if (userEL.CompanyID.ToString() == companyID)
                {
                    isMyCompany = "1";
                }
                else
                {
                    isMyCompany = "0";
                }
                long _companyID = long.Parse(companyID);
                //通过公司ID获取公司信息
                CompanysEL companysEL = new CompanysEL();
                companysEL.ID = _companyID;
                companysEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法查询公司信息结果公司名称:" + companysEL.CompanyName);
                dic.Add("CompanyID", companyID);
                dic.Add("CompanyName", companysEL.CompanyName);
                dic.Add("CompanyIcon", companysEL.CompanyIcon);
                dic.Add("Introduce", companysEL.Introduce);
                dic.Add("IsMyCompany", isMyCompany);
                //通过companyID获取公司关键字
                string companyTags = GetCompanyTag_String(companyID.ToString());
                dic.Add("Tags", companyTags);
                //3判断是否给此公司递过名片
                string userid = userEL.ID.ToString();
                //3.1查找第一个加入当前公司的用户ID
                string userid_Company = "";
                userEL.CompanyID = _companyID;
                DataTable dt_company = userEL.ExecDT(44);
                if (dt_company != null && dt_company.Rows.Count > 0)
                {
                    userid_Company = dt_company.Rows[0]["ID"].ToString();
                }
                //3.2Notice表中查找此人是否给公司提交过名片的记录
                NoticeEL noticeEL = new NoticeEL();
                noticeEL.UserID        = long.Parse(userid_Company); //第一个加入公司的人
                noticeEL.UserID_Friend = long.Parse(userid);         //自己
                noticeEL.NoticeType    = 1;
                DataTable dt_Notice = noticeEL.ExecDT(23);
                string    isSend    = "";//是否递过,0没递过,1递过
                if (dt_Notice != null && dt_Notice.Rows.Count > 0)
                {
                    isSend = "1";
                }
                else
                {
                    isSend = "0";
                }
                dic.Add("IsSend", isSend);

                strJson = js.Serialize(dic);
            }
            else
            {
                strJson = "error";
            }
            HF.Cloud.BLL.Common.Logger.Error("GetFriendCompanyInfo方法返回的用户信息json数据:" + strJson);
            return(strJson);
        }
コード例 #8
0
ファイル: NoticeBLL.cs プロジェクト: radtek/shangwulink
        /// <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);
        }
コード例 #9
0
        /// <summary>
        /// 发送微信服务通知
        /// </summary>
        /// <param name="userOpenID">发送目的用户的openid</param>
        /// <param name="formID">提交表单的formid</param>
        /// <param name="hongBaoValueDecimal">红包值</param>
        public void SendServNotice(string userOpenID, string formID, decimal hongBaoValueDecimal, string companyID)
        {
            //通过公司id获取公司名称
            string companyName = "公司";

            if (!string.IsNullOrEmpty(companyID))
            {
                CompanysEL companyEL = new CompanysEL();
                companyEL.ID = long.Parse(companyID);
                DataTable dt_company = companyEL.ExecDT(2);
                if (dt_company != null && dt_company.Rows.Count > 0)
                {
                    companyName = dt_company.Rows[0]["CompanyName"].ToString();
                }
            }

            SortedDictionary <string, object> m_values = new SortedDictionary <string, object>();

            m_values.Add("touser", userOpenID);                                         //接收者(用户)的 openid
            m_values.Add("template_id", "2bqqDRenEIyb5D0V8ngm7BYn0tukqGdOFEYx5m2-z28"); //所需下发的模板消息的id(小程序后台配置)
            m_values.Add("page", "pages/mycard/mycard");                                //点击模板卡片后的跳转页面
            m_values.Add("form_id", formID);                                            //表单提交场景下,为 submit 事件带上的 formId;支付场景下,为本次支付的 prepay_id

            SortedDictionary <string, object> m_values_data       = new SortedDictionary <string, object>();
            SortedDictionary <string, object> m_values_data_Item1 = new SortedDictionary <string, object>();

            m_values_data_Item1.Add("value", "迎春纳福 喜送红包");//
            // m_values_data_Item1.Add("color", "#173177");//
            m_values_data.Add("keyword1", m_values_data_Item1);

            SortedDictionary <string, object> m_values_data_Item2 = new SortedDictionary <string, object>();

            m_values_data_Item2.Add("value", hongBaoValueDecimal + "元现金红包");//
            m_values_data_Item2.Add("color", "#F70909");
            m_values_data.Add("keyword2", m_values_data_Item2);

            SortedDictionary <string, object> m_values_data_Item3 = new SortedDictionary <string, object>();

            m_values_data_Item3.Add("value", "您已经成功领取" + companyName + "送出的" + hongBaoValueDecimal + "元新春红包。\n点击进入小程序,免费开启自己企业的新春红包,为好友送祝福吧!");//
            //m_values_data_Item3.Add("color", "#F70909");
            m_values_data.Add("keyword3", m_values_data_Item3);

            m_values.Add("data", m_values_data);//模板内容

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;

            string json = js.Serialize(m_values);

            BLL.Common.Logger.Error("发模板消息提交的json数据:" + json);


            //string xml = ToXml(m_values);//获取xml文件
            //BLL.Common.Logger.Error("发模板消息提交的xml数据:" + xml);

            try
            {
                //获取access_token
                WX_TokenBLL tokenBLL     = new WX_TokenBLL();
                string      access_token = tokenBLL.GetToken();
                //发送模板消息 接口地址
                string url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + access_token;
                //post提交
                //string result = apiPost(xml, url);
                string result = Post(url, json);
                BLL.Common.Logger.Error("发模板消息结果:" + result);
                //xml转换成字典
                //SortedDictionary<string, object> resultDictionary = FromXml(result);
                //BLL.Common.Logger.Error("errmsg数据:" + resultDictionary["errmsg"].ToString());
                //if (resultDictionary["errmsg"].ToString() == "ok")
                //{
                //    BLL.Common.Logger.Error("发送模板成功!");
                //}
                Dictionary <string, object> result_Dic = new Dictionary <string, object>();
                result_Dic = js.Deserialize <Dictionary <string, object> >(result);
                if (result_Dic.Keys.Contains("errcode"))
                {
                    if (result_Dic["errcode"].ToString() == "0")
                    {
                        BLL.Common.Logger.Error("发送模板成功!");
                    }
                }
            }
            catch (Exception exp)
            {
                BLL.Common.Logger.Error("发送模板错误:" + exp.ToString());
            }
        }
コード例 #10
0
        /// <summary>
        /// 获取用户综合信息
        /// </summary>
        /// <param name="session">本人session</param>
        /// <param name="sessionFriend">需要获取信息的用户session</param>
        /// <returns></returns>
        public string GetUserInfoBySessionAndSessionFriend(string session, string sessionFriend)
        {
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取用户信息方法获取到参数session:" + session + "-----sessionFriend:" + sessionFriend);
            JavaScriptSerializer        js  = new JavaScriptSerializer();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            //通过sessionFriend获取用户
            SB_UserEL userel = new SB_UserEL();

            userel.Session_True = sessionFriend;
            userel.ExecuteEL(41);

            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取用户信息结果(大于0说明成功):" + userel.ID);
            if (userel.ID > 0)
            {
                dic.Add("UserName", userel.UserName);
                dic.Add("UserTel", userel.UserTel);
                dic.Add("Duty", userel.Duty);
                dic.Add("UserEmail", userel.UserEmail);
                dic.Add("Detail", userel.Detail);
                dic.Add("ImgUrl", userel.ImgUrl);
                dic.Add("Session", userel.Session_True);
                #region  人气值
                //组合人气值,人气值=好友查看的次数(好友第一次查看有效,一次以上的不记录)+所有群组群友人数和
                int popularityInt = 0; //人气值
                                       //用户查看人气值
                PopularityBLL popularityBLL = new PopularityBLL();
                //通过Session换取UserID
                UserBLL userBLL       = new UserBLL();
                long    userID        = userBLL.GetUserIDBySession(session);
                long    userID_Friend = userBLL.GetUserIDBySession(sessionFriend);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法获取到的用户ID  userID:" + userID + "---userID_Friend:" + userID_Friend);
                int friendLookInt = popularityBLL.GetPopularityNumber(userID);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法用户查看人气值为:" + friendLookInt);
                popularityInt += friendLookInt;
                //群组群友人数和
                GroupBLL groupBLL    = new GroupBLL();
                int      groupNumber = groupBLL.GetGroupPopularityNumber(userID);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法群组人气值为:" + groupNumber);
                popularityInt += groupNumber;
                dic.Add("Popularity", popularityInt);//人气
                #endregion
                string companyName = "";
                //通过公司ID查询公司名称
                CompanysEL compEL = new CompanysEL();
                compEL.ID = userel.CompanyID;
                compEL.ExecuteEL(2);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取公司信息结果(公司名称为):" + compEL.CompanyName);
                if (!string.IsNullOrEmpty(compEL.CompanyName))
                {
                    companyName = compEL.CompanyName;
                }
                dic.Add("CompanyName", companyName);
                dic.Add("CompanyIcon", compEL.CompanyIcon);
                dic.Add("CompanyID", compEL.ID);
                ///公司简介
                string companyIntroduceStr = compEL.Introduce;
                string introduceStr        = companyIntroduceStr.Length < 50 ? companyIntroduceStr : companyIntroduceStr.Substring(0, 50).ToString() + "...";
                dic.Add("CompanyIntroduce", introduceStr);
                //查看是否有查看sessionFriend用户的记录,有就不用管,没有的话就在SB_Popularity添加一个记录
                bool isLook = popularityBLL.IsLooked(userID, userID_Friend);
                HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend方法,此用户是否被查看过:" + isLook);
                if (!isLook) //如果没有记录就添加一个
                {
                    long insertPopularity = popularityBLL.InsertPopularity(userID, userID_Friend);
                    HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend人气值增加结果:" + insertPopularity);
                }
            }
            //获取公司关键字
            CompanysBLL companyBLL = new CompanysBLL();
            string      tags       = companyBLL.GetCompanyTag_String(userel.CompanyID.ToString());
            dic.Add("Tags", tags);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取公司关键字:" + tags);
            //获取点赞个数
            ThumbsBLL thumbsBLL = new ThumbsBLL();
            string    thumbs    = thumbsBLL.GetThumbs(sessionFriend);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取点赞个数:" + thumbs);
            dic.Add("Thumb", thumbs.ToString());//点赞个数
            //这里要注意,第一个参数是好友的sesison,第二个参数是自己的session
            string isHadThumb = thumbsBLL.IsHadThumb(sessionFriend, session);
            dic.Add("IsHadThumb", isHadThumb);//是否被点赞
            //获取保存数
            FriendsBLL friendsBLL = new FriendsBLL();
            int        saves      = friendsBLL.GetSaveNumber(sessionFriend);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend获取保存个数:" + saves);
            dic.Add("Save", saves.ToString());//保存个数

            //如果session==sessionFriend,说明是自己看自己
            if (session == sessionFriend)
            {
                dic.Add("Who", "0");
            }
            else
            {
                //查看sessionFriend是否是session的好友
                bool isFriend = friendsBLL.IsFriend(session, sessionFriend);
                if (isFriend)
                {
                    //说明是好友
                    dic.Add("Who", "1");
                }
                else
                {
                    //说明不是好友
                    dic.Add("Who", "2");
                }
            }
            //小程序的token
            WX_TokenBLL tokenBLL = new WX_TokenBLL();
            string      token    = tokenBLL.GetToken();
            dic.Add("Token", token);

            string strJson = js.Serialize(dic);
            HF.Cloud.BLL.Common.Logger.Error("GetUserInfoBySessionAndSessionFriend返回的数据为:" + strJson);
            return(strJson);
        }