//[AllowAnonymous] //[ValidateAntiForgeryToken] public ActionResult UserSelectDealerToPay(string dealerId) { //判断是否登录 if (!this.User.Identity.IsAuthenticated) { return(Redirect("/Account/Login?url=" + Request.RawUrl)); } //获取当前登录人Id var userId = this.User.Identity.GetUserId(); if (string.IsNullOrEmpty(dealerId)) { return(Json(new { code = "401", msg = "经销商不能为空" })); } var store = new FrontUserStore <FrontIdentityUser>(); var user = store.FindByIdAsync(userId).Result; var returnIntegralType = (int)_AppContext.CarServiceUserApp.GetReIntegralTypeByIdentity(user.IdentityNumber); user.IsPay = 2; if (returnIntegralType > -1) { user.Amount = returnIntegralType > 1 ? 50 : 100; } store.UpdateAsync(user); if (store.AddMembershipDealerRecord(userId, dealerId) && store.CreateMembershipRequest(userId, user.IdentityNumber, dealerId, string.Empty, "blms")) { return(Json(new { code = "200", msg = "申请成功" })); } else { return(Json(new { code = "401", msg = "申请失败" })); } }
/// <summary> /// 天猫付款 /// </summary> /// <param name="paynumber"></param> /// <param name="dealerId"></param> /// <returns></returns> //[AllowAnonymous] //[ValidateAntiForgeryToken] public ActionResult PayByTmallRequest(string paynumber, string dealerId) { //判断是否登录 if (!this.User.Identity.IsAuthenticated) { return(Redirect("/Account/Login?url=" + Request.RawUrl)); } //获取当前登录人Id var userId = this.User.Identity.GetUserId(); var store = new FrontUserStore <FrontIdentityUser>(); var user = store.FindByIdAsync(userId).Result; user.ApprovalStatus = (int)MembershipApprovalStatus.Activing; if (string.IsNullOrEmpty(paynumber)) { return(Json(new { code = 400, msg = "选择天猫支付必须输入支付码" })); } if (!string.IsNullOrEmpty(paynumber)) { user.PayNumber = paynumber; } user.IsPay = 2; var returnIntegralType = (int)_AppContext.CarServiceUserApp.GetReIntegralTypeByIdentity(user.IdentityNumber); if (returnIntegralType != -1) { user.Amount = returnIntegralType > 1 ? 50 : 100; } store.UpdateAsync(user); store.AddMembershipDealerRecord(userId, dealerId); var result = store.CreateMembershipRequest(userId, user.IdentityNumber, dealerId, string.Empty, "blms_wap"); if (result) { return(Json(new { code = "200", msg = "申请成功,如长时间未通过,请咨询申请经销商" })); } else { return(Json(new { code = "400", msg = "申请失败,请重新输入" })); } }
/// <summary> /// 绑定车辆 /// </summary> /// <param name="identityNumber"></param> /// <param name="PaperWork"></param> /// <returns></returns> public ActionResult ToCheckCarownerSave(string identityNumber, string PaperWork, string source = "") { //判断是否登录 if (!this.User.Identity.IsAuthenticated) { return(Redirect("/Account/Login?url=" + Request.RawUrl)); } //获取当前登录人Id var userId = this.User.Identity.GetUserId(); string appkey = string.Empty; var userStore = new FrontUserStore <FrontIdentityUser>(); var userObj = userStore.FindByIdentityNumber(identityNumber).Result;//membership里查询该身份证号 var isPIDExist = userObj != null; //如果证件号存在 if (userObj != null) { //如果证件号已存在并绑定到车主,不能绑定 if (userObj.SystemMType > 1) { return(Json(new { code = 400, msg = "很抱歉,您的身份未绑定成功,请联系bluemembers在线客服" })); } } else { userObj = userStore.FindByIdAsync(userId).Result; //membership里查询该用户ID } //获取用户车辆信息 var carQuery = _AppContext.CarServiceUserApp.CarsByPID(identityNumber); if (carQuery != null && carQuery.Count() > 0) //有车 { var memberLevel = _AppContext.DealerMembershipApp.GetLevel(identityNumber); //获取用户级别 userObj.MLevel = Convert.ToInt32(memberLevel); userObj.PaperWork = PaperWork; userObj.SystemMType = (int)MembershipType.WhitCar; userObj.IdentityNumber = identityNumber; userObj.AuthenticationTime = DateTime.Now; userObj.AuthenticationSource = "blms_wap"; //认证来源 //switch (source) //{ // case "activity_trip": // userObj.Remark = "source:activity_trip";//机场活动 // break; // case "activity_verna": // userObj.Remark = "source:activity_verna";//悦纳上市活动 // break; // default: // userObj.Remark = "source:none";//无 // break; //} //提取生日信息、性别、年龄 int Gender = -1; int Age = -1; if (userObj.IdentityNumber != null && userObj.PaperWork == "1") { if (userObj.IdentityNumber.Length == 15) { var str = userObj.IdentityNumber.Substring(6, 6); userObj.Birthday = "19" + str.Remove(2) + "-" + str.Substring(2, 2) + "-" + str.Substring(4, 2); Gender = (Convert.ToInt32(userObj.IdentityNumber.Substring(14)) % 2 == 0 ? 2 : 1); Age = DateTime.Now.Year - Convert.ToInt32("19" + userObj.IdentityNumber.Substring(6, 2)); } if (userObj.IdentityNumber.Length == 18) { var str = userObj.IdentityNumber.Substring(6, 8); userObj.Birthday = str.Remove(4) + "-" + str.Substring(4, 2) + "-" + str.Substring(6, 2); Gender = (Convert.ToInt32(userObj.IdentityNumber.Substring(16, 1)) % 2 == 0 ? 2 : 1); Age = DateTime.Now.Year - Convert.ToInt32(userObj.IdentityNumber.Substring(6, 4)); } DateTime birthDay = DateTime.Now; var isBirthday = DateTime.TryParse(userObj.Birthday, out birthDay); if (!isBirthday) { return(Json(new { code = 400, msg = "身份证填写错误" })); } userObj.Gender = Gender.ToString(); userObj.Age = Age; } //一切正常,绑定用户 userObj.MLevelBeginDate = userObj.AuthenticationTime; if (userObj.MLevel == 11 || userObj.MLevel == 12) { userObj.MLevelInvalidDate = userObj.AuthenticationTime.AddYears(1); } //添加用户和证件类型的对应关系 userStore.AddPaperworkToMembership_Schedule(userObj); //修改用户信息 userStore.UpdateAsync(userObj); //判断交费级别 //var integralType = (int)_AppContext.CarServiceUserApp.GetReIntegralTypeByIdentity(identityNumber); //if (integralType != -1) //{ // //authResult.Content = integralType; // return Json(new { code = 200, msg = "绑定成功" }); //} return(Json(new { code = 200, msg = "绑定成功" })); } else//无车 { return(Json(new { code = 400, msg = "很抱歉,您的身份未绑定成功,请联系bluemembers在线客服" })); } }