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
4461671b
Commit
4461671b
authored
Aug 06, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件下载修改
parent
d622af05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
TradeController.cs
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
+11
-11
Program.cs
Mall.WebApi/Program.cs
+3
-2
Startup.cs
Mall.WebApi/Startup.cs
+7
-2
No files found.
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
View file @
4461671b
...
...
@@ -2146,10 +2146,8 @@ namespace Mall.WebApi.Controllers.TradePavilion
demodel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
demodel
.
TenantId
=
RequestParm
.
TenantId
;
List
<
int
>
ExcelEnumIds
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
parms
.
GetStringValue
(
"ExcelEnumIds"
));
string
hashKey
=
Common
.
Config
.
GetHash
(
Common
.
Plugin
.
JsonHelper
.
Serialize
(
demodel
));
string
fileName
=
hashKey
+
".xls"
;
string
hashKey
=
Common
.
Config
.
GetHash
(
Common
.
Plugin
.
JsonHelper
.
Serialize
(
demodel
)
+
parms
.
GetStringValue
(
"ExcelEnumIds"
));
string
fileName
=
"品牌信息"
+
".xls"
;
string
filePath
=
Path
.
Combine
(
Directory
.
GetCurrentDirectory
(),
"upfile/temporary"
);
if
(
System
.
IO
.
Directory
.
Exists
(
filePath
)
==
false
)
//如果不存在就创建file文件夹
{
...
...
@@ -2169,8 +2167,11 @@ namespace Mall.WebApi.Controllers.TradePavilion
redisValue
=
redisHelper
.
StringGet
(
key
);
if
(
string
.
IsNullOrEmpty
(
redisValue
))
{
redisHelper
.
StringSet
(
key
,
fileName
,
TimeSpan
.
FromMinutes
(
30
));
GetBrandListToExcel
(
demodel
,
ExcelEnumIds
,
tempPath
,
fileUrl
);
redisHelper
.
StringSet
(
key
,
fileName
,
TimeSpan
.
FromMinutes
(
10
));
Task
.
Run
(()
=>
{
GetBrandListToExcel
(
demodel
,
ExcelEnumIds
,
tempPath
,
fileUrl
);
});
}
}
return
await
Task
.
Run
<
ApiResult
>(()
=>
...
...
@@ -2227,16 +2228,15 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
FileContentResult
GetFile
()
public
async
Task
<
FileContentResult
>
GetFile
()
{
string
ExcelName
=
"品牌列表"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
string
fileUrl
=
parms
.
GetStringValue
(
"fileUrl"
);
string
newPath
=
Directory
.
GetCurrentDirectory
()
+
fileUrl
;
if
(
System
.
IO
.
File
.
Exists
(
newPath
))
{
byte
[]
fileBytes
=
System
.
IO
.
File
.
ReadAllBytes
(
newPath
);
return
File
(
fileBytes
,
"application/octet-stream"
,
ExcelName
);
var
fileBytes
=
await
System
.
IO
.
File
.
ReadAllBytesAsync
(
newPath
);
return
File
(
fileBytes
,
"application/octet-stream"
);
}
else
{
...
...
@@ -2248,7 +2248,7 @@ namespace Mall.WebApi.Controllers.TradePavilion
/// 品牌下载
/// </summary>
private
void
GetBrandListToExcel
(
RB_Brand_Extend
demodel
,
List
<
int
>
ExcelEnumIds
,
string
filePath
,
string
excelFileUrl
)
private
async
void
GetBrandListToExcel
(
RB_Brand_Extend
demodel
,
List
<
int
>
ExcelEnumIds
,
string
filePath
,
string
excelFileUrl
)
{
try
{
...
...
Mall.WebApi/Program.cs
View file @
4461671b
...
...
@@ -24,10 +24,11 @@ namespace Mall.WebApi
webBuilder
.
ConfigureKestrel
((
context
,
options
)
=>
{
options
.
AllowSynchronousIO
=
true
;
//设置应用服务器Kestrel请求体最大为
5
0MB
options
.
Limits
.
MaxRequestBodySize
=
524288
00
;
//设置应用服务器Kestrel请求体最大为
10
0MB
options
.
Limits
.
MaxRequestBodySize
=
1048576
00
;
//解决并发异常
options
.
Limits
.
MinRequestBodyDataRate
=
null
;
options
.
Limits
.
KeepAliveTimeout
=
TimeSpan
.
FromMinutes
(
2
);
});
webBuilder
.
UseStartup
<
Startup
>().
UseIIS
();
});
...
...
Mall.WebApi/Startup.cs
View file @
4461671b
...
...
@@ -41,8 +41,13 @@ namespace Mall.WebApi
/// <param name="services"></param>
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
Configure
<
Microsoft
.
AspNetCore
.
Server
.
Kestrel
.
Core
.
KestrelServerOptions
>(
x
=>
x
.
AllowSynchronousIO
=
true
)
.
Configure
<
IISServerOptions
>(
x
=>
x
.
AllowSynchronousIO
=
true
);
services
.
Configure
<
Microsoft
.
AspNetCore
.
Server
.
Kestrel
.
Core
.
KestrelServerOptions
>(
x
=>
{
x
.
AllowSynchronousIO
=
true
;
x
.
Limits
.
KeepAliveTimeout
=
TimeSpan
.
FromMinutes
(
2
);
})
.
Configure
<
IISServerOptions
>(
x
=>
{
x
.
AllowSynchronousIO
=
true
;
})
;
services
.
AddControllers
();
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
//注入http上下文
...
...
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