Exemple #1
0
        /// <summary>
        /// 发送消息
        /// </summary>
        public static void SendMessage()
        {
            int    intID         = 0;
            int    intSID        = 0;
            string strSMSContent = "";

            string strSQL = "SELECT TOP 1 ID,SID,SMSContent FROM Fx_OutBox WHERE [Status] = 0";

            Console.WriteLine(strSQL);//111111111111111111111111111111111
            try
            {
                Console.WriteLine("==================== [发送消息] 开始 ================== \r\n");
                DataRow dr = SqlHelper.ExecuteDataRow(SqlLibrary.GetFx_Main(), CommandType.Text, strSQL);
                intID         = Convert.ToInt32(dr["ID"]);
                intSID        = Convert.ToInt32(dr["SID"]);
                strSMSContent = Convert.ToString(dr["SMSContent"]);
                Console.WriteLine(intID + " " + intSID + " " + strSMSContent); //111111111111111111111111
                string[] arrSMSContent = strSMSContent.Split(new char[] { ' ' });
                Console.WriteLine(arrSMSContent.Length);                       //1111111111111111111111111
                if (arrSMSContent.Length > 1)
                {
                    if (intID > 0)
                    {
                        Console.WriteLine("用户状态:" + UserStatus(intSID));//111111111111111111
                        if (UserStatus(intSID) == 0)
                        {
                            Console.WriteLine("SysConsole: " + intSID + "  " + arrSMSContent[0].ToLower().ToString() + "  " + arrSMSContent[1].ToLower().ToString());
                            SysConsole(intSID, arrSMSContent[0].ToLower().ToString(), arrSMSContent[1].ToLower().ToString());
                            Console.WriteLine("sysconsole runing");//11111111111111111
                            intID = SqlLibrary.Fx_UpdateMessage(intID);
                            Console.WriteLine("[信息已发出]");
                            Console.WriteLine("发送对像:" + intSID + " 命令:" + arrSMSContent[0].ToString() + " 参数:" + arrSMSContent[1].ToString() + "\r\n");
                        }
                        else
                        {
                            SqlLibrary.Fx_UpdateMessage(intID);
                            Console.WriteLine("[信息已被取消]");
                        }
                    }
                    else
                    {
                        Console.WriteLine("[信息标记出错]");
                    }
                }
                else
                {
                    SqlLibrary.Fx_UpdateMessage(intID);
                    Console.WriteLine("[信息已被取消]");
                }
                Console.WriteLine("==================== [发送消息] 结束 ================== \r\n");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                //Console.WriteLine("[没有要发送的消息]\r\n");
                Console.WriteLine("==================== [发送消息] 结束 ================== \r\n");
            }
        }