using System;
using System.Collections.Generic;
using System.Text;
using JuSNS.Factory;
using System.Data;
using System.Data.SqlClient;
using JuSNS.Profile;
using JuSNS.Model;
using JuSNS.Config;

namespace JuSNS.SQLServer
{
    public class MyInfo : DbBase, IMyInfo
    {
        /// <summary>
        /// 网络设置
        /// </summary>
        /// <param name="provice">省</param>
        /// <param name="city">市</param>
        /// <returns></returns>
        public int UpdateNetSet(int provice, int city,int userid)
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            SqlTransaction trans = Conn.BeginTransaction();
            try
            {
                string sql = "update NT_User set Province=" + provice + ",City=" + city + " where UserID=" + userid;
                int n = DbHelper.ExecuteNonQuery(CommandType.Text, sql, null);
                trans.Commit();
                return n;
            }
            catch (SqlException e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

        /// <summary>
        /// 帐号设置（修改姓名）
        /// </summary>
        /// <param name="oldName">旧名字</param>
        /// <param name="userName">新名字</param>
        /// <param name="userid">会员编号</param>
        /// <returns></returns>
        public int UpdateUserName(string oldName, string userName, int userid)
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            SqlTransaction trans = Conn.BeginTransaction();
            try
            {
                string sql = "update NT_User set UserName='" + userName + "'  where UserID=" + userid;
                int n = DbHelper.ExecuteNonQuery(CommandType.Text, sql, null);
                JUser ju = new JUser();
                if (ju.CheckPrivacyInfo(trans, userid, "ActUpdateData"))
                {
                    UserDyn(trans, 0, 0, "infoName", userid, 0, userid, oldName + " 把姓名改成了 " + userName, userid.ToString());
                }
                trans.Commit();
                return n;
            }
            catch (SqlException e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

        /// <summary>
        /// 检查邮箱是否已经被使用了
        /// </summary>
        /// <param name="Email">被检查的邮箱</param>
        /// <returns></returns>
        public bool CheckEmail(string Email)
        {
            SqlParameter param = new SqlParameter("@Email", Email);
            string sql = "select Id from NT_SpareEmail where  Email=@Email";
            string strsql="select UserId from NT_User where  Email=@Email";
            DataTable dt = DbHelper.ExecuteTable(CommandType.Text, sql, param);
            DataTable obj = null;
            if(dt!=null)
            {
                if (dt.Rows.Count > 0)
                {
                    return true;//邮箱已被用
                }
                else
                {
                    obj = DbHelper.ExecuteTable(CommandType.Text, strsql, param);
                    if (obj == null)
                    {
                        return false;//邮箱没被用
                    }
                    else
                    {
                        if (obj.Rows.Count > 0)
                        {
                            return true;//邮箱已被用
                        }
                        else
                        {
                            return false;//邮箱没被用
                        }
                    }
                }
            }
            else 
            {
                obj = DbHelper.ExecuteTable(CommandType.Text, strsql, param);
                if (obj == null)
                {
                    return false;//邮箱没被用
                }
                else
                {
                    if (obj.Rows.Count > 0)
                    {
                        return true;//邮箱已被用
                    }
                    else
                    {
                        return false;//邮箱没被用
                    }
                }
            }
        }

        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name="Email">要删除的邮箱</param>
        /// <returns></returns>
        public int DelInfo(string Email)
        {
            SqlParameter param = new SqlParameter("@Email", Email);
            string sql = "delete from NT_SpareEmail where Email=@Email";
            return DbHelper.ExecuteNonQuery(CommandType.Text, sql, param);
        }

        /// <summary>
        /// 邮箱设置
        /// </summary>
        /// <param name="newEmail">新默认邮箱</param>
        /// <param name="oldEmail">以前的默认邮箱</param>
        /// <param name="userid">会员编号</param>
        /// <param name="Ip">IP</param>
        /// <param name="flag">true：添加新邮箱，false：更新邮箱</param>
        /// <returns></returns>
        public int UpdateEmail(string newEmail,string oldEmail,int userid,string Ip,bool flag)
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            SqlTransaction trans = Conn.BeginTransaction();
            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@newEmail", SqlDbType.NVarChar, 100);
                param[0].Value = newEmail;
                param[1] = new SqlParameter("@oldEmail", SqlDbType.NVarChar, 100);
                param[1].Value = oldEmail;
                param[2] = new SqlParameter("@userid", SqlDbType.Int, 4);
                param[2].Value = userid;
                param[3] = new SqlParameter("@Ip", SqlDbType.Char, 15);
                param[3].Value = Ip;
                string sql = string.Empty;
                int n = 0;
                if (JuSNS.Common.Public.GetXMLValue("RegVer") == "1")
                {
                    sql = "update NT_User set Email=@newEmail,State=0,VerifyCode='" + JuSNS.Common.Rand.Str(11) + "' where UserID=@userid";
                }
                else
                {
                    sql = "update NT_User set Email=@newEmail,State=2,VerifyCode='" + JuSNS.Common.Rand.Str(11) + "' where UserID=@userid";
                }
                n = DbHelper.ExecuteNonQuery(trans, CommandType.Text, sql, param);
                if (n > 0)
                {
                    if (flag)
                    {
                        sql = "insert into NT_SpareEmail(UserID,Email,PostTime,PostIP) values(@userid,@oldEmail,getdate(),@Ip)";
                    }
                    else
                    {
                        sql = "update NT_SpareEmail set Email=@oldEmail,PostTime=getdate(),PostIP=@Ip where Email=@newEmail and UserID=@userid";
                    }
                    n = DbHelper.ExecuteNonQuery(trans, CommandType.Text, sql, param);
                    //JUser ju = new JUser();
                    //if (ju.CheckPrivacyInfo(trans, userid, "ActUpdateData"))
                    //{
                    //    UserDyn(trans, 0, 0, "infolink", userid, userid, userid, "修改了联系资料", userid.ToString());
                    //}
                }
                trans.Commit();
                return n;
            }
            catch (SqlException e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

        /// <summary>
        /// 根据ID返回Datatable
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="flag"></param>
        /// <returns></returns>
        public DataTable getEmail(int Id, int flag)
        {
            SqlParameter param = new SqlParameter("@Id", Id);
            string sql = "";
            if (flag == 0)//读取会员的邮箱
            {
                sql = "select Email,flag=0 from NT_User where UserID=@Id union select Email,flag=1 from NT_SpareEmail where UserID=@Id";
            }
            else if (flag == 1)//读取会员邮箱通知设置
            {
                sql = "select ItemID,Announce,PostTime from NT_EmailNotify where UserID=@Id";
            }
            else if (flag == 2)//读取某一时间段内未登陆疯啦的会员
            {
                sql = "select UserID,UserName,Email from dbo.NT_User where LastLoginTime<=(getdate()-@Id)";
            }
            else if (flag == 3)//读取会员邮箱通知设置
            {
                sql = "select ItemID,Announce,PostTime from NT_EmailNotify where UserID=@Id and Announce=1";
            }
            return DbHelper.ExecuteTable(CommandType.Text, sql, param);
        }

        /// <summary>
        ///  检查用户密码是否正确
        /// </summary>
        /// <param name="userId">会员编号</param>
        /// <returns></returns>
        public bool getPwd(int userId,string Pwd)
        {
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@userId", SqlDbType.Int, 4);
            param[0].Value = userId;
            param[1] = new SqlParameter("@Pwd", SqlDbType.NChar,32);
            param[1].Value = Pwd;

            string sql = "select Password from NT_User where UserID=@userId and Password=@Pwd";
            string pd=(string)DbHelper.ExecuteScalar(CommandType.Text, sql, param);
            if (pd == "" || pd == null)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="OldPwd">旧密码</param>
        /// <param name="NewPwd">新密码</param>
        /// <param name="userId">会员编号</param>
        public int ChanagePwd(string OldPwd,string NewPwd,int userId)
        {
             SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            SqlTransaction trans = Conn.BeginTransaction();
           
            int i = 0;
            try
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@NewPwd", SqlDbType.NChar, 32);
                param[0].Value = NewPwd;
                param[1] = new SqlParameter("@userId", SqlDbType.Int,4);
                param[1].Value = userId;

                if (getPwd(userId, OldPwd))
                {
                    string sql = "update NT_User set Password=@NewPwd where UserID=@userId";
                    i = DbHelper.ExecuteNonQuery(trans,CommandType.Text, sql, param);
                }
                else
                {
                    i = 2;
                }
                trans.Commit();
                return i;
            }
            catch (SqlException e)
            {
                throw e;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

        /// <summary>
        /// 保存MSN/Gtalk
        /// </summary>
        /// <returns></returns>
        public int UpdateMSNGtalk(string value,int userid,int flag)
        {
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@userid", SqlDbType.Int, 4);
            param[0].Value = userid;
            int n = 0;
            string sql = "";

            if (flag == 0)//更新MSN
            {
                sql = "update NT_UserInfo set MSN='" + value + "' where UserID=@userid";
            }
            else if(flag==1)//更新Gtalk
            {
                sql = "update NT_UserInfo set GTalk='" + value + "' where UserID=@userid";
            }
            else if (flag == 2)//更新手机号码
            {
                sql = "update NT_UserInfo set Mobile='" + value + "' where UserID=@userid";
            }
            return DbHelper.ExecuteNonQuery(CommandType.Text, sql, param);
        }

        /// <summary>
        /// 判断MSN,Gtalk,Mobile 是否存在
        /// </summary>
        /// <param name="temp"></param>
        /// <param name="flag">标识0：MSN 1：Gtalk 2:手机号码</param>
        /// <returns></returns>
        public int getMSNGtalk(string temp,int flag)
        {
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@temp", SqlDbType.NVarChar, 50);
            param[0].Value = temp;

            string sql = "select count(*) from NT_UserInfo where MSN=@temp";
            if (flag == 1)
            {
                sql = "select count(*) from NT_UserInfo where GTalk=@temp";
            }
            else if (flag == 2)
            {
                sql = "select count(*) from NT_UserInfo where Mobile=@temp";
            }
            return Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, sql, param));
        }

        /// <summary>
        /// 邮件通知设置
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public int UpdateEmailSet(string type,string value,int userID,string IP,int unflag)
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            SqlTransaction trans = Conn.BeginTransaction();
            try
            {
                string sql = ""; 
                string[] Item=type.Split('|');
                string[] Acc = value.Split('|');
                int n = 0;
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@IP", SqlDbType.Char,15);
                param[0].Value = IP;
                param[1] = new SqlParameter("@userID", SqlDbType.Int, 4);
                param[1].Value = userID;
                for (int j = 0; j < Acc.Length - 1; j++)
                {
                    string gSql = "select count(ID) from NT_EmailNotify where UserID=@userID and ItemID=" + int.Parse(Item[j].ToString())+"";
                    int flag = Convert.ToInt32(DbHelper.ExecuteScalar(trans, CommandType.Text, gSql, param));
                    if (flag != 0)
                    {
                        sql = "update NT_EmailNotify set Announce=" + int.Parse(Acc[j].ToString()) + ",PostTime=getdate(),PostIP=@IP where UserID=@userID and ItemID=" + int.Parse(Item[j].ToString());
                    }
                    else
                    {
                        sql = "insert NT_EmailNotify (UserID,ItemID,Announce,PostTime,PostIP) values(@userID," + int.Parse(Item[j].ToString()) + "," + int.Parse(Acc[j].ToString()) + ",getdate(),@IP)";
                    }
                    n = DbHelper.ExecuteNonQuery(trans,CommandType.Text, sql, param);
                }
                trans.Commit();
                return n;
            }
            catch (SqlException e)
            {
                throw e;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

       /// <summary>
        /// 读取发送邮件通知内容
       /// </summary>
       /// <param name="userid"></param>
       /// <returns></returns>
        public bool sendEmailStr(int userid,string email,string username,int day)
        {
            SqlConnection Conn = new SqlConnection(DBConfig.CnString);
            Conn.Open();
            try
            {
                SqlParameter param = new SqlParameter("@userid", userid);
                string returnStr = "";
                string sql = "";
                DataTable dt = getEmail(userid,3);

                if (dt != null)
                {
                    if(dt.Rows.Count>0)
                    {
                        int type = 0;
                        for (int i = 0; i < dt.Rows.Count;i++)
                        {
                            type = int.Parse(dt.Rows[i]["ItemID"].ToString());
                            if (type == (int)EnumEmailSet.NewLetter)
                            {
                                // 新私信
                                sql = "select DISTINCT b.UserName from NT_Mail as a inner join NT_User as b on a.Sender=b.UserID left Join Nt_Photo as d On b.Portrait=d.PhotoID And d.IsLock=0 where (a.ID IN (SELECT letterid FROM NT_Mailinbox WHERE userid=@userid) and a.TopicID=0) and a.PostTime<(getdate()-" + day + ")";
                                returnStr = getEmailUser(Conn, sql, "个好友向你打招呼 来自：", param);
                            }
                            if (type == (int)EnumEmailSet.FriendRequest)
                            {
                                //好友请求
                                sql = "select DISTINCT b.UserName from NT_Request a inner join NT_User as b on b.UserID=a.Receiver where a.RequestType=1 and a.Receiver=@userid and a.isLock=0 and a.isDel=0 and a.ReplyResult=0 and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个好友请求，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.NewWord)
                            {
                                //新留言
                                sql = "select DISTINCT b.UserName from NT_gbook a inner join NT_User b on a.Sender=b.UserID where a.Receiver=@userid and a.IsLock=0 and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个新留言，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.Greet)
                            {
                                //打招呼
                                sql = "select DISTINCT b.UserName from NT_Greet a inner join NT_User b on a.UserID=b.UserID where a.IsRead=0 and a.FriendID=@userid and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个好友向你打招呼，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.FriendDescription)
                            {
                                //好友描述请求
                                //sql = "select a.id,b.UserName from NT_Request a inner join NT_User as b on b.UserID=a.Receiver where a.RequestType=1 and a.Receiver=@userid and a.isLock=0 and a.isDel=0 and a.ReplyResult=0";
                                //returnStr += getEmailUser(sql, "个好友描述请求，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.AcceptRequest)
                            {
                                //接受你的邀请加入了
                                sql = "select DISTINCT b.UserName from  NT_FriendInvite a inner join NT_User b on a.UserID=b.UserID  where a.UserID=@userid and Reply=0 and  Method=1 and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个人接受你的邀请加入了疯啦，分别是：", param);
                            }
                            if (type == (int)EnumEmailSet.PhotoBeQ)
                            {
                                //在照片中被圈
                                sql = "select DISTINCT b.UserName from NT_PhotoLasso a inner join NT_User b on a.Userid=b.UserID where FriendID=@userid and IsLock=0 and a.PostTime<(getdate()-" + day + ") and a.userid<>@userid";
                                returnStr += getEmailUser(Conn, sql, "个好友在照片中圈了你，分别是：", param);
                            }
                            //if (type == (int)EnumEmailSet.PhotoRequest)
                            //{
                            ////收到照片圈人请求
                            //sql = "select a.id,b.UserName from NT_Request a inner join NT_User as b on b.UserID=a.Receiver where a.RequestType=1 and a.Receiver=@userid and a.isLock=0 and a.isDel=0 and a.ReplyResult=0";
                            //returnStr += getEmailUser(sql, "个好友描述请求，来自：", param);
                            //}
                            if (type == (int)EnumEmailSet.PhotoRequest)
                            {
                                //照片新评论
                                sql = "select DISTINCT b.UserName from  NT_PhotoComment a inner join NT_User b on a.UserID=b.UserID where PhotoID in(select PhotoID from dbo.NT_Photo c where c.UploadUser=@userid) and a.PostTime<(getdate()-" + day + ") and a.userid<>@userid";
                                returnStr += getEmailUser(Conn, sql, "条照片新评论，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.PhotoResponse)
                            {
                                //你的照片评论有新回复
                                sql = "select DISTINCT b.UserName from  NT_PhotoComment a inner join NT_User b on a.UserID=b.UserID Where [CommentID] in (select a.ID from  NT_PhotoComment a where PhotoID in(select PhotoID from dbo.NT_Photo c  where c.UploadUser=@userid)) and a.PostTime<(getdate()-" + day + ") and a.userid<>@userid";
                                returnStr += getEmailUser(Conn, sql, "条新照片评论回复，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.GroupInvite)
                            {
                                //群组邀请
                                sql = "select DISTINCT b.UserName  from NT_GroupInvite a inner join NT_User b on a.UserID=b.UserID where a.InviteFlag=1 and a.JoinUserID=@userid and Response=0 and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个群组邀请,来自：", param);
                            }
                            if (type == (int)EnumEmailSet.ChanageGroupManager)
                            {
                                //成为群组管理员
                                sql = "select DISTINCT UserName=b.GroupName from NT_GroupMember a inner join dbo.NT_UserGroup b on a.UserID=b.UserId where a.Grade=1 and a.UserID=@userid and a.JoinTime<=getdate()-" + day;
                                returnStr += getEmailUser(Conn, sql, "你成为了群组管理员", param);
                            }
                            //if (type == (int)EnumEmailSet.GroupJoin)
                            //{
                            //    //群组成员申请
                            //    sql = "select a.id,b.UserName from NT_Request a inner join NT_User as b on b.UserID=a.Receiver where a.RequestType=1 and a.Receiver=@userid and a.isLock=0 and a.isDel=0 and a.ReplyResult=0";
                            //    returnStr += getEmailUser(sql, "个群组成员申请，分别是：", param);
                            //}
                            if (type == (int)EnumEmailSet.Response)
                            {
                                //主题新回复
                                sql = "select DISTINCT b.UserName from NT_GroupDiscuss as a inner join NT_User as b on a.UserID=b.UserID where BelongTopic in (select GroupID from dbo.NT_GroupMember where UserID=@userid) and a.posttime<(getdate()-" + day + ") and a.UserID<>@userid";
                                returnStr += getEmailUser(Conn, sql, "个新主题回复，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.LogComments)
                            {
                                //日志新评论
                                sql = "select DISTINCT b.UserName from NT_BLogComment a inner join NT_User b on a.UserID=b.UserID where a.IsLock=0 and a.BlogID in (select ID from dbo.NT_Blog where UserID=@userid) and a.userid<>@userid and a.PostTime<(getdate()-" + day + ")";
                                returnStr += getEmailUser(Conn, sql, "个日志新评论，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.LogResponse)
                            {
                                //你的日志评论有新回复
                                sql = "select DISTINCT b.UserName from NT_BLogComment a inner join NT_User b on a.UserID=b.UserID where a.IsLock=0 and a.BlogID in (select ID from dbo.NT_Blog where UserID=@userid) and a.userid<>@userid and a.PostTime<(getdate()) and commentID in(select BlogID from dbo.NT_BlogComment)";
                                returnStr += getEmailUser(Conn, sql, "个新日志评论回复，来自：", param);
                            }
                            if (type == (int)EnumEmailSet.ShareComments)
                            {
                                //分享新评论
                                sql = "Select DISTINCT b.UserName From [NT_ShareComment] a inner join NT_User b on a.userID=b.UserID Where a.shareID in (select ID from  dbo.NT_Share where UserID=@userid) and postTime<(getdate()-" + day + ") and a.userid<>@userid";
                                returnStr += getEmailUser(Conn, sql, "个分享新评论，来自：", param);
                            }
                            //if (type == (int)EnumEmailSet.ShareResponse)
                            //{
                            //    //你的分享评论有新回复
                            //    sql = "select a.id,b.UserName from NT_Request a inner join NT_User as b on b.UserID=a.Receiver where a.RequestType=1 and a.Receiver=@userid and a.isLock=0 and a.isDel=0 and a.ReplyResult=0";
                            //    returnStr += getEmailUser(sql, "个新分享评论回复，来自：", param);
                            //}
                        }
                    }
                }
                if(returnStr!="")
                {
                    #region 发送邮件
                    JuSNS.Common.EMail em = JuSNS.Common.EMail.CreateInstance();
                    string body = emailsetConfig.letter;
                    body = body.Replace("{SiteName}", UiConfig.SiteName);
                    body = body.Replace("{UserName}", username);
                    body = body.Replace("{Domain}", UiConfig.Domain);
                    body = body.Replace("{Date}", DateTime.Now.ToString("yyyy年MM月dd日"));
                    body = body.Replace("{Url}", UiConfig.RootUrl);
                    body = body.Replace("{Content}", returnStr);
                    em.Body = body;
                    em.Subject = "亲爱的" + username + "，你在" + UiConfig.SiteName + "有新消息";
                    em.To = email;
                    em.From = UiConfig.SiteName + "<" + EmailConfig.from + ">";
                    em.Send();
                    #endregion
                } 
                 return true;
            }
            catch
            {
                return false;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                    Conn.Close();
            }
        }

        public string getEmailUser(SqlConnection Conn,string strSql,string content,SqlParameter param)
        {
            string str = "";
            try
            {
                DataTable dt = DbHelper.ExecuteTable(Conn, CommandType.Text, strSql, param);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (i != dt.Rows.Count - 1)
                            {
                                str += dt.Rows[i]["UserName"].ToString() + "、";
                            }
                            else
                            {
                                str += dt.Rows[i]["UserName"].ToString();
                            }
                        }
                        str = dt.Rows.Count + content + str+"<br/>";
                    }
                }
                return str;
            }
            catch (SqlException e)
            {
                throw e;
            }
        }


        public int DelUserSelf(int UserID)
        {
            SqlParameter param = new SqlParameter("@UserID", UserID);
            return DbHelper.ExecuteNonQuery(CommandType.StoredProcedure, "JuSNS_DelUserSelf", param);
        }
    }
}

