示例#1
0
    /// <summary>
    /// 读取数据     URLX为确定的 
    ///  1 内容
    ///  2 标题
    ///  3图
    ///  4 url
    /// 
    /// 
    /// </summary>
    /// <param name="PathFile"></param>
    /// <returns></returns>
    public static NewsMsgData GetMySetData(string PathFile, string UrlX)
    {
        string[] myData = System.IO.File.ReadAllLines(PathFile, System.Text.Encoding.UTF8);

        NewsMsgData C = new NewsMsgData();

        List<NewsItem> Items = new List<NewsItem>();

        //响应3条新闻信息

        for (int i = 0; i < myData.Length; i += 4)
        {
            NewsItem Xone = new NewsItem
            {
                Description = myData[i], // "new1",
                Title = myData[i + 1],// "EN了",
                PicUrl = myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
                Url = UrlX// "http://baidu.com"
            };

            Items.Add(Xone);

        }

        C.Items = Items;

        return C;
    }
示例#2
0
    /// <summary>
    ///  html
    /// </summary>
    /// <returns></returns>
    public string GetHtml(string word ,string title )
    {
        try
        {

            string PathFile = System.IO.Path.Combine( Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\IMG\\"+  word+".dll"); //图文 关键词回复目录);

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadFile(PathFile);

            string TableTxt = "";

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                if (CMsgData.Items[i].Title.Trim() == title.Trim())
                {
                    TableTxt = CMsgData.Items[i].Description;

                    break;
                }

            }
            return TableTxt;
        }
        catch
        {
            return "";
        }
    }
示例#3
0
        /// <summary>
        /// 模板
        /// </summary>
        /// <param name="N"></param>
        /// <returns></returns>
        public string GetXML_MODEL(int N)
        {
            NewsMsgData CMsgData = new NewsMsgData();
            for (int i = 0; i < N; i++)
            {
                NewsItem cN = new NewsItem();
                cN.Title = "项目 " + i.ToString() + " 标题";
                cN.Description = "项目 " + i.ToString() + " 具体内容描述";
                cN.PicUrl = "http://xxxx.com/img/a.jpg ";
                cN.Url = "http://xxxx.com/img/a.aspx";

                CMsgData.Items.Add(cN);
            }
            return CMsgData.Getdata();
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            //读取
            HttpCookie cookie2 = context.Request.Cookies["weiweixing08"];

            if (cookie2 == null)
            {
                context.Response.Redirect("help.aspx");
            }
            else
            {
                TIME_MID = cookie2.Values["UserIDTime"];
                if (TIME_MID == null)
                {
                    context.Response.Redirect("help.aspx");
                }
                else
                {
                    //正确读取

                    RID = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetID(context.Server.MapPath("~"), TIME_MID);

                    if (RID == "")
                    {
                        context.Response.Redirect("help.aspx");
                    }
                }
            }
            context.Response.Write("<!DOCTYPE html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><meta name='viewport' content='width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;' /><meta name='apple-mobile-web-app-capable' content='yes' /><meta name='apple-mobile-web-app-status-bar-style' content='blac'/><meta name='format-detection' content='telephone=no' /><title></title><link href= 'Styles/Style.css' rel='stylesheet' type='text/css'></head><body>\r\n");
            //获得数据  并且 返回回去

            string PathFile = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\news.dll"); //图文 关键词回复目录);

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadFile(PathFile);

            string TableTxt = "";
            string S = "..\\USER_DIR\\SYSUSER\\NEWS\\";
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                string DATA = "<table width='100%'  border='0' cellpadding='0' cellspacing='0' style='border:0'><tr style='border:0'><td width='50' style='border:0'><a href='" + S + CMsgData.Items[i].Url + "'> <img src='" + CMsgData.Items[i].PicUrl + "'  width='50px' height='50px'> </a> </td><td style='border:0'> <a href='" + S + CMsgData.Items[i].Url + "'>" + CMsgData.Items[i].Title + "</a></td></tr></table>";
                TableTxt += "  <tr><td>"+  DATA+"</td></tr>";
            }
            TableTxt = "<div class=\"cardexplain\"><ul class=\"round\"><li class='title'>图文消息</li><table  border='0' cellpadding='0' cellspacing='0' width='100%'  class='cpbiaoge'>" + TableTxt + "</table></ul></div></body></html>";
            context.Response.Write(TableTxt);
        }
示例#5
0
 /// <summary>
 /// 获取图文响应消息
 /// </summary>
 /// <returns></returns>
 public RepNewsMessage GetNewsResponse(IEnumerable<NewsItem> data = null)
 {
     var ret = new RepNewsMessage();
     FillRepMsg(ret);
     if (data != null)
     {
         var msgData = new NewsMsgData();
         msgData.Items.AddRange(data);
         ret.Data = msgData;
     }
     return ret;
 }
示例#6
0
        protected void Button21_Click(object sender, EventArgs e)
        {
            if (Label2.Text == "")
                return;

            NewsItem myItem = new NewsItem();
             myItem.Title =  TextBoxTitle.Text ;
             myItem.PicUrl= txt0.Text  ;
             myItem.Url=TextBoxUrl.Text  ;

             string PathFile = System.IO.Path.Combine(Server.MapPath("~"),"USER_DIR\\SYSUSER\\NEWS\\"+ myItem.Url);
             System.IO.File.WriteAllText(PathFile, TextBoxEDIT.Text, System.Text.Encoding.UTF8);

             myItem.Description = "";//

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    CMsgData.Items[i] = myItem;
                    break;
                }
            }

            WeTextBoxOne.Text = CMsgData.Getdata();

            TreeView1.Nodes.Clear();

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
            }
            TextBoxTitle.Text = "";
            txt0.Text = "";
            TextBoxUrl.Text = "";
            TextBoxEDIT.Text = "";
            Label2.Text = "";

            Button24_Click(null, null);
        }
        protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
        {
            if (Page.IsCallback)
            {
                e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName +
                                 "\\nItem=" + e.Items[0].VirtualPath + "')";
            }
            else
            {
                if (e.CommandName == "EditText")
                {
                    if (e.Items.Count == 0)
                        return;

                    FileManagerItemInfo item = e.Items[0];
                    ViewState["EditDocumentPath"] = item.PhysicalPath;

                    WeTextBoxFive.Text = ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(item.PhysicalPath);

                  //  string text = File.ReadAllText(item.PhysicalPath, System.Text.Encoding.UTF8);

                    //  TreeView1.Nodes.Add(new TreeNode("新图文消息", ""));
                    TreeView1.Nodes.Clear();

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadFile(item.PhysicalPath);

                    for (int i = 0; i < CMsgData.Items.Count; i++)
                    {
                        if (CMsgData.Items[i].Title != "")
                        {
                            TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
                        }
                    }

                    for (int i = 0; i < CMsgData.Items.Count; i++)
                    {
                        if (CMsgData.Items[i].Title == "")
                        {
                            CMsgData.Items.RemoveAt(i);
                        }
                    }

                    TextBoxTitle.Text ="";
                    txt0.Text ="";
                    TextBoxUrl.Text ="";
                    TextBoxEDIT.Text = "";
                    Label2.Text = "";

                    Image1.ImageUrl = "";

                    WeTextBoxOne.Text = CMsgData.Getdata();
                    Label1.Text = "";
                    FileManager1.Visible = false;
                    TextEditor.Visible = true;

                }
            }
        }
        protected void TreeView1_SelectedNodeChanged1(object sender, EventArgs e)
        {
            Label2.Text = TreeView1.SelectedNode.Text;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    TextBoxTitle.Text = CMsgData.Items[i].Title;
                    txt0.Text = CMsgData.Items[i].PicUrl;
                    TextBoxUrl.Text = CMsgData.Items[i].Url;
                    TextBoxEDIT.Text = CMsgData.Items[i].Description;
                    Image1.ImageUrl = CMsgData.Items[i].PicUrl;
                    break;
                }

            }
        }
