45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
|
|
@using Hncore.Pass.BaseInfo.Response
|
|
@using Hncore.Infrastructure.Serializer;
|
|
@using Hncore.Pass.BaseInfo.Service
|
|
@using Hncore.Infrastructure.Common
|
|
@using Microsoft.Extensions.Configuration
|
|
@using Hncore.Infrastructure.Extension
|
|
@inject IConfiguration m_Configuration
|
|
@inject UserService m_UserService
|
|
@{
|
|
var act = this.Context.Request.Get("act");
|
|
var WxAppId = m_Configuration["WxApps:AppID"];
|
|
var BaseUrl = m_Configuration["Service_BaseUrl"];
|
|
var requestUrl =this.Context.Request.GetUrl().UrlEncode();
|
|
UserLoginModel user = null;
|
|
Hncore.Pass.BaseInfo.Models.User userEntity = new Hncore.Pass.BaseInfo.Models.User();
|
|
if (this.Context.Request.Cookies.TryGetValue("userInfo", out string userCookie))
|
|
{
|
|
user = userCookie.FromJsonTo<UserLoginModel>();
|
|
userEntity = await m_UserService.GetById(user.Id);
|
|
}
|
|
}
|
|
|
|
@if (user == null)
|
|
{
|
|
<script>
|
|
|
|
function isWeiXin() {
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
if (ua.indexOf('micromessenger')!=-1) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (!isWeiXin() || "login" =="@act") {
|
|
window.location.href = "/User/WebLogin?redirect=@requestUrl";
|
|
} else {
|
|
window.location.href = "@(BaseUrl)User/MP_GetUserInfo?appid=@WxAppId&callbakUrl=@requestUrl";
|
|
}
|
|
</script>
|
|
}
|
|
|