亚洲今日精彩视频_精品一级黄色_免费一级A片在现观看视频_8050福利视频 - 一级免费黄色片

7*24小時應急電話:15927160396
首頁 新聞資訊 技術文章
飛信WEB接口的一個返回網頁C#處理源碼

代碼說明:“返回網頁”是指飛信接口有事件發生時把事件信息發送到的網頁地址,并不是給用戶訪問,所以處理接受的數據應保存到數據庫,以便在別的網頁提取出來呈現給用戶;這個頁面地址應在發送登錄時由reurl指定提交給接口服務器的。

詳情參見http://io.feirobot.cn/的說明

以下WebDbClass控件是我的自定義數據庫控件,請換成實際的數據庫連接

        protected WebDbClass MyDb = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (MyDb == null) MyDb = new WebDbClass();
            try
            {
                string com = (string)Request["com"],fno=(string)Request["fno"],mno=(string)Request["mno"];
                if (fno == String.Empty && mno==String.Empty)
                {
                    Response.Write("號碼信息錯誤");
                    MyDb.DbClose();
                    Response.End();
                    return;
                }
                if (com == "rmsg" || com == "senderr")
                {
                    string MsgType = "新接收", rgno = "", tofno = (string)Request["rfno"], tomno = (string)Request["rmno"], msg = (string)Request["msg"], senderr = "";
                    msg = HttpUtility.UrlDecode(msg, Encoding.GetEncoding("utf-8"));
                    if (com == "senderr")
                    {
                        MsgType = "新錯誤";
                        senderr = (string)Request["senderr"];
                        msg = "發送\"" + msg + "\"" + senderr;
                    }

                    //插入數據庫
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','" + tofno + "','" + tomno + "','" + MsgType + "','" + msg.Replace("'", "''") + "','" + DateTime.Now.ToString() + "')");
                    Response.Write(msg); //輸出是為了方便調試,實際沒什么意義,正常后請全部注釋掉
                }
                else if (com == "sendok")
                {

                     //發送成功
                    ;
                }
                else if (com == "loginok")
                {
                    string fname = (string)Request["fname"];
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','','','登錄成功','" + fname.Replace("'", "''") + "','" + DateTime.Now.ToString() + "')");
                }
                else if (com == "loginerr")
                {
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','','','登錄失敗','','" + DateTime.Now.ToString() + "')");
                }
                else if (com == "fadd")
                {
                    string tofno = (string)Request["rfno"], tomno = (string)Request["rmno"], msg = (string)Request["msg"];
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','" + tofno + "','" + tomno + "','被添加為好友','" + msg.Replace("'", "''") + "','" + DateTime.Now.ToString() + "')");
                }
                else if (com == "list")
                {
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','','','列表完成','','" + DateTime.Now.ToString() + "')");
                }
                else if (com == "logout")
                {
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','','','被注銷','','" + DateTime.Now.ToString() + "')");
                }
                else if (com == "changed")
                {//好友狀態改變
                    string tofno = (string)Request["rfno"], tomno = (string)Request["rmno"], msg = (string)Request["msg"];
                    string[] farrm = msg.Trim().Split('|');
                    if (farrm.Length >= 7)
                        if (farrm[5] == "聊天") //好友打開聊天窗口
                        {
                            msg = msg.Replace("|聊天|", "|在線|");
                        }
                    MyDb.ExecuteSql("INSERT INTO FetionUpdata (fno,mno,tofno,tomno,uptype,Msg,addTime)" +
                        "values('" + fno + "','" + mno + "','" + tofno + "','" + tomno + "','好友狀態改變','" + msg.Replace("'", "''") + "','" + DateTime.Now.ToString() + "')");
                }
                else
                    Response.Write("命令參數錯誤");
            }
            catch(Exception er)
            {
                Response.Write("接收信息錯誤:"+er.Message);
            }
            MyDb.DbClose();
            Response.End();
        }

飛信WEB接口主要是方便網站開發都使用,如果是Win桌面程序,要想返回信息,只能使用飛信WebService接口

版權所有:武漢網福互聯科技有限公司    鄂ICP備09022096號
業務QQ:23444550 客服QQ:267052100 電郵:23444550@qq.com  

鄂公網安備 42010602000905號

手機站二維碼