Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
d38534dc
Commit
d38534dc
authored
Apr 22, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
2ea3979c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
6 deletions
+93
-6
UserReidsCache.cs
Mall.CacheManager/User/UserReidsCache.cs
+57
-1
RequestParm.cs
Mall.Common/API/RequestParm.cs
+1
-0
UserInfo.cs
Mall.Common/API/UserInfo.cs
+6
-1
BaseController.cs
Mall.WebApi/Controllers/BaseController.cs
+17
-3
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+11
-0
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+1
-1
No files found.
Mall.CacheManager/User/UserReidsCache.cs
View file @
d38534dc
using
Mall.CacheManager.DataStatistic
;
using
Mall.CacheKey
;
using
Mall.CacheManager.DataStatistic
;
using
Mall.Common
;
using
Mall.Common.Plugin
;
using
Mall.Common.Plugin.Redis
;
using
Mall.Model.Extend.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -71,5 +74,58 @@ namespace Mall.CacheManager.User
{
}
}
/// <summary>
/// 商户信息仓储层对象
/// </summary>
private
static
Mall
.
Repository
.
User
.
RB_TenantRepository
tenantRepository
=
new
Repository
.
User
.
RB_TenantRepository
();
/// <summary>
/// 获取用户登录信息
/// </summary>
/// <param name="TenantId">商户Id</param>
/// <returns></returns>
public
static
UserInfo
GetUserLoginInfo
(
object
TenantId
)
{
string
cacheKey
=
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
TenantId
.
ToString
();
UserInfo
userInfo
=
null
;
try
{
userInfo
=
redis
.
StringGet
<
UserInfo
>(
cacheKey
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"GetUserLoginInfo"
);
}
if
(
userInfo
==
null
)
{
Int32
.
TryParse
(
TenantId
.
ToString
(),
out
int
NewTenantId
);
if
(
NewTenantId
>
0
)
{
string
token
=
""
;
var
extModel
=
tenantRepository
.
GetEntity
<
RB_Tenant_Extend
>(
NewTenantId
);
if
(
extModel
!=
null
)
{
UserInfo
obj
=
new
UserInfo
{
TenantId
=
extModel
.
TenantId
,
Account
=
extModel
.
Account
,
Name
=
extModel
.
Name
,
MobilePhone
=
extModel
.
MobilePhone
,
WeChatNum
=
extModel
.
WeChatNum
,
IsEffective
=
extModel
.
IsEffective
,
AccountValidate
=
extModel
.
AccountValidate
,
CreateMiniPrograme
=
extModel
.
CreateMiniPrograme
,
MallName
=
extModel
.
MallName
,
AccountStatus
=
extModel
.
AccountStatus
,
Token
=
token
,
SecretKey
=
""
,
};
UserInfoSet
(
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
TenantId
,
obj
,
Config
.
JwtExpirTime
);
}
}
}
return
userInfo
;
}
}
}
Mall.Common/API/RequestParm.cs
View file @
d38534dc
...
...
@@ -46,6 +46,7 @@ namespace Mall.Common.API
/// 语言 0中文 1繁体 2日文(未处理)
/// </summary>
public
int
languageId
{
get
;
set
;
}
/// <summary>
/// 语种类型
/// </summary>
...
...
Mall.Common/API/UserInfo.cs
View file @
d38534dc
...
...
@@ -106,6 +106,11 @@ namespace Mall.Common
/// <summary>
/// token
/// </summary>
public
string
Token
{
get
;
set
;
}
public
string
Token
{
get
;
set
;
}
/// <summary>
/// SecretKey
/// </summary>
public
string
SecretKey
{
get
;
set
;
}
}
}
Mall.WebApi/Controllers/BaseController.cs
View file @
d38534dc
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.CacheManager.User
;
using
Mall.Common
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
...
...
@@ -10,6 +11,7 @@ using Microsoft.AspNetCore.Cors;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
System.Web
;
namespace
Mall.WebApi.Controllers
{
...
...
@@ -32,10 +34,9 @@ namespace Mall.WebApi.Controllers
#
region
读取
post
参数
var
requestMsg
=
Request
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
];
var
requestParm
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
var
UObj
=
Request
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
];
if
(
UObj
!=
null
)
if
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
!=
null
)
{
JObject
parms
=
JObject
.
Parse
(
UObj
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
.
ToString
());
requestParm
.
uid
=
parms
.
GetStringValue
(
"uid"
);
}
#
endregion
...
...
@@ -43,5 +44,18 @@ namespace Mall.WebApi.Controllers
return
requestParm
;
}
}
/// <summary>
/// 商户缓存信息
/// </summary>
public
UserInfo
UserInfo
{
get
{
var
parm
=
this
.
RequestParm
;
UserInfo
userInfo
=
UserReidsCache
.
GetUserLoginInfo
(
parm
.
uid
);
return
userInfo
;
}
}
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/TenantController.cs
View file @
d38534dc
...
...
@@ -80,10 +80,21 @@ namespace Mall.WebApi.Controllers.User
MallName
=
model
.
MallName
,
AccountStatus
=
model
.
AccountStatus
,
Token
=
token
,
SecretKey
=
""
,
};
UserReidsCache
.
UserInfoSet
(
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
model
.
TenantId
,
obj
,
Config
.
JwtExpirTime
);
return
ApiResult
.
Success
(
""
,
obj
);
}
}
/// <summary>
/// 获取商城详情
/// </summary>
/// <returns></returns>
public
ApiResult
GetTenant
()
{
var
model
=
TenantModule
.
GetTenantModule
(
base
.
UserInfo
.
TenantId
);
return
ApiResult
.
Success
(
""
,
model
);
}
}
}
\ No newline at end of file
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
d38534dc
...
...
@@ -178,7 +178,7 @@ namespace Mall.WebApi.Filter
string
secret
=
Config
.
JwtSecretKey
;
var
json
=
decoder
.
Decode
(
token
,
secret
,
verify
:
true
);
//token为之前生成的字符串
JObject
jwtJson
=
JObject
.
Parse
(
json
);
actionContext
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
=
jwtJson
[
"userInfo"
];
actionContext
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
=
jwtJson
[
"
mall_
userInfo"
];
}
catch
(
SignatureVerificationException
sve
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment