Exemple #1
0
        public int AddModel(Sys_TaskDailyInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sys_TaskDaily(");
            strSql.Append("insetName,dt_remark,dt_logUid,dt_Source,accountid,t_mk,dt_Time,dt_Level,dt_Status,inertTime");
            strSql.Append(") values (");
            strSql.Append("@insetName,@dt_remark,@dt_logUid,@dt_Source,@accountid,@t_mk,@dt_Time,@dt_Level,@dt_Status,@inertTime");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");

            return(DapperHelper.ExecuteScalar <int>(strSql.ToString(), new
            {
                insetName = model.insetName,
                dt_remark = model.dt_remark,
                dt_logUid = model.dt_logUid,
                dt_Source = model.dt_Source,
                accountid = model.accountid,
                t_mk = model.t_mk,
                dt_Time = model.dt_Time,
                dt_Level = model.dt_Level,
                dt_Status = model.dt_Status,
                inertTime = model.inertTime
            }));
        }
Exemple #2
0
        /// <summary>
        /// 添加客服回访信息
        /// </summary>
        /// <param name="uName"></param>
        /// <param name="content"></param>
        /// <param name="accId"></param>
        /// <param name="sourceMark">反馈来源信息</param>
        /// <returns></returns>
        public static int AddCustomCareFeedBack(string uName, string content, int accId, int sourceMark = 0)
        {
            Sys_TaskDailyInfo model = new Sys_TaskDailyInfo();

            string source = "";

            switch (sourceMark)
            {
            case 0:
                source = "客服反馈";
                break;

            case 1:
                source = "推广建议";
                break;

            default:
                source = "客服反馈";
                break;
            }

            if (Sys_TaskDailyBLL.CheckTaskDailyExist(content))
            {
                return(2);
            }

            try
            {
                model.t_mk    = content;
                model.dt_Time = DateTime.Now;

                model.accountid = accId;

                model.inertTime = DateTime.Now;
                model.dt_Level  = 9;
                model.dt_Status = 99;

                model.insetName = uName;
                model.dt_remark = "";
                model.dt_logUid = 0;
                model.dt_Source = source;

                if (Sys_TaskDailyBLL.AddModel(model) > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("添加" + source + "出错!", ex);
                return(0);
            }
        }
Exemple #3
0
        public static Dictionary <string, string> GetForumContent(string url)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>()
            {
                { "title", "" },
                { "user", "" }
            };

            if (url.IndexOf("www.i200.cn/bbs") < 0)
            {
                return(null);//不是合法地址
            }
            //制定编码格式
            var encoding = Encoding.GetEncoding("utf-8");
            //url的设置
            var request = (HttpWebRequest)WebRequest.Create(url);

            //设置请求的方式
            request.Method = "Get";
            //设置Content-Type 的值
            //request.ContentType = "application/x-www-form-urlencoded";

            //request.ContentLength = data.Length;
            //var outStream = request.GetRequestStream();
            //outStream.Write(data, 0, data.Length);
            //outStream.Close();
            var response  = (HttpWebResponse)request.GetResponse();
            var srContent = new System.IO.StreamReader(response.GetResponseStream(), encoding);
            //获取抓取下来的页面内容
            var strPage = srContent.ReadToEnd();

            response.Close();
            srContent.Close();

            //获取帖子标题
            Regex           regTitle = new Regex(@"(?i)(?<=<a.*?id=""thread_subject"".*?>)[^<]+(?=</a>)");
            MatchCollection mcTitle  = regTitle.Matches(strPage);

            //获取帖子发表时间
            Regex           regTime = new Regex(@"(?i)(?<=<em.*?id=""authorposton.*?>发表于)[^<]+(?=</em>)");
            MatchCollection mcTime  = regTime.Matches(strPage);

            if (mcTime.Count == 0)
            {
                regTime = new Regex(@"(?i)(?<=<em.*?id=""authorposton.*?>发表于.*<span.*title="")[^<]+(?="">)");
                mcTime  = regTime.Matches(strPage);
            }

            string postUser = strPage.Substring(strPage.IndexOf("class=\"pi\""), 300);

            //获取发帖人
            Regex           regUser = new Regex(@"(?i)(?<=<a.*?uid=)[^<]+(?="".*?target)");
            MatchCollection mcUser  = regUser.Matches(postUser);

            if (mcUser.Count == 0)
            {
                regUser = new Regex(@"(?i)(?<=匿名.*?<em>)[^<]+(?=</em>)");
                mcUser  = regUser.Matches(postUser);
            }

            Sys_TaskDailyInfo model = new Sys_TaskDailyInfo();

            dic["title"] = mcTitle[0].Groups[0].ToString();
            if (mcUser[0].Groups[0].ToString().IndexOf('.') >= 0)
            {
                dic["user"] = "******";
            }
            else
            {
                try
                {
                    int accountid = T_AccountBLL.GetAccIdBybbsId(Convert.ToInt32(mcUser[0].Groups[0].ToString()));
                    dic["user"] = T_AccountBLL.GetCompanyName(accountid);
                }
                catch (Exception ex)
                {
                    Logger.Error("转换论坛ID出错!", ex);
                    dic["user"] = "******";
                }
            }

            return(dic);
        }
Exemple #4
0
        /// <summary>
        /// 插入论坛建议反馈
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string GetForumFeedBack(string url, string uName, string remark)
        {
            if (url.IndexOf("www.i200.cn/bbs") < 0)
            {
                return("");//不是合法地址
            }
            //制定编码格式
            var encoding = Encoding.GetEncoding("utf-8");
            //url的设置
            var request = (HttpWebRequest)WebRequest.Create(url);

            //设置请求的方式
            request.Method = "Get";
            //设置Content-Type 的值
            //request.ContentType = "application/x-www-form-urlencoded";

            //request.ContentLength = data.Length;
            //var outStream = request.GetRequestStream();
            //outStream.Write(data, 0, data.Length);
            //outStream.Close();
            var response  = (HttpWebResponse)request.GetResponse();
            var srContent = new System.IO.StreamReader(response.GetResponseStream(), encoding);
            //获取抓取下来的页面内容
            var strPage = srContent.ReadToEnd();

            response.Close();
            srContent.Close();

            //获取帖子标题
            Regex           regTitle = new Regex(@"(?i)(?<=<a.*?id=""thread_subject"".*?>)[^<]+(?=</a>)");
            MatchCollection mcTitle  = regTitle.Matches(strPage);

            //获取帖子发表时间
            Regex           regTime = new Regex(@"(?i)(?<=<em.*?id=""authorposton.*?>发表于)[^<]+(?=</em>)");
            MatchCollection mcTime  = regTime.Matches(strPage);

            if (mcTime.Count == 0)
            {
                regTime = new Regex(@"(?i)(?<=<em.*?id=""authorposton.*?>发表于.*<span.*title="")[^<]+(?="">)");
                mcTime  = regTime.Matches(strPage);
            }

            string postUser = strPage.Substring(strPage.IndexOf("class=\"pi\""), 300);

            //获取发帖人
            Regex           regUser = new Regex(@"(?i)(?<=<a.*?uid=)[^<]+(?="".*?target)");
            MatchCollection mcUser  = regUser.Matches(postUser);

            if (mcUser.Count == 0)
            {
                regUser = new Regex(@"(?i)(?<=匿名.*?<em>)[^<]+(?=</em>)");
                mcUser  = regUser.Matches(postUser);
            }

            Sys_TaskDailyInfo model = new Sys_TaskDailyInfo();

            try
            {
                model.t_mk    = mcTitle[0].Groups[0].ToString();
                model.dt_Time = Convert.ToDateTime(mcTime[0].Groups[0].ToString());
                if (mcUser[0].Groups[0].ToString().IndexOf('.') >= 0)
                {
                    model.accountid = 0;
                }
                else
                {
                    try
                    {
                        model.accountid = T_AccountBLL.GetAccIdBybbsId(Convert.ToInt32(mcUser[0].Groups[0].ToString()));
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("转换论坛ID出错!", ex);
                        model.accountid = 0;
                    }
                }

                model.inertTime = DateTime.Now;
                model.dt_Level  = 9;
                model.dt_Status = 99;

                model.insetName = uName;
                model.dt_remark = "@(" + url + ")" + remark;
                model.dt_logUid = 0;
                model.dt_Source = "论坛反馈";

                if (Sys_TaskDailyBLL.CheckForumUrl(url))
                {
                    return("已经存在该条反馈!");
                }
                else
                {
                    if (Sys_TaskDailyBLL.AddModel(model) > 0)
                    {
                        return("添加成功!");
                    }
                    else
                    {
                        return("添加出错!");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("添加论坛反馈出错!", ex);
                return("添加反馈出错!");
            }

            //return mcTitle[0].Groups[0].ToString() + "  " + mcTime[0].Groups[0].ToString() + "  " + mcUser[0].Groups[0].ToString();
            //foreach (Match m in mc)
            //{
            //    Console.WriteLine(m.Groups[0].ToString());
            //}

            //return strPage;
        }
        public static int AddModel(Sys_TaskDailyInfo model)
        {
            Sys_TaskDailyDAL dal = new Sys_TaskDailyDAL();

            return(dal.AddModel(model));
        }