コード例 #1
0
ファイル: UserBO_Realname.cs プロジェクト: huchao007/bbsmax
        /// <summary>
        /// 实名认证
        /// </summary>
        /// <param name="targetUserIds"></param>
        /// <param name="realnameChecked">是否</param>
        public void AdminSetRealnameChaecked(AuthUser operatorUser, int targetUserId, bool realnameChecked, string remark,bool sendNotify)
        {
            if (operatorUser == User.Guest)
            {
                ThrowError(new NotLoginError());
                return;
            }

            if (!CanRealnameCheck(operatorUser))
            {
                ThrowError(new NoPermissionRealnameCheckError());
                return;
            }



            UserDao.Instance.SetRealnameChecked(operatorUser.UserID, targetUserId, realnameChecked,remark );

            if (sendNotify)
            {
                string content = realnameChecked ? "恭喜您已通过实名认证" : "您的实名认证被拒绝," + (!string.IsNullOrEmpty(remark) ? "原因:" + StringUtil.CutString(remark, 100) : "");
                AdminManageNotify notify = new AdminManageNotify(targetUserId, content);
                notify.UserID = targetUserId;
                NotifyBO.Instance.AddNotify(operatorUser, notify);
            }

            RemoveUserCache(targetUserId);

            if (realnameChecked)
            {
                if (OnUserRealnameChecked != null)
                {
                    AuthenticUser authenticUserInfo = GetAuthenticUserInfo(operatorUser, targetUserId);

                    if (authenticUserInfo != null)
                    {
                        OnUserRealnameChecked(targetUserId, authenticUserInfo.Realname, authenticUserInfo.IDNumber);
                    }
                    else
                    {
                        AuthUser user = GetAuthUser(targetUserId);
                        if (user != null)
                        {
                            OnUserRealnameChecked(targetUserId, user.Realname, string.Empty);
                        }
                    }
                }
            }
            else
            {
                if (OnUserCancelRealnameCheck != null)
                    OnUserCancelRealnameCheck(targetUserId);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("send"))
            {
                int? uid = _Request.Get<int>("uid");
                int? tid = _Request.Get<int>("tid");
                Enums.DenouncingType? type = _Request.Get<Enums.DenouncingType>("type");

                if(uid == null || tid == null || type == null)
                {
                    ShowError("缺少必要的页面参数");
                    return;
                }

                string name = string.Empty;
                string url = string.Empty;

                switch(type.Value)
                {
                    case MaxLabs.bbsMax.Enums.DenouncingType.Blog:
                        name = "一篇日志";
                        url = BbsRouter.GetUrl("app/blog/view", "id=" + tid);
                        break;

                    case MaxLabs.bbsMax.Enums.DenouncingType.Photo:
                        name = "一张照片";
                        url = BbsRouter.GetUrl("app/album/photo", "id=" + tid);
                        break;

                    case MaxLabs.bbsMax.Enums.DenouncingType.Reply:
                        name= "一条回复";

                        break;

                    case MaxLabs.bbsMax.Enums.DenouncingType.Share:
                        name = "一条分享";
                        url = BbsRouter.GetUrl("app/share/index");
                        break;

                    case MaxLabs.bbsMax.Enums.DenouncingType.Topic:
                        name = "一个主题";
                        break;
                }

                using (ErrorScope es = new ErrorScope())
                {
                    AdminManageNotify notify = new AdminManageNotify(MyUserID, string.Concat("您有", name, "被举报,请您删除此数据,如有疑问请联系管理员。<a href=\"", url ,"\">前往查看</a>"));
                    notify.UserID = uid.Value;
                    if (NotifyBO.Instance.AddNotify( My , notify))
                    {
                        Return(true);
                    }
                    else
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
                            ShowError(error);
                        });
                    }
                }
            }
        }