示例#9
0
    /// <summary>
    /// 全新处理程序   主要作用
    /// 1 记录用户所有的输入
    /// 2 关键词匹配返回
    /// 3 不匹配的所有的输入 均返回 带 ID时间戳 的 Start
    /// </summary>
    /// <param name="context"></param>
    public void ProcessRequest(HttpContext context)
    {
        string httpMethod = context.Request.HttpMethod.ToUpper();

        if (httpMethod == "GET")
        {
            ProcessRequest2(context);
            //如果 是 验证  则 直接 退出
            return;
        }

        context.Response.ContentType = "text/plain";
        var m = ReceiveMessage.ParseFromContext();
        if (m == null)
            return;
        //获得当前 url 完整路径
        string host = context.Request.ServerVariables["HTTP_HOST"] + context.Request.ServerVariables["PATH_INFO"];
        host = host.Replace("v.ashx", "");
        string PathDir = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\USER\\" + ClassLibraryWeiBao.ClassServerCOM.GetMasterPasswordBytes(m.FromUserName));
        if (System.IO.Directory.Exists(PathDir) == false)
        {   //建立用户目录
            System.IO.Directory.CreateDirectory(PathDir);
            string PathUser = System.IO.Path.Combine(PathDir, "USER_NAME.TXT");
            System.IO.File.WriteAllText(PathUser, m.FromUserName, System.Text.Encoding.UTF8);
        }
        //被关注
        if (m.MsgType == MessageType.Event && m.InnerToXmlText().IndexOf("subscribe") >= 0)
        {
            string AXNUMPath = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\sysuser\\usernum.txt");
            string AXNUM = System.IO.File.ReadAllText(AXNUMPath);
            int LLNUM = 500;
            try
            {
                LLNUM = Int32.Parse(AXNUM) + 1;// 147091;
                System.IO.File.WriteAllText(AXNUMPath, LLNUM.ToString());
            }
            catch
            {
            }
            //系统目录 存放目录
            string PathFileOne = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\SYSSET\\WeiXinBasicConfigManagement\\WeiXinBasicConfigManagement.dll");
            String[] TXTSET = System.IO.File.ReadAllLines(PathFileOne, System.Text.Encoding.UTF8);

            // TXTSET[0]; 微信名称
            //TXTSET[1]; 微信号码
            //TXTSET[2]; 关注后回复的 字符串模板   格式: 欢迎关注【{0}】,您是我们第{1}关注者,输入 HELP 查看更多内容

            // 系统自动 寻找和匹配 start 关键字设置文件  如果找到 则自动返回
            if (true)
            {

                TypeMsg = 0;
                string UserID = m.FromUserName;
                string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
                RepMsgData myData = GetMySetDataG(context.Server.MapPath("~"), "start", host, ID_TIME);
                if (myData != null)
                {
                    string nn = myData.ToXmlText().ToLower();
                    if (TypeMsg == 1)
                    {
                        var r = m.GetNewsResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                    if (TypeMsg == 2)
                    {
                        var r = m.GetTextResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                    if (TypeMsg == 3)
                    {
                        var r = m.GetMusicResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                }

            }

            //当没有 start 图文回复关注的时候  自动 返回文本消息
            //发送关注返回数据
            var r2 = m.GetTextResponse();
            string result = string.Format(TXTSET[2], TXTSET[0], LLNUM);
            r2.Data = (TextMsgData)result;
            r2.Response();
            return;
        }

        //数据解析
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(m.ToXmlText());//"<xml><description><![CDATA[木子屋:http://www.mzwu.com/]]></description></xml>");

        //本地 地点  LBS
        if (m.MsgType == MessageType.Location)
        {

            string X = xmlDoc.SelectSingleNode("//Location_X").FirstChild.InnerText.ToLower().Trim();
            string Y = xmlDoc.SelectSingleNode("//Location_Y").FirstChild.InnerText.ToLower().Trim();

            string Scale = xmlDoc.SelectSingleNode("//Scale").FirstChild.InnerText.ToLower().Trim();

            long nX = (long )(double.Parse(X) * 100000 );
            long  nY = (long)(double.Parse(Y) * 100000);

            string NameX1000 = X.Replace(".","V") +"_"+Y.Replace(".","V");

            string NameX1001 = X.Replace(".", "V")+"0" + "_" + Y.Replace(".", "V");
            string NameX1002 = X.Replace(".", "V") + "0" + "_" + Y.Replace(".", "V")+"0";
            string NameX1003 = X.Replace(".", "V") + "_" + Y.Replace(".", "V") + "0";

            string NameX2 = nX.ToString() + "_" + nY.ToString();

            string PathFile00 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NameX1000 + ".dll"); //高精度地址
            string PathFile01 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NameX1001 + ".dll"); //高精度地址
            string PathFile02 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NameX1002 + ".dll"); //高精度地址
            string PathFile03 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NameX1003 + ".dll"); //高精度地址

            string PathFile2 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location2\\" + NameX2 + ".dll"); //模糊地址

            //精确地址匹配
            if (System.IO.File.Exists(PathFile00) == true)
            {
                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile00);

                for (int i = 0; i < CMsgData.Items.Count; i++)
                {
                    var XONE = CMsgData.Items[i];
                    XONE.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.PicUrl, host);
                    XONE.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.Url, host);
                    CMsgData.Items[i] = XONE;
                }

                var r = m.GetNewsResponse();
                r.Data = CMsgData;
                r.Response();
                return;
            }

            //精确地址匹配
            if (System.IO.File.Exists(PathFile01) == true)
            {
                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile01);
                for (int i = 0; i < CMsgData.Items.Count; i++)
                {
                    var XONE = CMsgData.Items[i];
                    XONE.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.PicUrl, host);
                    XONE.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.Url, host);
                    CMsgData.Items[i] = XONE;
                }
                var r = m.GetNewsResponse();
                r.Data = CMsgData;
                r.Response();
                return;
            }

            //精确地址匹配
            if (System.IO.File.Exists(PathFile02) == true)
            {
                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile02);
                for (int i = 0; i < CMsgData.Items.Count; i++)
                {
                    var XONE = CMsgData.Items[i];
                    XONE.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.PicUrl, host);
                    XONE.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.Url, host);
                    CMsgData.Items[i] = XONE;
                }
                var r = m.GetNewsResponse();
                r.Data = CMsgData;
                r.Response();
                return;
            }

            //精确地址匹配
            if (System.IO.File.Exists(PathFile03) == true)
            {
                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile03);
                for (int i = 0; i < CMsgData.Items.Count; i++)
                {
                    var XONE = CMsgData.Items[i];
                    XONE.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.PicUrl, host);
                    XONE.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.Url, host);
                    CMsgData.Items[i] = XONE;
                }
                var r = m.GetNewsResponse();
                r.Data = CMsgData;
                r.Response();
                return;
            }

            //模糊地址匹配
            if (System.IO.File.Exists(PathFile2) == true)
            {
                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile2);
                for (int i = 0; i < CMsgData.Items.Count; i++)
                {
                    var XONE = CMsgData.Items[i];
                    XONE.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.PicUrl, host);
                    XONE.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(XONE.Url, host);
                    CMsgData.Items[i] = XONE;
                }
                var r = m.GetNewsResponse();
                r.Data = CMsgData;
                r.Response();
                return;
            }

            //寻找地址匹配文件
            //GetX = GetLocationBox( X,Y,NameX  );
            //返回值
            //发送关注返回数据
            var r2 = m.GetTextResponse();
            string result = "您发送了位置信息 X:" + X + " Y:" + Y + " 缩放:" + Scale;
            r2.Data = (TextMsgData)result;
            r2.Response();
            return;

        }

        //菜单 或者 用户文本输入
        if (m.MsgType == MessageType.Text || (m.MsgType == MessageType.Event && m.InnerToXmlText().IndexOf("subscribe") < 0))
        {
            //读取
            string rr = "";

            if (m.MsgType == MessageType.Text)
            {
                rr = xmlDoc.SelectSingleNode("//Content").FirstChild.InnerText.ToLower().Trim();
            }
            else
            {
                rr = xmlDoc.SelectSingleNode("//EventKey").FirstChild.InnerText.ToLower().Trim();
            }

            //用户日志文件
            string Nsame = DateTime.Now.ToString().Replace(":", "_").Replace("-", "_").Replace("\\", "_").Replace("/", "_").Replace(" ", "_") + ".txt";
            string PathUserData = System.IO.Path.Combine(PathDir, Nsame);
            //记录用户输入到用户文件
            StreamWriter sws = new StreamWriter(PathUserData, true, System.Text.Encoding.UTF8);
            sws.WriteLine(rr.Replace("\n", " "));
            sws.Close();

            //首先判断转义  遇到转义直接替换
            string ZhuanYi = GetZhuanYi(context.Server.MapPath("~"), rr);
            if (ZhuanYi.Length > 0)
                rr = ZhuanYi;

            //微墙查询
            if (rr.ToLower() == "q"|| rr.ToLower() == "wq" )
            {
                string PathDirRSWQ = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\WEIQIANG\\");
                if (System.IO.Directory.Exists(PathDirRSWQ) == false)
                {
                    System.IO.Directory.CreateDirectory(PathDirRSWQ);
                }
                DateTime QDVVVV = DateTime.Now;
                string QAXNUMPathWQ = System.IO.Path.Combine(PathDirRSWQ, QDVVVV.Year + "_" + QDVVVV.Month.ToString("D2") + "_" + (QDVVVV.Day).ToString("D2") + "_WQ.txt");
                if (System.IO.File.Exists(QAXNUMPathWQ) == false)
                    System.IO.File.WriteAllText(QAXNUMPathWQ, DateTime.Now.Hour.ToString("D2") + ":" + DateTime.Now.Minute.ToString("D2") + " " + "小萌: 今天,开始新的一天!\r\n");

                string UserID = m.FromUserName;  //用户 ID
                //使用时间戳加密
                string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);

                var r = m.GetNewsResponse();
                r.Data = GetMySetDataGW(host, QAXNUMPathWQ, ID_TIME);
                r.Response();
                return;
            }

            //微墙输入
            if (rr.ToLower().IndexOf("q@") == 0 || rr.ToLower().IndexOf("墙@") == 0 || rr.ToLower().IndexOf("信息@") == 0 || rr.ToLower().IndexOf("微信墙@") == 0 || rr.ToLower().IndexOf("微信@") == 0 || rr.ToLower().IndexOf("微墙@") == 0 || rr.ToLower().IndexOf("wq@") == 0)
            {
                string PathDirRSWQ = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\WEIQIANG\\");
                DateTime QDVVVV = DateTime.Now;
                string QAXNUMPathWQ = System.IO.Path.Combine(PathDirRSWQ, QDVVVV.Year + "_" + QDVVVV.Month.ToString("D2") + "_" + (QDVVVV.Day).ToString("D2") + "_WQ.txt");
                string[] XWQ = rr.Split('@');
                if (XWQ[1].Replace("\r", "").Replace("\n", "").Length > 0)
                {
                    string DATAR = DateTime.Now.Hour.ToString("D2") + ":" + DateTime.Now.Minute.ToString("D2") + " " + XWQ[1].Replace("\r", "").Replace("\n", "").Replace("  ", " ");
                    StreamWriter sws2 = new StreamWriter(QAXNUMPathWQ, true, System.Text.Encoding.UTF8);
                    sws2.WriteLine(DATAR);
                    sws2.Close();
                }
                var r = m.GetNewsResponse();
                //load read txt  show  9
                string UserID = m.FromUserName;  //用户 ID
                //使用时间戳加密
                string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);

                r.Data = GetMySetDataGW(host, QAXNUMPathWQ, ID_TIME);
                r.Response();
                return;
            }

            if (rr == "@")   //用户签到
            {
                cmd_qiandao myQD = new cmd_qiandao();
                myQD.RID = m.FromUserName;
                //发送关注返回数据
                var r2 = m.GetTextResponse();
                r2.Data = (TextMsgData)myQD.GetDATA_ONE(); ;
                r2.Response();
                return;
            }

            if (rr.ToLower() == "ft") //照片墙
            {
                string PathDirRSWQ = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\PHOTO\\");
                var r = m.GetNewsResponse();
                string UserID = m.FromUserName;  //用户 ID
                //使用时间戳加密
                string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
                r.Data = GetMySetDataFT(host, PathDirRSWQ, ID_TIME);
                r.Response();
                return;
            }

            // 积分
            if (rr.ToLower() == "jf")
            {
                cmd_jifen myJF = new cmd_jifen();
                myJF.RID = m.FromUserName;
                var r2 = m.GetTextResponse();
                r2.Data = (TextMsgData)myJF.GetDATA(); ;
                r2.Response();
                return;

            }

            ////me 我的应用  出现  我的积分 我的订单 优惠劵 私信 等等各项的信息内容
            //if (rr.ToLower() == "me")
            //{
            //    cmd_jifen myJF = new cmd_jifen();
            //    myJF.RID = m.FromUserName;
            //    var r2 = m.GetTextResponse();
            //    r2.Data = (TextMsgData)myJF.GetDATA(); ;
            //    r2.Response();
            //    return;

            //}

            // 购物  出现  出现  微商店中的 前 8个商品信息 用户直接点击即可购买 第二行显示我的订单状况
            if (rr.ToLower() == "gw")
            {

                //获得 订单数量  和 商品列表
                  //订单目录
                string PathDirSYS = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\Shangcheng\\DINGDAN\\");
                string RID = m.FromUserName; ;
                string[] XXXX = System.IO.Directory.GetFiles(PathDirSYS, "*" + RID + "*");
                //订单数量

                string PathFile = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~"), "USER_DIR\\SYSUSER\\Shangcheng\\goods.dll"); //图文 关键词回复目录)

                NewsMsgData CMsgData = new NewsMsgData();
                CMsgData.LoadFile(PathFile);
                int LL=CMsgData.Items.Count;

                    string UserID = m.FromUserName;  //用户 ID
            //使用时间戳加密
                 string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);

                if(LL >9 )LL=9;

                NewsMsgData CMsgDataRT = new NewsMsgData();

                NewsItem titleItem = new NewsItem();
                titleItem.Title = "微商店 我的订单:"+XXXX.Length.ToString()+"个 点击进入" ;
                titleItem.Description = "微商店 我的订单:" + XXXX.Length.ToString() + "个 点击进入";
                titleItem.Url = "http://" + (host + "/cmd/shangcheng.aspx?id=").Replace("//", "/").Replace("\\", "\\") + ID_TIME;

                CMsgDataRT.Items.Add(titleItem);

                for (int i = 0; i < LL; i++)
                {
                    CMsgData.Items[i].Url = titleItem.Url;
                    CMsgDataRT.Items.Add(CMsgData.Items[i]);
                }

                var r = m.GetNewsResponse();
                r.Data = CMsgDataRT;
                r.Response();

            }

            // 优惠劵  出现我的优惠劵 信息
            if (rr.ToLower() == "yhj")
            {

                    //var r = m.GetNewsResponse();
                    //string UserID = m.FromUserName;  //用户 ID
                    ////使用时间戳加密
                    //string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);

                    //string Url2 = "http://" + (host +"").Replace("//", "/");
                    //string PicUrl2 = "http://" + (host +"").Replace("//", "/");
                    //r.Data = GetStartDataNewOne( "优惠劵说明", "优惠劵标题",  PicUrl2,   Url2);
                    //r.Response();
                    //return;
                rr = "优惠劵";

            }

            // 大转盘  出现大转盘
            if (rr.ToLower() == "dzp")
            {
                rr = "大转盘";
            }

            // 刮刮卡  出现刮刮卡
            if (rr.ToLower() == "ggk")
            {
                rr = "刮刮卡";
            }

            // 游戏频道  出现游戏
            if (rr.ToLower() == "yx")
            {
                rr = "游戏";
            }

            // 听歌
            if (rr.ToLower() == "tg")
            {
                string PathDirMp3 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MP3");
                string PathDirMp32 = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\MP32");
                string[] ASONG = System.IO.Directory.GetFiles(PathDirMp3);
                Random nmn = new Random(Environment.TickCount);
                double nmn1 = nmn.NextDouble();
                int xx_int = (int)((double)ASONG.Length * nmn1);
                string URLMP3 = "";
                string URLMP3_TXT = "";
                if (ASONG.Length > 0)
                {
                    System.IO.FileInfo xxfile = new System.IO.FileInfo(ASONG[xx_int]);
                    URLMP3_TXT = ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(xxfile);

                    string PathDirRS2zMp3URL = System.IO.Path.Combine(PathDirMp32, GetMasterPasswordBytes(xxfile.Name) + ".mp3");

                    if (System.IO.File.Exists(PathDirRS2zMp3URL) == false)
                    {
                        System.IO.File.Copy(ASONG[xx_int], PathDirRS2zMp3URL);
                    }

                    URLMP3 = "http://" + host + "USER_DIR/SYSUSER/MP32/" + GetMasterPasswordBytes(xxfile.Name) + ".mp3";// JD[0].Replace("/", "").Replace("\n", "").Replace("\\", "/");

                }
                //音乐响应!
                var rx = m.GetMusicResponse();
                rx.Data = new MusicMsgData
                {
                    Description = "输入TG可以换歌",
                    Title = "微信音乐台:\n" + URLMP3_TXT,//+ URLMP3,
                    MusicUrl = URLMP3,// @"http://news.iciba.com//admin//tts//2014-03-18.mp3",
                    HQMusicUrl = URLMP3//"http://www.0951uc.com/%E9%9D%92%E6%98%A5%E6%A0%A1%E5%9B%AD"
                };

                rx.Response();

                return;

            }

            //
            //音乐响应
            if (rr == "音乐测试")
            {
                var rx = m.GetMusicResponse();
                rx.Data = new MusicMsgData
                {
                    Description = "音乐描述",
                    Title = "音乐标题",
                    MusicUrl = "http://音乐url",
                    HQMusicUrl = "http://高品质url"
                };

                rx.Response();
                return;
            }

            if (true)
            {
                //查找匹配文件
                TypeMsg = 0;
                string UserID = m.FromUserName;
                string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
                RepMsgData myData = GetMySetDataG(context.Server.MapPath("~"), rr, host, ID_TIME);
                if (myData != null)
                {
                    string nn = myData.ToXmlText().ToLower();
                    if (TypeMsg == 1)
                    {
                        var r = m.GetNewsResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                    if (TypeMsg == 2)
                    {
                        var r = m.GetTextResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                    if (TypeMsg == 3)
                    {
                        var r = m.GetMusicResponse();
                        r.Data = myData;
                        r.Response();
                        return;
                    }

                }

            }

        } if (m.MsgType == MessageType.Image) // 用户上传了图片
        {
            //读取 并且保存用户数据 到用户文件夹
            string rrUrl = xmlDoc.SelectSingleNode("//PicUrl").FirstChild.InnerText;
            System.Net.WebClient web = new System.Net.WebClient();
            DateTime tv = DateTime.Now;
            string name = tv.Year + "_" + tv.Month.ToString("D2") + "_" + (tv.Day).ToString("D2") + "_" + (tv.Hour).ToString("D2");
            string name_full = "";  //微信照片墙 图片记录
            string my_name_full = ""; //用户自己的目录图片

            //判断扩展名
            string IMG_EXT = ".png";
            string NewURLTest = rrUrl.ToLower() + "Z";
            if (NewURLTest.IndexOf(".jpgZ") > 0)
                IMG_EXT = ".jpg";

            if (NewURLTest.IndexOf(".pngZ") > 0)
                IMG_EXT = ".png";

            if (NewURLTest.IndexOf(".gifZ") > 0)
                IMG_EXT = ".gif";

            if (NewURLTest.IndexOf(".bmpZ") > 0)
                IMG_EXT = ".bmp";

            for (int i = 0; i < 999; i++)
            {
                name_full = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\PHOTO\\" + name) + "_" + i.ToString("D3") + IMG_EXT;
              //  my_name_full = System.IO.Path.Combine(PathDir, "USER_DIR\\SYSUSER\\PHOTO\\" + name) + "_" + i.ToString("D3") + IMG_EXT;
                my_name_full = System.IO.Path.Combine(PathDir,   name) + "_" + i.ToString("D3") + IMG_EXT;
                if (System.IO.File.Exists(name_full) == false && System.IO.File.Exists(my_name_full) == false)
                    break;
            }

            //下载和复制
            try
            {
                web.DownloadFile(rrUrl, name_full);
                System.IO.File.Copy(name_full, my_name_full);
            }
            catch
            { }

            //返回微信墙
            string PathDirRSWQ = System.IO.Path.Combine(context.Server.MapPath("~"), "USER_DIR\\SYSUSER\\PHOTO\\");
            var r = m.GetNewsResponse();
            string UserID = m.FromUserName;  //用户 ID
            //使用时间戳加密
            string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
            r.Data = GetMySetDataFT(host, PathDirRSWQ, ID_TIME);
            r.Response();
            return;
        }

        if (true)
        {
            //查找help 文件   系统 匹配不到任何数据时  自动返回
            TypeMsg = 0;
            string UserID = m.FromUserName;
            string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
            RepMsgData myData = GetMySetDataG(context.Server.MapPath("~"), "help", host, ID_TIME);
            if (myData != null)
            {
                string nn = myData.ToXmlText().ToLower();
                if (TypeMsg == 1)
                {
                    var r = m.GetNewsResponse();
                    r.Data = myData;
                    r.Response();
                    return;
                }

                if (TypeMsg == 2)
                {
                    var r = m.GetTextResponse();
                    r.Data = myData;
                    r.Response();
                    return;
                }

                if (TypeMsg == 3)
                {
                    var r = m.GetMusicResponse();
                    r.Data = myData;
                    r.Response();
                    return;
                }

            }

        }

        //用户默认输入 均返回 start里面的值
        {
            var r = m.GetNewsResponse();
            string UserID = m.FromUserName;  //用户 ID
            //使用时间戳加密
            string ID_TIME = ClassLibraryWeiBao.ClassTimeEncryptionAlgorithm.GetTimeID(context.Server.MapPath("~"), UserID);
            //string host = context.Request.ServerVariables["HTTP_HOST"] + context.Request.ServerVariables["PATH_INFO"];
            r.Data = GetStartData2(context.Server.MapPath("~"), host, ID_TIME);  //  GetMySetData(fff, URLX);

            r.Response();
            return;
        }
    }
        protected void Button23_Click(object sender, EventArgs e)
        {
            if (TreeView1.Nodes.Count >= 10)
                return;

            for (int j = 0; j < 100; j++)
            {
                string Name = "新图文消息" + j.ToString("D2");
                bool IsOK=true ;
                for(int i=0;i<TreeView1.Nodes.Count;i++)
                {
                    if (TreeView1.Nodes[i].Text == Name)
                    {
                        IsOK = false; break;
                    }
                }

                if (IsOK == true)
                {
                    TreeView1.Nodes.Add(new TreeNode(Name));

                    Label2.Text = Name;

                    TextBoxTitle.Text =Name;
                    txt0.Text ="";
                    TextBoxUrl.Text ="";
                    TextBoxEDIT.Text = "内容描述";

                    NewsItem myItem = new NewsItem();
                    myItem.Title = Name;
                    myItem.PicUrl ="";
                    myItem.Url = "";
                    myItem.Description = "内容描述";

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadSet(WeTextBoxOne.Text);

                    CMsgData.Items.Add(myItem);
                    WeTextBoxOne.Text = CMsgData.Getdata();

                    Image1.ImageUrl = "";

                    return;
                }

            }
        }
