コード例 #1
0
ファイル: UserHandler.ashx.cs プロジェクト: uvbs/mmp
        private string SetVip(HttpContext context)
        {
            string        ids     = context.Request["ids"];
            List <string> userIds = ids.Split(',').ToList();

            for (int i = 0; i < userIds.Count; i++)
            {
                if (string.IsNullOrWhiteSpace(userIds[i]))
                {
                    continue;
                }
                if (!bllUser.IsVip(userIds[i]))
                {
                    bllUserExpand.AddUserExpand(BLLJIMP.Enums.UserExpandType.UserIsVip, userIds[i], "1");
                }
                bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, userIds[i], "您被设置为VIP!");
            }
            resp.Status = 1;
            resp.Msg    = "设置完成";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
コード例 #2
0
        /// <summary>
        /// 课程基本设置
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditOpenConfig(HttpContext context)
        {
            string Creater = context.Request["Creater"];

            if (string.IsNullOrWhiteSpace(Creater))
            {
                resp.Status = (int)APIErrCode.PrimaryKeyIncomplete;
                resp.Msg    = "创建人不能为空";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bllUserExpand.ExistUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID))
            {
                bllUserExpand.UpdateUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }
            else
            {
                bllUserExpand.AddUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }
            resp.Status = 1;
            resp.Msg    = "修改完成";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
コード例 #3
0
ファイル: OpenHandler.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 课程基本设置
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditOpenConfig(HttpContext context)
        {
            string Creater = context.Request["Creater"];

            if (string.IsNullOrWhiteSpace(Creater))
            {
                resp.Status = (int)APIErrCode.PrimaryKeyIncomplete;
                resp.Msg    = "创建人不能为空";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bllUserExpand.ExistUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID))
            {
                bllUserExpand.UpdateUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }
            else
            {
                bllUserExpand.AddUserExpand(UserExpandType.UserOpenCreate, this.currentUserInfo.UserID, Creater);
            }

            string OpenClassNotice = context.Request["OpenClassNotice"];

            if (!string.IsNullOrWhiteSpace(OpenClassNotice))
            {
                BLLKeyValueData bllKeyValueData = new BLLKeyValueData();

                KeyVauleDataInfo value = new KeyVauleDataInfo();
                value.DataType     = "OpenClassNotice";
                value.DataKey      = "0";
                value.DataValue    = OpenClassNotice;
                value.Creater      = this.currentUserInfo.UserID;
                value.WebsiteOwner = bll.WebsiteOwner;
                value.CreateTime   = DateTime.Now;
                bllKeyValueData.PutDataValue(value);
            }

            resp.Status = 1;
            resp.Msg    = "修改完成";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
コード例 #4
0
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string UserRegister(HttpContext context)
        {
            string pId             = context.Request["pId"];
            string name            = context.Request["name"];
            string email           = context.Request["email"];
            string pwd             = context.Request["pwd"];
            string verCode         = context.Request["vercode"];
            object serverCheckCode = context.Session["CheckCode"];
            string IsSHowInfo      = context.Request["IsSHowInfo"];

            if (!CheckRegister(name, email, pwd, verCode, serverCheckCode))
            {
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            UserInfo regUser = new UserInfo();

            regUser.UserID       = string.Format("WebPC{0}{1}", ZentCloud.Common.StringHelper.GetDateTimeNum(), ZentCloud.Common.Rand.Str(5));//WXUser+时间字符串+随机5位数字
            regUser.TrueName     = name;
            regUser.Email        = email;
            regUser.Password     = pwd;
            regUser.WebsiteOwner = this.webSiteOwner;
            regUser.UserType     = 2;
            regUser.Regtime      = DateTime.Now;
            string ip = ZentCloud.Common.MySpider.GetClientIP();

            regUser.RegIP           = ip;
            regUser.LastLoginIP     = ip;
            regUser.LastLoginDate   = DateTime.Now;
            regUser.LoginTotalCount = 1;

            if (bllUser.Add(regUser))
            {
                context.Session[SessionKey.LoginStatu] = 1;
                context.Session[SessionKey.UserID]     = regUser.UserID;
                bllUser.AddUserScoreDetail(regUser.UserID, EnumStringHelper.ToString(ScoreDefineType.Register), this.webSiteOwner, null, null);

                if (!string.IsNullOrWhiteSpace(pId))
                {
                    string   pUserId   = MySpider.Base64Change.DecodeBase64(pId);
                    UserInfo shareUser = bllUser.GetUserInfo(pUserId);
                    if (shareUser != null)
                    {
                        bllUser.AddUserScoreDetail(regUser.UserID, EnumStringHelper.ToString(ScoreDefineType.RegisterFromShare), this.webSiteOwner, null, null);
                        bllUser.AddUserScoreDetail(shareUser.UserID, EnumStringHelper.ToString(ScoreDefineType.ShareRegister), this.webSiteOwner, null, null);
                    }
                    bllUserExpand.AddUserExpand(BLLJIMP.Enums.UserExpandType.IsSHowInfo, regUser.UserID, IsSHowInfo);
                }

                //绑定微信
                BindWXUser(context, regUser.UserID);
                return(Common.JSONHelper.ObjectToJson(new
                {
                    isSuccess = true,
                    user = new
                    {
                        id = bllUser.GetUserAutoID(regUser.UserID),
                        userid = regUser.UserID,
                        userName = this.bllUser.GetUserDispalyName(regUser),
                        avatar = this.bllUser.GetUserDispalyAvatar(regUser)
                    }
                }));
            }
            else
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.RegisterFailure;
                resp.errmsg  = "注册失败";
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }