Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aic_duty_strategy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
yinxiaoling
aic_duty_strategy
Commits
0b16b7b1
Commit
0b16b7b1
authored
May 19, 2020
by
yinxiaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载失败数据
parent
7d97a651
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
StrategySetController.php
app/Http/Controllers/strategy/StrategySetController.php
+2
-2
StrategyTaskController.php
app/Http/Controllers/strategy/StrategyTaskController.php
+7
-7
StrategyService.php
app/Service/StrategyService.php
+2
-3
No files found.
app/Http/Controllers/strategy/StrategySetController.php
View file @
0b16b7b1
...
...
@@ -156,7 +156,7 @@ class StrategySetController extends Controller
if
(
empty
(
$excelFile
)){
return
$this
->
errorWithInfo
(
'表单验证失败'
,
401
);
}
$url
=
storage_path
()
.
"/import/"
.
$excelFile
.
'.xlsx'
;
$url
=
storage_path
()
.
"/import/"
.
$excelFile
.
'.xlsx'
;
//dump(file_exists($url));dd($url);
try
{
if
(
file_exists
(
$url
)
==
false
){
return
$this
->
errorWithInfo
(
'文件不存在,下载失败'
,
401
);
...
...
@@ -166,7 +166,7 @@ class StrategySetController extends Controller
fclose
(
$cont
);
//发送mp3文件MIME 头
header
(
'Content-Type:application/vnd.ms-excel'
);
header
(
'Content-Type:application/vnd.ms-excel
;charset=utf-8;
'
);
// 发送下载附件头.
header
(
"Content-disposition: attachment; filename=
\"
"
.
$url
.
"
\"
"
);
header
(
'Content-transfer-encoding: binary'
);
...
...
app/Http/Controllers/strategy/StrategyTaskController.php
View file @
0b16b7b1
...
...
@@ -17,9 +17,11 @@ class StrategyTaskController extends Controller
public
function
index
(
Request
$request
){
try
{
$pageSize
=
request
()
->
pageSize
;
$pageSize
=
$request
->
pageSize
;
if
(
empty
(
$pageSize
)){
$pageSize
=
20
;
}
$projectArr
=
$this
->
getAllowProjects
(
1
);
//$strategyInfo = StrategyTask::all()->toArray();
$searchArr
=
[];
/* $searchArr['phone'] = request()->phone;
...
...
@@ -32,9 +34,7 @@ class StrategyTaskController extends Controller
$searchArr
[
'callTimeStart'
]
=
$request
->
started_at
;
$searchArr
[
'callTimeStop'
]
=
$request
->
stoped_at
;
Log
::
channel
(
'api'
)
->
info
(
var_export
(
$searchArr
,
true
));
//Log::channel('api')->info(var_export($searchArr,true));
$strategyInfo
=
StrategyTask
::
where
(
function
(
$query
)
use
(
$searchArr
){
if
(
isset
(
$searchArr
[
'phone'
])
&&
!
empty
(
$searchArr
[
'phone'
])){
...
...
app/Service/StrategyService.php
View file @
0b16b7b1
...
...
@@ -104,8 +104,7 @@ class StrategyService
if
(
$failTotal
>
0
){
//把导出错误数据存入excel表格中供下载
$failDataTitle
=
[
'姓名'
,
'*手机号码'
,
'值班日期'
,
'失败原因'
];
array_unshift
(
$failData
,
$failDataTitle
);
$failExcelName
=
"导入失败数据_"
.
date
(
'YmdHis'
);
$failExcelName
=
"importfaildata_"
.
date
(
'YmdHis'
);
$failFile
=
$this
->
storeExcelStyle
(
$failExcelName
,
$failData
,
''
,
'import'
);
//$failDataFile = $failExcelName.'.xlsx';
if
(
$failFile
){
...
...
@@ -130,7 +129,7 @@ class StrategyService
}
}
$e
=
Excel
::
create
(
iconv
(
'UTF-8'
,
'GB
K
'
,
$excelName
),
function
(
$excel
)
use
(
$datas
,
$arr
){
$e
=
Excel
::
create
(
iconv
(
'UTF-8'
,
'GB
2312
'
,
$excelName
),
function
(
$excel
)
use
(
$datas
,
$arr
){
$excel
->
sheet
(
'score'
,
function
(
$sheet
)
use
(
$datas
,
$arr
){
$col
=
array
();
$sheet
->
rows
(
$datas
);
...
...
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