示例#11
0
    public static NewsMsgData GetMySetDataGW3(string PathFile)
    {
        string[] myData = System.IO.File.ReadAllLines(PathFile, System.Text.Encoding.UTF8);

        NewsMsgData C = new NewsMsgData();

        List<NewsItem> Items = new List<NewsItem>();

        NewsItem XoneX = new NewsItem
        {
            Description = "微信吐槽墙 - 【吐槽@昵称:内容】", // "new1",
            Title = "微信吐槽墙 - 【吐槽@昵称:内容】",// "EN了",
            PicUrl = "",//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
            Url = "http://www.0951uc.com/user_dir/tupdate.ashx"// myData[i + 3]// "http://baidu.com"
        };

        Items.Add(XoneX);

        //响应3条新闻信息

        for (int i = myData.Length - 1; i >= 0; i--)
        {

            string MD = myData[i];
            if (MD.Trim().Length > 0)
            {
                if (MD.Length >= 22)
                    MD = MD.Substring(0, 22);

                NewsItem Xone = new NewsItem
                {
                    Description = MD, // "new1",
                    Title = MD,// "EN了",
                    PicUrl = "",//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
                    Url = "http://www.0951uc.com/user_dir/tupdate.ashx"// myData[i + 3]// "http://baidu.com"
                };

                Items.Add(Xone);
                if (Items.Count >= 9)
                    break;
            }
        }

        NewsItem XoneX2 = new NewsItem
        {
            Description = "微信微信墙【微墙@昵称:内容】", // "new1",
            Title = "点击查看更多..",// "EN了",
            PicUrl = "",//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
            Url = "http://www.0951uc.com/user_dir/tupdate.ashx"// myData[i + 3]// "http://baidu.com"
        };

        Items.Add(XoneX2);

        C.Items = Items;

        return C;
    }
示例#12
0
        protected void TreeView1_SelectedNodeChanged1(object sender, EventArgs e)
        {
            Label2.Text = TreeView1.SelectedNode.Text;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    TextBoxTitle.Text = CMsgData.Items[i].Title;
                    txt0.Text = CMsgData.Items[i].PicUrl;
                    TextBoxUrl.Text = CMsgData.Items[i].Url;

                    string DataHTML = "";

                    try
                    {
                        //读取文件
                        string PathFile = System.IO.Path.Combine(Server.MapPath("~"),"USER_DIR\\SYSUSER\\NEWS\\"+  CMsgData.Items[i].Url);
                      DataHTML=  System.IO.File.ReadAllText(PathFile, System.Text.Encoding.UTF8);

                    }
                    catch
                    { }

                    TextBoxEDIT.Text = DataHTML;// CMsgData.Items[i].Description;

                    break;
                }

            }
        }
示例#13
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        if (WeTextBoxOne.Text.Trim().Length < 5 || WeTextBoxOne.Text == "地址和联系方式:")
        {
            Label1.Text = "请正确填写地址和联系方式";
            return;
        }

        string PathFile = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~"), "USER_DIR\\SYSUSER\\Shangcheng\\goods.dll"); //图文 关键词回复目录)
        NewsMsgData CMsgData = new NewsMsgData();
        CMsgData.LoadFile(PathFile);

        Hashtable MMM = GetGouwuChe();
        int WUNUM = 0;
        string GetDingDan = "";

        foreach (DictionaryEntry one in MMM)
        {
            WUNUM += (int)one.Value;

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                if (CMsgData.Items[i].Title.Trim() == one.Key.ToString().Trim())
                {
                    GetDingDan += " 名称:" + CMsgData.Items[i].Title + "\t单价:" + CMsgData.Items[i].Description + "\t数量:" + one.Value.ToString() + "\r\n";
                }
            }

        }

        if (WUNUM < 0.1)
        {
            Label1.Text = "购物车为空";
            return;
        }

        try
        {

            //发送 购物车里的数据 到 采购清单

            //订单目录
            string PathDirSYS = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\SHANGCHENG\\DINGDAN");

            DateTime PP = DateTime.Now;

            string TXTXX = System.IO.Path.Combine(PathDirSYS, PP.Year.ToString("D2") + PP.Month.ToString("D2") + PP.Day.ToString("D2") + PP.Hour.ToString("D2") + PP.Minute.ToString("D2") + "_" + RID + ".dll");

            string PathDir = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~"), "USER_DIR\\USER\\" + ClassLibraryWeiBao.ClassServerCOM.GetMasterPasswordBytes(RID));
            string PathSHangcheng = System.IO.Path.Combine(PathDir, "SHANGCHENG.TXT");

            string PathLiuYan = System.IO.Path.Combine(PathDir, "liuyan.TXT");
            string PathDizHI = System.IO.Path.Combine(PathDir, "dizhi.TXT");
            //保存地址
            string dizhi = System.IO.File.ReadAllText(PathDizHI, System.Text.Encoding.UTF8).Trim().Replace("\n", " ").Replace("\r", " ").Replace("\t", " ");

            GetDingDan += "=======================\r\n";
            GetDingDan += "下单时间:" + DateTime.Now.ToString() + "\r\n";

            GetDingDan += "=======================\r\n";
            GetDingDan += "卖家:" + RID+"\r\n";
            GetDingDan += "=======================\r\n";
            GetDingDan += "地址:" + dizhi+"\r\n";
            GetDingDan += "=======================\r\n";
            GetDingDan += "留言:" + WeTextBoxOne.Text.Trim().Replace("\n", " ").Replace("\t", " ").Replace("\r", " ")+"\r\n";

            //写入订单
            System.IO.File.WriteAllText(TXTXX, GetDingDan);

            //发送购物清单 到系统
            MMM.Clear();

            //清空购物车
            System.IO.File.WriteAllText(PathSHangcheng, "", System.Text.Encoding.UTF8);

            //清除留言
            WeTextBoxOne.Text = "";
            System.IO.File.WriteAllText(PathLiuYan, "", System.Text.Encoding.UTF8);

            LinkButton1.PostBackUrl = "dingdan.aspx?id=" + TIME_MID;
            LinkButton1.Visible = true;
            Label1.Text = DateTime.Now.ToString() + " - 订单提交成功";
        }
        catch
        {
            Label1.Text = DateTime.Now.ToString() + " - 订单提交失败";
        }
    }
        protected void Button24_Click(object sender, EventArgs e)
        {
            if (WeTextBoxFive.Text.Trim() == "")
            {
                Label1.Text = "请输入关键字"; return;
            }

            NewsItem myItem = new NewsItem();
            myItem.Title = TextBoxTitle.Text;
            myItem.PicUrl = txt0.Text;
            myItem.Url = TextBoxUrl.Text;
            myItem.Description = TextBoxEDIT.Text;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            bool IsSave = false;
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                CMsgData.Items[i] = myItem;
                IsSave = true;
                break;

            }

            if (IsSave == false)
                CMsgData.Items.Add(myItem);

            WeTextBoxOne.Text = CMsgData.Getdata();

            try
            {
                long nX = (int)(double.Parse(WeTextBoxFive.Text) * 100000);
                long nY = (int)(double.Parse(WeTextBoxSix.Text) * 100000);

                string NAME2 = nX.ToString() + "_" + nY.ToString();   //模糊地址

                //long nX1 = (int)(double.Parse(WeTextBoxFive.Text) * 10000000);
                //long nY1 = (int)(double.Parse(WeTextBoxSix.Text) * 10000000);

                string NAME1 = WeTextBoxFive.Text.Replace(".", "V") + "_" + WeTextBoxSix.Text.Replace(".", "V"); //高精度地址

                string PathFile1 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location1\\" + NAME1 + ".dll"); //图文 关键词回复目录);
                File.WriteAllText(PathFile1, WeTextBoxOne.Text, System.Text.Encoding.UTF8);

                string PathFile2 = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\MyPost\\location2\\" + NAME2 + ".dll"); //图文 关键词回复目录);
                File.WriteAllText(PathFile2, WeTextBoxOne.Text, System.Text.Encoding.UTF8);

                FileManager1.Visible = true;
                TextEditor.Visible = false;
                Label1.Text = "保存成功!";

                FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details;

            }
            catch
            {
                Label1.Text = "保存失败,关键字中不能有特殊字符";
            }
        }
