/// <summary> /// 创建在线游客 /// </summary> /// <param name="sid">sessionId</param> /// <param name="updateTime">更新时间</param> /// <param name="ip">ip</param> /// <param name="regionId">区域id</param> /// <returns></returns> public static int CreateOnlineGuest(string sid, DateTime updateTime, string ip, int regionId) { OnlineUserInfo onlineUserInfo = new OnlineUserInfo(); onlineUserInfo.Uid = -1; onlineUserInfo.Sid = sid; onlineUserInfo.NickName = "游客"; onlineUserInfo.IP = ip; onlineUserInfo.RegionId = regionId; onlineUserInfo.UpdateTime = updateTime; return BrnMall.Data.OnlineUsers.CreateOnlineUser(onlineUserInfo); }
/// <summary> /// 创建在线用户 /// </summary> public int CreateOnlineUser(OnlineUserInfo onlineUserInfo) { DbParameter[] parms = { GenerateInParam("@uid",SqlDbType.Int,4,onlineUserInfo.Uid), GenerateInParam("@sid",SqlDbType.Char,16,onlineUserInfo.Sid), GenerateInParam("@nickname",SqlDbType.NChar,20,onlineUserInfo.NickName), GenerateInParam("@ip",SqlDbType.Char,15,onlineUserInfo.IP), GenerateInParam("@regionid",SqlDbType.SmallInt,2,onlineUserInfo.RegionId), GenerateInParam("@updatetime",SqlDbType.DateTime,8,onlineUserInfo.UpdateTime) }; return TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}createonlineuser", RDBSHelper.RDBSTablePre), parms)); }
/// <summary> /// 从IDataReader创建OnlineUserInfo /// </summary> public static OnlineUserInfo BuildOnlineUserFromReader(IDataReader reader) { OnlineUserInfo onlineUserInfo = new OnlineUserInfo(); onlineUserInfo.OlId = TypeHelper.ObjectToInt(reader["olid"]); onlineUserInfo.Uid = TypeHelper.ObjectToInt(reader["uid"]); onlineUserInfo.Sid = reader["sid"].ToString(); onlineUserInfo.NickName = reader["nickname"].ToString(); onlineUserInfo.IP = reader["ip"].ToString(); onlineUserInfo.RegionId = TypeHelper.ObjectToInt(reader["regionid"]); onlineUserInfo.UpdateTime = TypeHelper.ObjectToDateTime(reader["updatetime"]); return onlineUserInfo; }
/// <summary> /// 创建在线会员 /// </summary> /// <param name="uid">会员id</param> /// <param name="sid">sessionId</param> /// <param name="nickName">会员昵称</param> /// <param name="updateTime">更新时间</param> /// <param name="ip">ip</param> /// <param name="regionId">区域id</param> /// <returns></returns> public static int CreateOnlineMember(int uid, string sid, string nickName, DateTime updateTime, string ip, int regionId) { OnlineUserInfo onlineUserInfo = new OnlineUserInfo(); onlineUserInfo.Uid = uid; onlineUserInfo.Sid = sid; onlineUserInfo.NickName = nickName; onlineUserInfo.IP = ip; onlineUserInfo.RegionId = regionId; onlineUserInfo.UpdateTime = updateTime; int olid = BrnMall.Data.OnlineUsers.CreateOnlineUser(onlineUserInfo); //更新用户最后访问信息 Users.UpdateUserLastVisit(uid, updateTime, ip, regionId); return olid; }
/// <summary> /// 创建在线用户 /// </summary> public static int CreateOnlineUser(OnlineUserInfo onlineUserInfo) { return BrnMall.Core.BMAData.RDBS.CreateOnlineUser(onlineUserInfo); }