/// <summary> /// 命令执行 /// </summary> /// <param name="context"></param> public override void Execute(DataContext context) { int userId = context.UserId; byte[] cmdData = context.CmdData; if (cmdData.Length == 4) { userId = BitConverter.ToInt32(cmdData.Reverse(), 0); } if (Compiled.Debug) { cmdData.Debug("=== User.QueryUserExt 上行数据==="); userId.Debug("=== User.QueryUserExt 上行数据==="); } UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(userId); if (null != userCache) { if (userId != context.UserId) { UserPagePvLog log = new UserPagePvLog { UserId = userId, VisitorId = context.UserId, CreateDate = DateTime.Now }; LogsBiz.CreateLogs <UserPagePvLog>(log); } context.Flush <UserExt>(userCache.ToUserExt()); } else { context.Flush(RespondCode.DataInvalid); } }
/// <summary> /// 创建注册日志 /// </summary> /// <param name="context">当前请求上下文应答实例</param> /// <param name="acount">账号信息</param> /// <param name="uAccount">用户账户信息</param> private static void CreateSignUpLog(DataContext context, Account acount, UserAccount uAccount) { UserLoginLog log = new UserLoginLog { UserId = uAccount.UserId, LogType = 1, NetworkType = (int)acount.NetworkType, AccountChannel = (int)acount.AccountChannel, AppChannel = context.ReqChannel, AppVersion = acount.Version, DeviceId = context.DeviceId, LoginAccount = uAccount.UserName, CreateDate = DateTime.Now }; LogsBiz.CreateLogs <UserLoginLog>(log); }
/// <summary> /// 记录命令请求日志 /// </summary> /// <param name="context">应用请求上下文应答实例</param> public virtual void CreateCmdLogs(T context) { //写入日志记录 if (CmdConfigs.CreateCmdQueryLogs() && context is ServiceContext) { ServiceContext sc = context as ServiceContext; CmdQueryLog log = new CmdQueryLog { UserId = sc.UserId, Command = sc.Command, AppChannel = sc.ReqChannel, Comment = sc.HasError ? "异常" : "正常", CreateDate = DateTime.Now }; LogsBiz.CreateLogs <CmdQueryLog>(log); } }