示例#15
0
    /// <summary>
    /// 返回总的数量
    /// </summary>
    /// <returns></returns>
    /*
    public string GetCount()
    {
        try
        {
            // string FF=  "function demo04x() {  jBox.open(\"iframe:http://www.baidu.com\", \"微信助手\", $(window).width() * 0.96, $(window).height()*0.6);   }";

            string PathDirRSQD = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\Shangcheng\\");

            if (System.IO.Directory.Exists(PathDirRSQD) == false)
            {
                System.IO.Directory.CreateDirectory(PathDirRSQD);
            }

            string[] MyLIST = System.IO.Directory.GetFiles(PathDirRSQD, "*.png");

            return MyLIST.Length.ToString();
        }
        catch
        {
            return "0";
        }
    }
    */
    /// <summary>
    /// 获取 当前商品信息
    /// </summary>
    /// <param name="a">商品编号</param>
    /// <param name="ty"></param>
    public static string GetLIST()
    {
        //获得购物车
        Hashtable MMM = GetGouwuChe();

        string PathFile = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~"), "USER_DIR\\SYSUSER\\Shangcheng\\goods.dll"); //图文 关键词回复目录)

        /*
         <table width='100%'  border='1' align='left' cellpadding='0' cellspacing='4' id='myTable'>
             <tr class='goodshead'><td height='24'> </td></tr>

        <tr class='goodsline'><td height='24'><table width='100%'  border='0' align='left' cellpadding='0' cellspacing='4' id='myTable2'><tr class='goodsline'><td width='50' rowspan='2'>
         <img src='' alt='欢迎选购' name='AAA' width='50' height='50' id='AAA' style='background-color: #99CC99' /></td>
        <td width='1179' height='24'><h5>商品名称 商品价格</h5></td></tr>

          <tr class='goodsline'><td height='24'><h5>商品 购买</h5></td></tr></table></td></tr>

        </table>

         */

        try
        {
            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadFile(PathFile);

            string RT = "<tr><td height='24'>" + GetAllQian(CMsgData, MMM) + "</td></tr>";

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                int WuNum = 0;
                if (MMM.Contains(CMsgData.Items[i].Title) == true)
                {
                    WuNum = (int)MMM[CMsgData.Items[i].Title];
                }

                string XXX1 = "javascript:AddProduct('" + CMsgData.Items[i].Title + "','+','0');void(0);";
                string XXX2 = "javascript:AddProduct('" + CMsgData.Items[i].Title + "','-','0');void(0);";
                string NOW = " 当前数量【" + WuNum.ToString() + "】<a href=\"" + XXX1 + "\">[+]</a> " + " <a href=\"" + XXX2 + "\"> [-]</a>";
                string url = "USER_DIR\\SYSUSER\\Shangcheng\\goods\\" + CMsgData.Items[i].Url;

                RT += "<tr><td height='24'><table width='100%'  border='0' cellpadding='0' cellspacing='0' id='myTable2' class='cpbiaoge'><tr><td width='50' rowspan='2'>";
                RT += "<a href='" + url + "'><img src='" + CMsgData.Items[i].PicUrl + "' alt='欢迎选购' name='AAA' width='50' height='50' id='AAA' style='background-color: #99CC99' /></a></td>";
                RT += "<td><h5>" + CMsgData.Items[i].Title + "  &nbsp; &nbsp;售价:" + CMsgData.Items[i].Description + "</h5></td></tr>";
                RT += "<tr><td height='24'><h5>" + NOW + "</h5></td></tr></table></td></tr>";

            }

            RT = "<table width='100%'  border='0' cellpadding='0' cellspacing='0' id='myTable'  class='cpbiaoge'>" + RT + "</table>\r\n";
            return RT;

        }
        catch
        {
            return "数据配置错误";
        }
    }
