/// <summary>
 /// 用户重新上传,增加日志,等待审核
 /// </summary>
 /// <param name="user"></param>
 /// <param name="ip"></param>
 public virtual void AddLog( User user, string ip )
 {
     UserErrorPic log = new UserErrorPic();
     log.UserId = user.Id;
     log.Ip = ip;
     log.insert();
 }
Example #2
0
        /// <summary>
        /// 用户重新上传,增加日志,等待审核
        /// </summary>
        /// <param name="user"></param>
        /// <param name="ip"></param>
        public void AddLog(User user, string ip)
        {
            UserErrorPic log = new UserErrorPic();

            log.UserId = user.Id;
            log.Ip     = ip;
            log.insert();
        }
Example #3
0
        /// <summary>
        /// 在管理员尚未审核之前,用户重新上传
        /// </summary>
        /// <param name="user"></param>
        /// <param name="ip"></param>
        public void UpdateLastUpload(User user, string ip)
        {
            UserErrorPic x = UserErrorPic.find("UserId=" + user.Id + " order by Id desc").first();

            x.Created = DateTime.Now;
            x.Ip      = ip;
            x.update();
        }
Example #4
0
        public String GetLastReviewMsg(User user)
        {
            UserErrorPic x = UserErrorPic.find("UserId=" + user.Id + " and ReviewMsg<>'' order by Id desc").first();

            if (x == null)
            {
                return(null);
            }
            return(x.ReviewMsg);
        }
        public virtual void AddLogAndPass( User user, string ip )
        {
            user.IsPicError = 0;
            user.update();

            UserErrorPic log = new UserErrorPic();
            log.UserId = user.Id;
            log.Ip = ip;
            log.IsPass = 1;
            log.ReviewMsg = "auto pass";
            log.insert();
        }
Example #6
0
        public void AddLogAndPass(User user, string ip)
        {
            user.IsPicError = 0;
            user.update();

            UserErrorPic log = new UserErrorPic();

            log.UserId    = user.Id;
            log.Ip        = ip;
            log.IsPass    = 1;
            log.ReviewMsg = "auto pass";
            log.insert();
        }
Example #7
0
        /// <summary>
        /// 管理员审核通过
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="reviewMsg"></param>
        public void ApproveOk(String ids, String reviewMsg)
        {
            List <User> userList = getUserList(ids);

            foreach (User user in userList)
            {
                user.IsPicError = 0;
                user.update();

                UserErrorPic x = UserErrorPic.find("UserId=" + user.Id + " order by Id desc").first();
                x.ReviewMsg = reviewMsg;
                x.IsPass    = 1;
                x.update();
            }
        }
Example #8
0
        public int GetStatus(User user)
        {
            UserErrorPic x = UserErrorPic.find("UserId=" + user.Id + " order by Id desc").first();

            if (x == null)
            {
                return(UserErrorPic.StatusFirstUpload);
            }
            if (strUtil.HasText(x.ReviewMsg))
            {
                if (x.IsPass == 0)
                {
                    return(UserErrorPic.StatusWaitingUpload);
                }
                else
                {
                    return(UserErrorPic.StatusOk);
                }
            }
            return(UserErrorPic.StatusWaitingApprove);
        }
        /// <summary>
        /// 管理员审核没有通过,将日志增加到数据库
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="reviewMsg"></param>
        /// <param name="isNextApprove">下次上传是否前置审核</param>
        public virtual void ApproveError( String ids, String reviewMsg, int isNextApprove, int isDelete )
        {
            List<User> userList = getUserList( ids );

            foreach (User user in userList) {

                user.IsPicError = 1;
                user.update();

                UserErrorPic log = new UserErrorPic();
                log.UserId = user.Id;
                log.Ip = "";
                log.ReviewMsg = reviewMsg;
                log.IsNextAutoPass = isNextApprove;
                log.insert();

                if (isDelete == 1 ) {
                    deleteUserPic( user );
                }

            }
        }
Example #10
0
        /// <summary>
        /// 管理员审核没有通过,将日志增加到数据库
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="reviewMsg"></param>
        /// <param name="isNextApprove">下次上传是否前置审核</param>
        public void ApproveError(String ids, String reviewMsg, int isNextApprove, int isDelete)
        {
            List <User> userList = getUserList(ids);

            foreach (User user in userList)
            {
                user.IsPicError = 1;
                user.update();

                UserErrorPic log = new UserErrorPic();
                log.UserId         = user.Id;
                log.Ip             = "";
                log.ReviewMsg      = reviewMsg;
                log.IsNextAutoPass = isNextApprove;
                log.insert();

                if (isDelete == 1)
                {
                    deleteUserPic(user);
                }
            }
        }
Example #11
0
        private void saveWaitingUpload()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                echoError(result);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            // 增加日志
            UserErrorPic lastLog = errorPicService.GetLastLog(user);

            if (lastLog.IsNextAutoPass == 1)
            {
                errorPicService.AddLogAndPass(user, ctx.Ip);
            }
            else
            {
                errorPicService.AddLog(user, ctx.Ip);
            }

            // 2) 保存图像、不会增加积分、不会发送邮件鼓励;给管理员发通知
            userService.UpdateAvatarWhenError(user, result.Info.ToString());

            String msg = "感谢上传!";

            echoRedirect(msg);
        }
Example #12
0
 public UserErrorPic GetLastLog(User user)
 {
     return(UserErrorPic.find("UserId=" + user.Id + " and ReviewMsg<>'' order by Id desc").first());
 }
Example #13
0
 public int CheckErrorCount(User user)
 {
     return(UserErrorPic.count("UserId=" + user.Id + " and ReviewMsg<>'' and IsPass=0"));
 }