/// <summary> /// 申请提现 /// </summary> /// <param name="post"></param> /// <returns></returns> public JsonResult <Result <bool> > PostWithdraw(DistributionApplyWithdraw post) { CheckUserLogin(); var sitesettings = SiteSettingApplication.SiteSettings; post.MemberId = CurrentUser.Id; if (post.Type == DistributionWithdrawType.WeChat) //获取用户微信账户 { var mo = MemberApplication.GetMemberOpenIdInfoByuserId(CurrentUser.Id, Entities.MemberOpenIdInfo.AppIdTypeEnum.Payment, "Himall.Plugin.OAuth.WeiXin"); if (mo == null) { return(Json(ErrorResult <bool>("无法获取微信账号,请先在微信端绑定账号!"))); } var openid = mo.OpenId; post.WithdrawAccount = openid; if (!(string.IsNullOrWhiteSpace(sitesettings.WeixinAppId) || string.IsNullOrWhiteSpace(sitesettings.WeixinAppSecret))) { string token = AccessTokenContainer.TryGetToken(sitesettings.WeixinAppId, sitesettings.WeixinAppSecret); var user = CommonApi.GetUserInfo(token, openid); post.WithdrawName = user?.nickname ?? string.Empty; } } DistributionApplication.ApplyWithdraw(post); return(JsonResult(true)); }
public ActionResult PostWithdraw(DistributionApplyWithdraw post) { post.MemberId = CurrentUser.Id; if (post.Type == DistributionWithdrawType.WeChat) //获取用户微信账户 { var openid = WebHelper.GetCookie(CookieKeysCollection.Mall_USER_OpenID); post.WithdrawAccount = openid = SecureHelper.AESDecrypt(openid, "Mobile"); if (!(string.IsNullOrWhiteSpace(SiteSettings.WeixinAppId) || string.IsNullOrWhiteSpace(SiteSettings.WeixinAppSecret))) { string token = AccessTokenContainer.TryGetAccessToken(SiteSettings.WeixinAppId, SiteSettings.WeixinAppSecret); var user = CommonApi.GetUserInfo(token, openid); post.WithdrawName = user?.nickname ?? string.Empty; } } DistributionApplication.ApplyWithdraw(post); return(Json(new { success = true }, true)); }