示例#16
0
    /// <summary>
    /// 获得 购物车中所有物品 的数量 和 金钱总数
    /// </summary>
    /// <returns></returns>
    public static String GetAllQian(NewsMsgData CMsgData, Hashtable MMM)
    {
        int WUNUM = 0;
        double QIAM = 0;

        foreach (DictionaryEntry one in MMM)
        {
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                if (CMsgData.Items[i].Title.Trim() == one.Key.ToString().Trim())
                {
                    double AONEQAIN = double.Parse(CMsgData.Items[i].Description);

                    QIAM += (int)one.Value * AONEQAIN;
                    WUNUM += (int)one.Value;
                }
            }
        }

        return "物品总数:" + WUNUM + " 总价格:" + QIAM;
    }
示例#17
0
    /// <summary>
    /// 获取 Start数据
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static NewsMsgData GetStartData2(string apppath, string host, string id)
    {
        //host = host.Replace("v.ashx", "");
        ;// "http://" + host + "user_dir/sysuser/img/start.jpg";

        string url2 = "http://" + host + "Web.aspx?id=" + id;

        //标题
        string PathFileT6 = System.IO.Path.Combine(apppath, "USER_DIR\\SYSUSER\\SYSSET\\WeiXinBasicConfigManagement\\Main01T6.dll");
        string TextBox6_text = System.IO.File.ReadAllText(PathFileT6, System.Text.Encoding.UTF8);

        //内容
        string PathFileT7 = System.IO.Path.Combine(apppath, "USER_DIR\\SYSUSER\\SYSSET\\WeiXinBasicConfigManagement\\Main01T7.dll");
        string TextBox7_Text = System.IO.File.ReadAllText(PathFileT7, System.Text.Encoding.UTF8);

        string PathFileT8 = System.IO.Path.Combine(apppath, "USER_DIR\\SYSUSER\\SYSSET\\WeiXinBasicConfigManagement\\Main01T8.dll");
        string TextBox8_Text = System.IO.File.ReadAllText(PathFileT8, System.Text.Encoding.UTF8);

        string url1 = "http://" + (host + TextBox8_Text).Replace("//", "/");

        //微社区入口

        NewsMsgData C = new NewsMsgData
        {

            Items = new List<NewsItem>
        {
            new NewsItem
            {
                Description = TextBox7_Text,//" Start,这是一个极速用户交互程序来帮助您在微信学习、社交和生活,点击进入",
                Title =TextBox6_text,// " Start应用服务",
                PicUrl =url1,
                Url = url2
            }
        }
        };

        return C;
    }
