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
ac89a91e
Commit
ac89a91e
authored
May 28, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
b300bb1d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
48 deletions
+29
-48
RB_Miniprogram_Template_Extend.cs
.../Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
+9
-1
ApiExceptionFilterAttribute.cs
Mall.WebApi/Filter/ApiExceptionFilterAttribute.cs
+2
-2
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+18
-45
No files found.
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
View file @
ac89a91e
...
...
@@ -1896,22 +1896,30 @@ namespace Mall.Model.Extend.MarketingCenter
public
class
quicknavDetailsItem
{
public
bool
opened
{
get
;
set
;
}
public
string
picUrl
{
get
;
set
;
}
public
string
number
{
get
;
set
;
}
public
string
appId
{
get
;
set
;
}
public
string
page
{
get
;
set
;
}
public
string
address
{
get
;
set
;
}
public
string
location
{
get
;
set
;
}
public
string
open_type
{
get
;
set
;
}
public
string
link_url
{
get
;
set
;
}
public
string
key
{
get
;
set
;
}
public
string
@params
{
get
;
set
;
}
//
public string @params { get; set; }
}
...
...
Mall.WebApi/Filter/ApiExceptionFilterAttribute.cs
View file @
ac89a91e
...
...
@@ -33,10 +33,10 @@ namespace Mall.WebApi.Filter
//记录错误日志
if
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
]
!=
null
)
{
LogHelper
.
Error
(
$"InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
,请求参数:
{
JsonConvert
.
SerializeObject
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
].
ToString
())}
"
,
context
.
Exception
);
LogHelper
.
Error
(
$"
ApiExceptionFilterAttribute_
InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
,请求参数:
{
JsonConvert
.
SerializeObject
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
].
ToString
())}
"
,
context
.
Exception
);
}
else
{
LogHelper
.
Error
(
$"InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
"
,
context
.
Exception
);
LogHelper
.
Error
(
$"
ApiExceptionFilterAttribute_
InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
"
,
context
.
Exception
);
}
var
robj
=
new
ApiResult
()
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
ac89a91e
...
...
@@ -40,9 +40,7 @@ namespace Mall.WebApi.Filter
//请求参数
JObject
parm
=
new
JObject
();
string
token
=
""
;
#
region
api
监控日志
parm
=
DoApiMonitorLog
(
actionContext
,
ref
token
);
#
endregion
bool
isCheckToken
=
true
;
var
endpoint
=
actionContext
.
HttpContext
.
Features
.
Get
<
IEndpointFeature
>()?.
Endpoint
;
if
(
endpoint
!=
null
&&
endpoint
.
Metadata
.
GetMetadata
<
AllowAnonymousAttribute
>()
!=
null
)
...
...
@@ -50,8 +48,6 @@ namespace Mall.WebApi.Filter
isCheckToken
=
false
;
}
#
region
Token
校验
if
(
isCheckToken
)
...
...
@@ -141,16 +137,26 @@ namespace Mall.WebApi.Filter
JObject
parm
=
new
JObject
();
var
request
=
actionContext
.
HttpContext
.
Request
;
#
region
如果参数是
json
实体对象,获取序列化后的数据
request
.
EnableBuffering
();
//重置读取
request
.
Body
.
Seek
(
0
,
SeekOrigin
.
Begin
);
request
.
Body
.
Position
=
0
;
Stream
stream
=
request
.
Body
;
Encoding
encoding
=
Encoding
.
UTF8
;
if
(
request
.
ContentLength
>
0
)
{
byte
[]
buffer
=
new
byte
[
request
.
ContentLength
.
Value
];
stream
.
Read
(
buffer
,
0
,
buffer
.
Length
);
string
responseData
=
Encoding
.
UTF8
.
GetString
(
buffer
);
string
responseData
=
""
;
string
data
=
""
;
//多次读取Request.Body
using
(
MemoryStream
ms
=
new
MemoryStream
())
{
request
.
Body
.
CopyToAsync
(
ms
);
//设置当前流的位置为0
ms
.
Seek
(
0
,
SeekOrigin
.
Begin
);
//这里ReadToEnd执行完毕后requestBodyStream流的位置会从0到最后位置(即request.ContentLength)
data
=
new
StreamReader
(
ms
,
Encoding
.
UTF8
).
ReadToEnd
();
//设置当前流的位置为0
ms
.
Seek
(
0
,
SeekOrigin
.
Begin
);
request
.
Body
=
ms
;
StreamReader
sr
=
new
StreamReader
(
request
.
Body
);
responseData
=
sr
.
ReadToEnd
();
}
if
(!
string
.
IsNullOrWhiteSpace
(
responseData
.
Trim
()))
{
try
...
...
@@ -306,39 +312,6 @@ namespace Mall.WebApi.Filter
//TODO查询用户权限
string
url
=
actionContext
.
HttpContext
.
Request
.
GetAbsoluteUri
();
bool
havPermission
=
true
;
//List<object> args = new List<object>() {
// uid
//};
//根据uid 判断用户是否拥有该权限
//Type type = (Type)_obj;
//MethodInfo meth = type.GetMethod(model.Method);
//try
//{
// permission = (string)meth.Invoke(Activator.CreateInstance(type), args.ToArray());
//}
//catch
//{
//}
//if (!string.IsNullOrWhiteSpace(permission))
//{
// if (permission.ToLower().Contains(url.ToLower()))
// {
// havPermission = true;
// }
// else//判断菜单是否存在
// {
// bool systemIsExit = RbUserCache.GetSystemHasMenu(url.ToLower());
// if (!systemIsExit)
// {
// havPermission = true;
// }
// }
//}
if
(
havPermission
==
false
)
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
...
...
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