/// <summary> /// 检查用户签约状态 /// </summary> /// <param name="code">微信回调code</param> /// <returns></returns> public async Task <IActionResult> CheckStatus(string code) { //code = HttpContext.Request.QueryString["Code"] //判断code是否存在 // 实际场景用 var openId = await _weixinHelper.GetOpenId(code); // 开发环境用 //var openId = "xxxxx"; var patient = await _lovePlatformApi.GetPatientByOpenId(openId); if (patient == null) { return(RedirectToAction("VerifyId", "Sign", new { openId = openId })); } else { return(RedirectToAction("ApplySuccess", "Sign", new { message = "您已经签约并绑定微信,无需再签约" })); } }
//public async Task<IActionResult> Edit(string openId) //{ // ViewData["Title"] = "个人信息"; // var user = await _lovePlatformApi.GetUserByOpenId(openId); // if (user != null) // { // return View(user); // } // return RedirectToAction("Register", "User", new { openId = openId }); //} public async Task <IActionResult> Edit(string code) { ViewData["Title"] = "个人信息"; var openId = await _weixinHelper.GetOpenId(code); var user = await _lovePlatformApi.GetUserByOpenId(openId); if (user != null) { return(View(user)); } return(RedirectToAction("Register", "User", new { openId = openId })); }