示例#18
0
        protected void Button23_Click(object sender, EventArgs e)
        {
            for (int j = 0; j < 10000; j++)
            {
                string Name = "新图文消息" + j.ToString("D2");
                bool IsOK=true ;

                string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\page"+j.ToString()+".htm" );

                if (System.IO.File.Exists(PathFile) == true)
                {
                    IsOK = false;
                }
                else
                {
                    for (int i = 0; i < TreeView1.Nodes.Count; i++)
                    {
                        //节点名称  已经存在 或者 文件名已经存在
                        if (TreeView1.Nodes[i].Text == Name)
                        {
                            IsOK = false; break;
                        }
                    }
                }

                if (IsOK == true)
                {
                    string filename ="page"+   j.ToString() + ".htm";  //自动生产一个文件名

                    TreeView1.Nodes.Add(new TreeNode(Name));

                    Label2.Text = Name;

                    TextBoxTitle.Text =Name;
                    txt0.Text ="";
                    TextBoxUrl.Text = filename;
                    TextBoxEDIT.Text = "内容描述";

                    NewsItem myItem = new NewsItem();
                    myItem.Title = Name;
                    myItem.PicUrl ="";
                    myItem.Url = filename;
                    myItem.Description = "内容描述";

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadSet(WeTextBoxOne.Text);

                    CMsgData.Items.Add(myItem);
                    WeTextBoxOne.Text = CMsgData.Getdata();

                    return;
                }

            }
        }
示例#19
0
    /// <summary>
    /// 从 3个 系统关键词路径中寻找关键词匹配
    /// </summary>
    /// <param name="SysPath">系统路径</param>
    /// <param name="KeyWord">关键字</param>
    /// <param name="host">url基地址</param>
    /// <param name="timestr"> 时间戳</param>
    /// <returns></returns>
    public static RepMsgData GetMySetDataG(string SysPath, string KeyWord, string host , string timestr)
    {
        string NP_IMG = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\IMG\\" + KeyWord + ".dll");
        string NP_TXT = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\TXT\\" + KeyWord + ".dll");
        string NP_VOC = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\VOC\\" + KeyWord + ".dll");

        if (System.IO.File.Exists(NP_IMG))
        {
            TypeMsg = 1;
            NewsMsgData C = new NewsMsgData();

            C.LoadFile(NP_IMG);

            if (C.Items.Count == 1)
            {

                var X = C.Items[0];
                X.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.PicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

                if (X.Url.Trim() == "")
                {
                    //生成一个指向 本关键词中设置的url
                    string URL = "cmd/tuwen.aspx?w=" + KeyWord + "&t=" + X.Title.Trim();

                    X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(URL, host);
                }
                else
                {
                    X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.Url, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
                }

                X.Description = ClassLibraryWeiBao.ClassWeiWeiXin.NoHTML(X.Description);

            }
            else
            {
                for (int i = 0; i < C.Items.Count; i++)
                {
                    var X = C.Items[i];
                    X.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.PicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

                    if (X.Url.Trim() == "")
                    {
                        //生成一个指向 本关键词中设置的url
                        string URL = "cmd/tuwen.aspx?w=" + KeyWord + "&t=" + X.Title.Trim();

                        X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(URL, host);
                    }
                    else
                    {
                        X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.Url, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
                    }
                    X.Description = "";
                }
            }

            return C;
        }

        if (System.IO.File.Exists(NP_TXT))
        {
            TypeMsg = 2;
            TextMsgData C = new TextMsgData();
            C.LoadFile(NP_TXT);

            return C;
        }

        if (System.IO.File.Exists(NP_VOC))
        {
            TypeMsg = 3;
            MusicMsgData C = new MusicMsgData();
            C.LoadFile(NP_VOC);

            C.HQMusicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(C.HQMusicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
            C.MusicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(C.MusicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

            return C;
        }

        // TextMsgData XC = new TextMsgData();
        //XC.Content = "请输入正确关键字";
        return null;
    }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

             string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\NEWS\\news.dll"); //图文 关键词回复目录);

            TreeView1.Nodes.Clear();

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadFile(PathFile);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
            }

            WeTextBoxOne.Text = CMsgData.Getdata();

            TextBoxTitle.Text = "";
            txt0.Text = "";
            TextBoxUrl.Text = "";
            TextBoxEDIT.Text = "";
            Label2.Text = "";
        }
        protected void Button22_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < TreeView1.Nodes.Count; i++)
            {
                if (TreeView1.Nodes[i].Text == Label2.Text)
                {
                    TreeView1.Nodes.RemoveAt(i);
                    break;
                }

            }

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    CMsgData.Items.RemoveAt(i);

                    break;
                }

            }

            WeTextBoxOne.Text = CMsgData.Getdata();

               TextBoxTitle.Text ="";
                    txt0.Text ="";
                    TextBoxUrl.Text ="";
                    TextBoxEDIT.Text = "";
                    Label2.Text = "";

                    Button24_Click(null, null);
        }
        protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
        {
            if (Page.IsCallback)
            {
                e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName +
                                 "\\nItem=" + e.Items[0].VirtualPath + "')";
            }
            else
            {
                if (e.CommandName == "EditText")
                {
                    if (e.Items.Count == 0)
                        return;

                    FileManagerItemInfo item = e.Items[0];
                    ViewState["EditDocumentPath"] = item.PhysicalPath;

                    char[] x={'_','.'};
                  string[] Name2=   ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(item.PhysicalPath).Split(x);

                  WeTextBoxFive.Text=  Name2[0].Replace("V",".") ;
                  WeTextBoxSix.Text = Name2[1].Replace("V", ".");
                  //  string text = File.ReadAllText(item.PhysicalPath, System.Text.Encoding.UTF8);

                    //  TreeView1.Nodes.Add(new TreeNode("新图文消息", ""));

                    NewsMsgData CMsgData = new NewsMsgData();
                    CMsgData.LoadFile(item.PhysicalPath);

                    TextBoxTitle.Text = CMsgData.Items[0].Title;
                    txt0.Text = CMsgData.Items[0].PicUrl;
                    TextBoxUrl.Text = CMsgData.Items[0].Url;
                    TextBoxEDIT.Text = CMsgData.Items[0].Description;

                    WeTextBoxOne.Text = CMsgData.Getdata();
                    Label1.Text = "";
                    FileManager1.Visible = false;
                    TextEditor.Visible = true;
                }
            }
        }
示例#23
0
    /// <summary>
    /// 获取 单图文消息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static NewsMsgData GetStartDataNewOne(string Description2, string Title2, string PicUrl2, string Url2)
    {
        //微社区入口

        NewsMsgData C = new NewsMsgData
        {

            Items = new List<NewsItem>
        {
            new NewsItem
            {
                Description = Description2,//" Start,这是一个极速用户交互程序来帮助您在微信学习、社交和生活,点击进入",
                Title =Title2,// " Start应用服务",
                PicUrl =PicUrl2,
                Url = Url2
            }
        }
        };

        return C;
    }
        protected void Button21_Click(object sender, EventArgs e)
        {
            NewsItem myItem = new NewsItem();
             myItem.Title =  TextBoxTitle.Text ;
             myItem.PicUrl= txt0.Text  ;
             myItem.Url=TextBoxUrl.Text  ;
             myItem.Description= TextBoxEDIT.Text ;

            NewsMsgData CMsgData = new NewsMsgData();
            CMsgData.LoadSet(WeTextBoxOne.Text);

            bool IsSave = false;
            for (int i = 0; i < CMsgData.Items.Count; i++)
            {

                if (CMsgData.Items[i].Title == Label2.Text)
                {
                    CMsgData.Items[i] = myItem;
                    IsSave = true;
                    break;
                }
            }

            if (IsSave == false)
                CMsgData.Items.Add(myItem);

            TreeView1.Nodes.Clear();

            for (int i = 0; i < CMsgData.Items.Count; i++)
            {
                TreeView1.Nodes.Add(new TreeNode(CMsgData.Items[i].Title));
            }
            TextBoxTitle.Text = "";
            txt0.Text = "";
            TextBoxUrl.Text = "";
            TextBoxEDIT.Text = "";
            Label2.Text = "";

            WeTextBoxOne.Text = CMsgData.Getdata();
            Image1.ImageUrl = "";

            Button24_Click(null ,null );
        }
示例#25
0
    /// <summary>
    /// 照片墙
    /// </summary>
    /// <param name="PathFile"></param>
    /// <param name="host">当前url地址 </param>
    /// <returns></returns>
    public static NewsMsgData GetMySetDataFT(string host, string PathFile, string ID_TIME)
    {
        string url2 = "http://" + host + "Web.aspx?id=" + ID_TIME;

        string[] myData = System.IO.Directory.GetFiles(PathFile);

        int st = 0;
        int end = 0;

        if (myData.Length > 9)
        {
            st = myData.Length;
            end = myData.Length - 9;

        }
        else
        {
            st = myData.Length;
            end = 0;

        }

        NewsMsgData C = new NewsMsgData();
        List<NewsItem> Items = new List<NewsItem>();

        NewsItem XoneX = new NewsItem
        {
            Description = "微信照片墙【发送照片到订阅号】", // "new1",
            Title = "微信照片墙【发送照片到订阅号】",// "EN了",
            PicUrl = "",//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
            Url = url2// myData[i + 3]// "http://baidu.com"
        };

        Items.Add(XoneX);
        for (int i = st - 1; i >= end; i--)
        {
            string MD = myData[i];

            System.IO.FileInfo xx = new System.IO.FileInfo(MD);
            String Name = ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(MD);
            string URLX = "http://" + host + "user_dir/sysuser/photo/" + xx.Name;

            NewsItem Xone = new NewsItem
            {
                Description = "照片:" + Name, // "new1",
                Title = "照片:" + Name,// "EN了",
                PicUrl = URLX,//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
                Url = "http://" + host + "ft.ashx?img=" + xx.Name + "&id=" + ID_TIME // myData[i + 3]// "http://baidu.com"
            };

            Items.Add(Xone);
            if (Items.Count >= 9)
                break;

        }

        NewsItem XoneX2 = new NewsItem
        {
            Description = "微信照片墙 ", // "new1",
            Title = "点击进入微网站",// "EN了",
            PicUrl = "",//myData[i + 2],// "http://c.hiphotos.baidu.com/ting/pic/item/b8014a90f603738d538032bfb21bb051f919ec61.jpg",
            Url = url2   // "http://" + host + "/Web.aspx?id=" + ID_TIME// myData[i + 3]// "http://baidu.com"
        };
        Items.Add(XoneX2);

        C.Items = Items;

        return C;
    }