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
c2a942dc
Commit
c2a942dc
authored
May 13, 2020
by
yinxiaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改跨域及忽略上传文件
parent
5a92d9a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
12 deletions
+38
-12
.gitignore
.gitignore
+1
-0
StrategyService.php
app/Service/StrategyService.php
+36
-11
cors.php
config/cors.php
+1
-1
No files found.
.gitignore
View file @
c2a942dc
...
...
@@ -2,6 +2,7 @@
/public/hot
/public/storage
/storage/*.key
/storage/import/*
/.idea
/.vagrant
Homestead.json
...
...
app/Service/StrategyService.php
View file @
c2a942dc
...
...
@@ -51,23 +51,48 @@ class StrategyService
}
//判断excel数据问题,$day_type//外呼日期类型 0每天 1日期前一天和当天 1需要验证值班日期必填
public
function
validExcelData
(
$data
,
$day_type
){
$failData
=
[[
'姓名'
,
'*手机号码'
,
'值班日期'
,
'失败原因'
]];
//$failDataTitle = ['姓名','*手机号码','值班日期','失败原因'];
//dump($data);
$failData
=
[];
foreach
(
$data
as
$k
=>
$v
){
$dataLab
=
1
;
if
(
strlen
(
$v
[
0
])
>
20
){
//姓名最大20个字符,中文处理,放入失败数据中
$failData
[]
=
array_push
(
$v
,
"姓名过长"
);
array_push
(
$v
,
"姓名过长"
);
$failData
[]
=
$v
;
$dataLab
=
0
;
}
if
(
$v
[
1
]){
//手机号格式验证,不能为空
$failData
[]
=
array_push
(
$v
,
"手机号格式不正确"
);
if
(
$dataLab
==
1
&&
!
preg_match
(
'/^1[3-8]{1}[0-9]{9}$/'
,
$v
[
1
])){
//手机号格式验证(手机号码验证以13、14、15、16、17、18开头的11位数字),不能为空
array_push
(
$v
,
"手机号格式不正确"
);
$failData
[]
=
$v
;
$dataLab
=
0
;
}
if
(
$day_type
==
1
){
//验证必填且为日期格式
/* if (empty($v[2])){
$failData[] = array_push($v, "值班日期必填");
}elseif (){
$failData[] = array_push($v, "值班日期格式错误");
} */
if
(
$dataLab
==
1
&&
$day_type
==
1
){
//验证必填且为日期格式
if
(
empty
(
$v
[
2
])){
array_push
(
$v
,
"值班日期必填"
);
$failData
[]
=
$v
;
$dataLab
=
0
;
}
else
{
$unixTime
=
strtotime
(
$v
[
2
]);
if
(
!
$unixTime
||
(
date
(
'Y/n/j'
,
$unixTime
)
!=
$v
[
2
]
&&
date
(
'n/j/Y'
,
$unixTime
)
!=
$v
[
2
]))
{
//月日不带0(2020/5/3或者 5/3/2020)
array_push
(
$v
,
"值班日期格式错误"
);
$failData
[]
=
$v
;
$dataLab
=
0
;
}
else
{
$v
[
2
]
=
date
(
'Y-m-d'
,
$unixTime
);
//处理存储db的日期格式(2020-05-13)
$data
[
$k
]
=
$v
;
}
}
}
if
(
$dataLab
==
0
){
unset
(
$data
[
$k
]);
}
}
dump
(
$failData
,
$data
);
$failTotal
=
count
(
$failData
);
$successTotal
=
count
(
$data
);
dd
(
'===================='
);
return
compact
(
'data'
,
'failData'
,
'failTotal'
,
'successTotal'
);
}
}
config/cors.php
View file @
c2a942dc
...
...
@@ -56,5 +56,5 @@ return [
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials'
=>
fals
e
,
'supports_credentials'
=>
tru
e
,
];
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