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
bfc7d6f2
Commit
bfc7d6f2
authored
May 25, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增匿名属性
parent
d4c3c25a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
49 deletions
+64
-49
UserReidsCache.cs
Mall.CacheManager/User/UserReidsCache.cs
+38
-30
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+6
-3
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+5
-1
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+1
-0
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+10
-14
Startup.cs
Mall.WebApi/Startup.cs
+4
-1
No files found.
Mall.CacheManager/User/UserReidsCache.cs
View file @
bfc7d6f2
...
@@ -87,8 +87,10 @@ namespace Mall.CacheManager.User
...
@@ -87,8 +87,10 @@ namespace Mall.CacheManager.User
/// <returns></returns>
/// <returns></returns>
public
static
UserInfo
GetUserLoginInfo
(
object
TenantId
)
public
static
UserInfo
GetUserLoginInfo
(
object
TenantId
)
{
{
string
cacheKey
=
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
TenantId
.
ToString
();
UserInfo
userInfo
=
null
;
UserInfo
userInfo
=
null
;
if
(
TenantId
!=
null
)
{
string
cacheKey
=
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
TenantId
.
ToString
();
try
try
{
{
userInfo
=
redis
.
StringGet
<
UserInfo
>(
cacheKey
);
userInfo
=
redis
.
StringGet
<
UserInfo
>(
cacheKey
);
...
@@ -125,6 +127,12 @@ namespace Mall.CacheManager.User
...
@@ -125,6 +127,12 @@ namespace Mall.CacheManager.User
}
}
}
}
}
}
}
else
{
userInfo
=
new
UserInfo
();
}
return
userInfo
;
return
userInfo
;
}
}
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
bfc7d6f2
...
@@ -116,8 +116,8 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -116,8 +116,8 @@ namespace Mall.WebApi.Controllers.MallBase
homePage
=
new
homePage
=
new
{
{
id
=
selfHomePage
.
Id
,
id
=
miniProgram
.
MallBase
Id
,
title
=
selfHomePage
.
Page
Name
,
title
=
miniProgram
.
Mall
Name
,
show_navs
=
selfHomePage
.
IsShowNav
,
show_navs
=
selfHomePage
.
IsShowNav
,
is_home_page
=
selfHomePage
.
IsHome
,
is_home_page
=
selfHomePage
.
IsHome
,
navs
=
list
navs
=
list
...
@@ -300,7 +300,10 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -300,7 +300,10 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
}
}
}
}
return
ApiResult
.
Success
(
data
:
homePage
);
var
objResult
=
new
{
home_pages
=
homePage
};
return
ApiResult
.
Success
(
data
:
objResult
);
}
}
/// <summary>
/// <summary>
...
...
Mall.WebApi/Controllers/User/TenantController.cs
View file @
bfc7d6f2
...
@@ -20,6 +20,7 @@ using Mall.Common.Plugin;
...
@@ -20,6 +20,7 @@ using Mall.Common.Plugin;
using
Mall.Common.Enum.MallBase
;
using
Mall.Common.Enum.MallBase
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Entity.User
;
using
Mall.Module.Product
;
using
Mall.Module.Product
;
using
Microsoft.AspNetCore.Authorization
;
namespace
Mall.WebApi.Controllers.User
namespace
Mall.WebApi.Controllers.User
{
{
...
@@ -27,7 +28,6 @@ namespace Mall.WebApi.Controllers.User
...
@@ -27,7 +28,6 @@ namespace Mall.WebApi.Controllers.User
[
ApiExceptionFilter
]
[
ApiExceptionFilter
]
[
ApiController
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
[
EnableCors
(
"AllowCors"
)]
public
class
TenantController
:
BaseController
public
class
TenantController
:
BaseController
{
{
/// <summary>
/// <summary>
...
@@ -77,6 +77,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -77,6 +77,7 @@ namespace Mall.WebApi.Controllers.User
#
region
商户信息
#
region
商户信息
[
AllowAnonymous
]
/// <summary>
/// <summary>
/// 用户登录
/// 用户登录
/// </summary>
/// </summary>
...
@@ -152,6 +153,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -152,6 +153,7 @@ namespace Mall.WebApi.Controllers.User
/// 用户注册第一步
/// 用户注册第一步
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
public
ApiResult
SetTenantFirst
()
public
ApiResult
SetTenantFirst
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
@@ -171,6 +173,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -171,6 +173,7 @@ namespace Mall.WebApi.Controllers.User
/// 用户注册第二步
/// 用户注册第二步
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
public
ApiResult
SetTenantSecond
()
public
ApiResult
SetTenantSecond
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
@@ -194,6 +197,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -194,6 +197,7 @@ namespace Mall.WebApi.Controllers.User
/// 修改密码账号
/// 修改密码账号
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
public
ApiResult
UpdateTenantPwd
()
public
ApiResult
UpdateTenantPwd
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
...
Mall.WebApi/Controllers/User/UserController.cs
View file @
bfc7d6f2
...
@@ -14,6 +14,7 @@ using Mall.Common.Enum.User;
...
@@ -14,6 +14,7 @@ using Mall.Common.Enum.User;
using
Mall.CacheManager.User
;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.Common
;
using
Microsoft.AspNetCore.Authorization
;
namespace
Mall.WebApi.Controllers.User
namespace
Mall.WebApi.Controllers.User
{
{
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
bfc7d6f2
...
@@ -17,6 +17,10 @@ using Microsoft.AspNetCore.Http;
...
@@ -17,6 +17,10 @@ using Microsoft.AspNetCore.Http;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration.Json
;
using
Microsoft.Extensions.Configuration.Json
;
using
Mall.CacheManager.User
;
using
Mall.CacheManager.User
;
using
System.Linq
;
using
Microsoft.AspNetCore.Mvc.Authorization
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http.Features
;
namespace
Mall.WebApi.Filter
namespace
Mall.WebApi.Filter
{
{
...
@@ -39,23 +43,15 @@ namespace Mall.WebApi.Filter
...
@@ -39,23 +43,15 @@ namespace Mall.WebApi.Filter
#
region
api
监控日志
#
region
api
监控日志
parm
=
DoApiMonitorLog
(
actionContext
,
ref
token
);
parm
=
DoApiMonitorLog
(
actionContext
,
ref
token
);
#
endregion
#
endregion
//不需要验证TOKEN的CMD
List
<
string
>
notValidatList
=
new
List
<
string
>()
{
"/api/Tenant/Login"
,
//用户登录
"/api/Tenant/SetTenantFirst"
,
//用户注册第一步
"/api/Tenant/SetTenantSecond"
,
//用户注册第二步
"/api/Tenant/UpdateTenantPwd"
,
//忘记密码
"/api/Mall/GetHome"
,
//
};
bool
isCheckToken
=
true
;
bool
isCheckToken
=
true
;
foreach
(
var
item
in
notValidatList
)
var
endpoint
=
actionContext
.
HttpContext
.
Features
.
Get
<
IEndpointFeature
>()?.
Endpoint
;
{
if
(
endpoint
!=
null
&&
endpoint
.
Metadata
.
GetMetadata
<
AllowAnonymousAttribute
>()
!=
null
)
if
(
item
==
parm
[
"cmd"
].
ToString
())
{
{
isCheckToken
=
false
;
isCheckToken
=
false
;
}
}
}
#
region
Token
校验
#
region
Token
校验
if
(
isCheckToken
)
if
(
isCheckToken
)
...
...
Mall.WebApi/Startup.cs
View file @
bfc7d6f2
...
@@ -5,6 +5,7 @@ using System.Text.Encodings.Web;
...
@@ -5,6 +5,7 @@ using System.Text.Encodings.Web;
using
System.Text.Unicode
;
using
System.Text.Unicode
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Mall.ThirdCore.Message
;
using
Mall.ThirdCore.Message
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
...
@@ -35,6 +36,7 @@ namespace Mall.WebApi
...
@@ -35,6 +36,7 @@ namespace Mall.WebApi
services
.
AddControllers
();
services
.
AddControllers
();
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
//注入http上下文
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
//注入http上下文
services
.
AddMvc
().
AddJsonOptions
(
options
=>
services
.
AddMvc
().
AddJsonOptions
(
options
=>
{
{
options
.
JsonSerializerOptions
.
Encoder
=
JavaScriptEncoder
.
Create
(
UnicodeRanges
.
All
);
options
.
JsonSerializerOptions
.
Encoder
=
JavaScriptEncoder
.
Create
(
UnicodeRanges
.
All
);
...
@@ -66,6 +68,7 @@ namespace Mall.WebApi
...
@@ -66,6 +68,7 @@ namespace Mall.WebApi
app
.
UseAuthorization
();
app
.
UseAuthorization
();
app
.
UseEndpoints
(
endpoints
=>
app
.
UseEndpoints
(
endpoints
=>
{
{
endpoints
.
MapControllers
();
endpoints
.
MapControllers
();
...
...
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