/// <summary> /// 显示权限信息 /// </summary> /// <returns></returns> public IActionResult Index() { var result = WebApiHelper.GetApiResult("Get", "Permissions", "GetJurisdictions"); return(View(JsonConvert.DeserializeObject <List <Jurisdictions> >(result))); }
public int JurisAdd(Jurisdictions jurisdictions) { var result = WebApiHelper.GetApiResult("Post", "Permissions", "JurisAdd", jurisdictions); return(int.Parse(result)); }
/// <summary> /// 分页方法 /// </summary> /// <returns></returns> public string Paging(PageParams pageParams) { string json = WebApiHelper.GetApiResult("post", "BackStage", "Paging", pageParams); return(json); }
/// <summary> /// 找回密码 /// </summary> public HttpResponseMessage MemberForgetPwd(RequestModel request) { var result = WebHelper.GetResult <string>(request); if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功)) { string receiver = "", mobile = JsonHelper.GetValue(request.Obj, "Mobile"), email = JsonHelper.GetValue(request.Obj, "Email"), code = JsonHelper.GetValue(request.Obj, "Code"), pwd = JsonHelper.GetValue(request.Obj, "Pwd"), sendType = JsonHelper.GetValue(request.Obj, "SendType"); Guid taskId = GuidHelper.Get(JsonHelper.GetValue(request.Obj, "TaskId")); #region 入信息判断 if (VerifyHelper.IsEmpty(sendType) || (sendType != KeyModel.Config.Template.KeyForgetPwdMobile && sendType != KeyModel.Config.Template.KeyForgetPwdEmail)) { throw new MessageException(EnumMessageCode.信息错误); } if ((VerifyHelper.IsEmpty(mobile) && VerifyHelper.IsEmpty(email)) || VerifyHelper.IsEmpty(taskId)) { throw new MessageException(EnumMessageCode.信息错误); } if (sendType == KeyModel.Config.Template.KeyForgetPwdMobile && VerifyHelper.IsEmpty(mobile)) { throw new MessageException(EnumMessageCode.请输入手机号码); } if (sendType == KeyModel.Config.Template.KeyForgetPwdEmail && VerifyHelper.IsEmpty(email)) { throw new MessageException(EnumMessageCode.请输入邮箱地址); } if (VerifyHelper.IsEmpty(pwd)) { throw new MessageException(EnumMessageCode.请输入密码); } if (VerifyHelper.IsEmpty(code)) { throw new MessageException(EnumMessageCode.请输入验证码); } #endregion receiver = sendType == KeyModel.Config.Template.KeyForgetPwdMobile ? mobile : email; //验证码效验 bool isSuccess = notificationService.ConfirmVerifyCode(taskId, receiver, code, request.CurrentContext.VisitId); if (!isSuccess) { throw new MessageException(EnumMessageCode.验证码错误); } //找回密码修改 var entity = memberService.MemberForgetPwd(email, mobile, pwd, BrowserHelper.GetClientIP()); if (VerifyHelper.IsEmpty(entity)) { throw new MessageException(EnumMessageCode.找回密码失败); } //返回 if (!VerifyHelper.IsEmpty(entity) && !VerifyHelper.IsEmpty(entity.Id)) { notificationService.ExpireVerifyCode(taskId); WebHelper.SetMember(entity); result.Code = EnumHelper.GetValue(EnumResultCode.跳转地址); result.Redirect = UrlsHelper.GetRefUrl(defaultUrl: WebHelper.GetMemberUrl()); } } return(WebApiHelper.ToHttpResponseMessage(result)); }
/// <summary> /// 会员注册 /// </summary> public HttpResponseMessage MemberRegist(RequestModel request) { var result = WebHelper.GetResult <string>(request); if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功)) { string receiver = "", mobile = JsonHelper.GetValue(request.Obj, "Mobile"), email = JsonHelper.GetValue(request.Obj, "Email"), code = JsonHelper.GetValue(request.Obj, "Code"), pwd = JsonHelper.GetValue(request.Obj, "Pwd"), nameTag = JsonHelper.GetValue(request.Obj, "NameTag"), sendType = JsonHelper.GetValue(request.Obj, "SendType"); Guid taskId = GuidHelper.Get(JsonHelper.GetValue(request.Obj, "TaskId")); #region 入信息判断 if (VerifyHelper.IsEmpty(sendType) || (sendType != KeyModel.Config.Template.KeyRegistMobile && sendType != KeyModel.Config.Template.KeyRegistEmail)) { throw new MessageException(EnumMessageCode.信息错误); } if ((VerifyHelper.IsEmpty(mobile) && VerifyHelper.IsEmpty(email)) || VerifyHelper.IsEmpty(taskId)) { throw new MessageException(EnumMessageCode.信息错误); } if (sendType == KeyModel.Config.Template.KeyRegistMobile && VerifyHelper.IsEmpty(mobile)) { throw new MessageException(EnumMessageCode.请输入手机号码); } if (sendType == KeyModel.Config.Template.KeyRegistEmail && VerifyHelper.IsEmpty(email)) { throw new MessageException(EnumMessageCode.请输入邮箱地址); } if (VerifyHelper.IsEmpty(pwd)) { throw new MessageException(EnumMessageCode.请输入密码); } if (VerifyHelper.IsEmpty(code)) { throw new MessageException(EnumMessageCode.请输入验证码); } #endregion receiver = sendType == KeyModel.Config.Template.KeyRegistMobile ? mobile : email; //验证码效验 bool isSuccess = notificationService.ConfirmVerifyCode(taskId, receiver, code, request.CurrentContext.VisitId); if (!isSuccess) { throw new MessageException(EnumMessageCode.验证码错误); } //注册 var entity = memberService.Regist(receiver, email, mobile, pwd, nameTag, BrowserHelper.GetClientIP()); if (VerifyHelper.IsEmpty(entity)) { throw new MessageException(EnumMessageCode.注册失败); } //首次注册,送100元, 添加充值记录信息 rechargeRecordService.Insert(new RechargeRecordEntity { AccountId = entity.Id, MoneyValue = 100, Descript = "注册赠送", CreateId = entity.Id, CreateDt = DateTime.Now, LastId = entity.Id, LastDt = DateTime.Now }); //返回 if (!VerifyHelper.IsEmpty(entity) && !VerifyHelper.IsEmpty(entity.Id)) { notificationService.ExpireVerifyCode(taskId); WebHelper.SetMember(entity); result.Code = EnumHelper.GetValue(EnumResultCode.跳转地址); result.Redirect = UrlsHelper.GetRefUrl(defaultUrl: WebHelper.GetMemberUrl()); } } return(WebApiHelper.ToHttpResponseMessage(result)); }
/// <summary> /// 获取考生今天是不是考试过了? /// </summary> /// <returns></returns> public string GetTypeByUid(string id) { var result = WebApiHelper.GetApiResult("get", "Explain", "GetTypeByUid?id=" + id); return(result); }
public NavigationComponent(IConfiguration configuration) { webApiHelper = new WebApiHelper(); baseUri = configuration.GetSection("Data").GetSection("ApiBaseUri").Value; IEnumerable <LinkedNavigation> linkedNavigationHome = new List <LinkedNavigation> { // categories, products, cart, checkout, contact new LinkedNavigation { Page = "PcParts", IsActive = true, Text = "Products" }, new LinkedNavigation { Page = "Cart", IsActive = true, Text = "Cart" }, new LinkedNavigation { Page = "CheckOut", IsLoggedIn = true, IsActive = false, Text = "CheckOut" }, new LinkedNavigation { Page = "Contact", Text = "Contact", IsActive = true } }; // categories: enum of the diffrent categories List <LinkedNavigation> linkedNavigationsCategory = new List <LinkedNavigation>(); // api call to get categories var categories = WebApiHelper.GetApiResult <string[]>(baseUri + "pcparts/Categories"); foreach (var item in categories) { linkedNavigationsCategory.Add(new LinkedNavigation { Page = item, IsActive = true, IsLoggedIn = false, Text = item }); } // publicLinks PublicLinks = new List <NavigationVm> { new NavigationVm { Page = "/index", Text = "Home", LinkedNavigations = linkedNavigationHome, IsLinkedNav = true }, new NavigationVm { Page = "/PcParts", Text = "Products", IsActive = true, IsLinkedNav = true, LinkedNavigations = linkedNavigationsCategory.OrderBy(l => l.Page) }, new NavigationVm { Page = "/PcBuilds", Text = "PcBuilds", IsActive = true, IsLinkedNav = false }, new NavigationVm { Page = "/Contact", Text = "Contact", IsActive = true, IsLinkedNav = false }, new NavigationVm { Page = "/orders", Text = "My Orders", IsLoggedIn = true, IsActive = true, IsLinkedNav = false }, }; // adminLinks AdminLinks = new List <NavigationVm> { new NavigationVm { Area = "admin", Page = "/manage/parts/index", Text = "Manage Parts" }, new NavigationVm { Area = "admin", Page = "/manage/Makers/index", Text = "Manage Makers" } }; // userLinks UserLinks = new List <NavigationVm> { new NavigationVm { Area = "Identity", Page = "/Forum/index", Text = "Forum" } }; }