Esempio n. 1
0
        internal static bool UpdateDoLog(int restype, int seqid, int dotype, int userid, out string errmsg)
        {
            string tablename  = SearchBLL.GetTableNameByResType(restype);
            string columnname = null;

            switch (dotype) //操作类型[1:点击;2:下载:3:在线阅读...]
            {
            case 1:
                columnname = "hits";
                break;

            case 2:
                columnname = "downloads";
                break;

            case 3:
                columnname = "readnum";
                break;
            }
            DAL.BaseDAL.UpdateDoLog(tablename, columnname, seqid, out errmsg);
            base_userlogs log = new base_userlogs()
            {
                logtype     = dotype,
                restype     = restype.ToString(),
                rescode     = seqid.ToString(),
                logcontent  = string.Format("{0} {1} 资源库[{2}]资源编号[{3}]", userid > 0 ? "用户" + userid.ToString() : "游客", columnname, restype, seqid),
                creator     = userid,
                createdtime = DateTime.Now
            };

            DAL.BaseDAL.WriteUserLog(log, out errmsg);
            return(true);
        }
        public object UserReg(base_user_extend userinfo)
        {
            string errmsg = null;

            if (userinfo.yzmcode == null || userinfo.yzmcode.Length != 6)
            {
                return(new { Rcode = -1, Rmsg = "注册失败:请填写验证码" });
            }
            base_identifycode identifycode = BLL.BaseBLL.GetIdentifyCodeInfo(userinfo.phone, userinfo.email, userinfo.yzmcode, out errmsg);

            if (identifycode == null)
            {
                return new { Rcode = 0, Rmsg = "验证码错误" }
            }
            ;
            else if (DateTime.Now > identifycode.endtime)
            {
                return new { Rcode = 0, Rmsg = "验证码超时,请重新获取验证码" }
            }
            ;

            userinfo.passwd     = StrFormatClass.MD5ToDepth(userinfo.passwd);
            userinfo.usertype   = 1;
            userinfo.userlevel  = 1;
            userinfo.sourcetype = 1;
            userinfo.customerid = 0;
            userinfo.status     = 1;
            userinfo.grade      = 0;
            userinfo.period     = 0;
            userinfo.classname  = ".";
            userinfo.school     = ".";
            int userid = userLoginManager.UserReg(userinfo, out errmsg);

            if (userid > 0)
            {
                base_userlogs log = new base_userlogs()
                {
                    logtype     = 21, // 21 注册; 22 登录;
                    restype     = "0",
                    rescode     = userid.ToString(),
                    logcontent  = string.Format("注册用户{0}", userinfo.username),
                    creator     = 0,
                    createdtime = DateTime.Now
                };

                BLL.BaseBLL.WriteUserLog(log, out errmsg);//记录注册日志

                return(new { Rcode = 1, Rdata = userid });
            }
            else if (!string.IsNullOrEmpty(errmsg))
            {
                return(new { Rcode = -1, Rmsg = "注册失败:" + errmsg });
            }
            else
            {
                return(new { Rcode = 0, Rmsg = "注册失败" });
            }
        }
        /// <summary>
        /// 用户行为日志管理 详情查询
        /// </summary>
        public object Get(int id)
        {
            base_userlogs info = userlogsBLL.GetInfo(id, out errmsg)
            ;                        if (!string.IsNullOrEmpty(errmsg))

            {
                return(new { Rcode = -1, Rmsg = "获取数据失败" });
            }
            return(new { Rcode = 1, Rdata = info });
        }
        /// <summary>
        /// 用户行为日志管理 添加数据
        /// </summary>
        public object Post([FromBody] base_userlogs info)
        {
            bool success = userlogsBLL.Add(info, out errmsg);

            if (!success || !string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "添加失败" }
            }
            ;
            return(new { Rcode = 1, Rmsg = "添加成功" });
        }
        /// <summary>
        /// 用户行为日志管理 更新数据
        /// </summary>
        public object Put(int id, [FromBody] base_userlogs info)
        {
            info.logid = id;
            bool success = userlogsBLL.Update(info, out errmsg);

            if (!success || !string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "更新失败" }
            }
            ;
            return(new { Rcode = 1, Rmsg = "更新成功" });
        }
Esempio n. 6
0
        /// <summary>
        /// 用户行为日志管理 添加数据
        /// </summary>
        /// <param name="base_userlogs">要添加的用户行为日志管理对象</param>
        /// <param name="errmsg">错误信息</param>
        /// <returns>返回对象</returns>
        public static bool Add(base_userlogs info, out string errmsg)
        {
            List <DataParameter> pars = new List <DataParameter>();

            pars.Add(new DataParameter("logtype", info.logtype));
            pars.Add(new DataParameter("restype", info.restype));
            pars.Add(new DataParameter("rescode", info.rescode));
            pars.Add(new DataParameter("logcontent", info.logcontent));
            pars.Add(new DataParameter("creator", info.creator));
            pars.Add(new DataParameter("createdtime", info.createdtime));
            string sqlstr = "insert into base_userlogs (logtype,restype,rescode,logcontent,creator,createdtime) values (@logtype,@restype,@rescode,@logcontent,@creator,@createdtime) ";

            return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0);
        }
Esempio n. 7
0
        /// <summary>
        /// 用户行为日志管理 更新数据
        /// </summary>
        /// <param name="base_userlogs">要更新的用户行为日志管理对象</param>
        /// <param name="errmsg">错误信息</param>
        /// <returns>返回对象</returns>
        public static bool Update(base_userlogs info, out string errmsg)
        {
            List <DataParameter> pars = new List <DataParameter>();

            pars.Add(new DataParameter("logtype", info.logtype));
            pars.Add(new DataParameter("restype", info.restype));
            pars.Add(new DataParameter("rescode", info.rescode));
            pars.Add(new DataParameter("logcontent", info.logcontent));
            pars.Add(new DataParameter("creator", info.creator));
            pars.Add(new DataParameter("createdtime", info.createdtime));
            string sqlstr = "update base_userlogs set logtype=@logtype,restype=@restype,rescode=@rescode,logcontent=@logcontent,creator=@creator,createdtime=@createdtime where logid=@logid ";

            pars.Add(new DataParameter("logid", info.logid));
            return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0);
        }
Esempio n. 8
0
        /// <summary>
        /// 用户日志记录
        /// </summary>
        /// <param name="userlog"></param>
        /// <param name="errmsg"></param>
        /// <returns></returns>
        internal static bool WriteUserLog(base_userlogs userlog, out string errmsg)
        {
            string sqlstr = "insert into base_userlogs(logtype,restype,rescode,logcontent,creator,createdtime) values (@logtype,@restype,@rescode,@logcontent,@creator,@createdtime)";

            DataParameter[] pars = new DataParameter[]
            {
                new DataParameter("logtype", userlog.logtype),
                new DataParameter("restype", userlog.restype),
                new DataParameter("rescode", userlog.rescode),
                new DataParameter("logcontent", userlog.logcontent),
                new DataParameter("creator", userlog.creator),
                new DataParameter("createdtime", userlog.createdtime),
            };
            return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0);
        }
        public object UserLogin(UserLoginViewModel user)
        {
            if (string.IsNullOrEmpty(user.UserName) || string.IsNullOrEmpty(user.Password))
            {
                return(new { Rcode = 0, Rmsg = "请输入完整的用户名密码" });
            }
            string errmsg = null;

            user.Password = StrFormatClass.MD5ToDepth(user.Password);
            UserInfoViewModel userInfo = userLoginManager.UserLogin(user.UserName, user.Password, null, out errmsg);

            if (!string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "登录错误" + errmsg }
            }
            ;
            else if (userInfo == null || userInfo.UserID < 1)
            {
                return new { Rcode = 0, Rmsg = "用户名或密码错误" }
            }
            ;
            else
            {
                base_userlogs log = new base_userlogs()
                {
                    logtype     = 22,
                    restype     = "0",
                    rescode     = userInfo.UserID.ToString(),
                    logcontent  = string.Format("登录用户{0}", user.UserName),
                    creator     = 0,
                    createdtime = DateTime.Now
                };

                BLL.BaseBLL.WriteUserLog(log, out errmsg);//记录登录日志

                return(new { Rcode = 1, Rdata = userInfo });
            }
        }
        public object UserLoginByOther(base_users userinfo)
        {
            userinfo.passwd        = Models.GlobalParameters.DefaultUserPasswd;
            userinfo.usertype      = 1;
            userinfo.userlevel     = 1;
            userinfo.sourcetype    = 4;
            userinfo.sourceremarks = userinfo.usertypename;
            userinfo.customerid    = 0;
            userinfo.status        = 1;
            userinfo.createdtime   = DateTime.Now;
            UserInfoViewModel userVM = userLoginManager.GetUserInfoByOther(userinfo, out errmsg);

            if (!string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "获取数据错误" }
            }
            ;
            else if (userVM == null || userVM.UserID < 1)
            {
                return new { Rcode = -1, Rmsg = "绑定用户出错" }
            }
            ;
            else
            {
                base_userlogs log = new base_userlogs()
                {
                    logtype     = 22,
                    restype     = "0",
                    rescode     = userVM.UserID.ToString(),
                    logcontent  = string.Format("登录用户{0}", userVM.UserName),
                    creator     = 0,
                    createdtime = DateTime.Now
                };

                return(new { Rcode = 1, Rmsg = "登录成功", Rdata = userVM });
            }
        }
Esempio n. 11
0
 internal static bool WriteUserLog(base_userlogs userlog, out string errmsg)
 {
     return(DAL.BaseDAL.WriteUserLog(userlog, out errmsg));
 }
Esempio n. 12
0
 /// <summary>
 /// 用户行为日志管理 更新数据
 /// </summary>
 /// <param name="base_userlogs">要更新的用户行为日志管理对象</param>
 /// <param name="errmsg">错误信息</param>
 /// <returns>返回对象</returns>
 public static bool Update(base_userlogs info, out string errmsg)
 {
     return(userlogsDAL.Update(info, out errmsg));
 }
Esempio n. 13
0
 /// <summary>
 /// 用户行为日志管理 添加数据
 /// </summary>
 /// <param name="base_userlogs">要添加的用户行为日志管理对象</param>
 /// <param name="errmsg">错误信息</param>
 /// <returns>返回对象</returns>
 public static bool Add(base_userlogs info, out string errmsg)
 {
     return(userlogsDAL.Add(info, out errmsg));
 }
Esempio n. 14
0
        /// <summary>
        /// 用户行为日志管理 详情查询
        /// </summary>
        public static base_userlogs GetInfo(int logid, out string errmsg)
        {
            base_userlogs info = userlogsDAL.GetInfo(logid, out errmsg);

            return(info);
        }