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
f91cc4e8
Commit
f91cc4e8
authored
May 19, 2020
by
yinxiaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常捕获
parent
aa44aef9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
219 additions
and
193 deletions
+219
-193
Tool.php
app/Http/Controllers/Tool.php
+1
-1
StrategySetController.php
app/Http/Controllers/strategy/StrategySetController.php
+136
-116
StrategyTaskController.php
app/Http/Controllers/strategy/StrategyTaskController.php
+82
-76
No files found.
app/Http/Controllers/Tool.php
View file @
f91cc4e8
...
...
@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Route; */
trait
Tool
{
public
function
getAllowLoginUser
(){
return
[
'user_name'
=>
'yxl00
1
'
,
'user_sn'
=>
'SYSUSER|9da548a2e392a679eb274a0b2abeb627'
,
'parent_sn'
=>
'ljs'
];
return
[
'user_name'
=>
'yxl00
2
'
,
'user_sn'
=>
'SYSUSER|9da548a2e392a679eb274a0b2abeb627'
,
'parent_sn'
=>
'ljs'
];
}
public
function
getAllowProjects
(
$style
=
0
){
$projectInfo
=
[[
'sn'
=>
'projects|a3a4259352c8e964ad6ea6c5ee8a7208'
,
'name'
=>
'liuy-转人工测试'
],[
'sn'
=>
'projects|17a71649f886bce050d637e86a3c85e8'
,
'name'
=>
'小贷-测试林俊生'
]];
...
...
app/Http/Controllers/strategy/StrategySetController.php
View file @
f91cc4e8
This diff is collapsed.
Click to expand it.
app/Http/Controllers/strategy/StrategyTaskController.php
View file @
f91cc4e8
...
...
@@ -16,91 +16,97 @@ class StrategyTaskController extends Controller
use
Tool
;
public
function
index
(
Request
$request
){
//搜索分页?
$pageSize
=
request
()
->
pageSize
;
$projectArr
=
$this
->
getAllowProjects
(
1
);
//$strategyInfo = StrategyTask::all()->toArray();
$searchArr
=
[];
/* $searchArr['phone'] = request()->phone;
$searchArr['is_created'] = request()->is_created;
$searchArr['callTimeStart'] = request()->started_at;
$searchArr['callTimeStop'] = request()->stoped_at; */
$searchArr
[
'phone'
]
=
$request
->
phone
;
$searchArr
[
'is_created'
]
=
$request
->
is_created
;
$searchArr
[
'callTimeStart'
]
=
$request
->
started_at
;
$searchArr
[
'callTimeStop'
]
=
$request
->
stoped_at
;
Log
::
channel
(
'api'
)
->
info
(
var_export
(
$searchArr
,
true
));
$strategyInfo
=
StrategyTask
::
where
(
function
(
$query
)
use
(
$searchArr
){
if
(
isset
(
$searchArr
[
'phone'
])
&&
!
empty
(
$searchArr
[
'phone'
])){
$query
->
where
(
'phone'
,
'like'
,
"%
{
$searchArr
[
'phone'
]
}
%"
);
}
if
(
isset
(
$searchArr
[
'is_created'
])
&&
is_numeric
(
$searchArr
[
'is_created'
])){
$query
->
where
(
'is_created'
,
"
{
$searchArr
[
'is_created'
]
}
"
);
}
try
{
$pageSize
=
request
()
->
pageSize
;
$projectArr
=
$this
->
getAllowProjects
(
1
);
//$strategyInfo = StrategyTask::all()->toArray();
if
(
isset
(
$searchArr
[
'callTimeStart'
])
&&
!
empty
(
$searchArr
[
'callTimeStart'
])){
$query
->
whereRaw
(
" call_date || ' ' || call_time >= '
{
$searchArr
[
'callTimeStart'
]
}
'"
);
}
$searchArr
=
[];
/* $searchArr['phone'] = request()->phone;
$searchArr['is_created'] = request()->is_created;
$searchArr['callTimeStart'] = request()->started_at;
$searchArr['callTimeStop'] = request()->stoped_at; */
$searchArr
[
'phone'
]
=
$request
->
phone
;
$searchArr
[
'is_created'
]
=
$request
->
is_created
;
$searchArr
[
'callTimeStart'
]
=
$request
->
started_at
;
$searchArr
[
'callTimeStop'
]
=
$request
->
stoped_at
;
Log
::
channel
(
'api'
)
->
info
(
var_export
(
$searchArr
,
true
));
if
(
isset
(
$searchArr
[
'callTimeStop'
])
&&
!
empty
(
$searchArr
[
'callTimeStop'
])){
$query
->
whereRaw
(
" call_date || ' ' || call_time <= '
{
$searchArr
[
'callTimeStop'
]
}
'"
);
}
});
if
(
empty
(
$pageSize
)){
$strategyInfo
=
$strategyInfo
->
orderBy
(
'call_date'
,
'desc'
)
->
orderBy
(
'call_time'
,
'desc'
)
->
get
()
->
toArray
();
}
else
{
$strategyInfo
=
$strategyInfo
->
orderBy
(
'call_date'
,
'desc'
)
->
orderBy
(
'call_time'
,
'desc'
)
->
paginate
(
$pageSize
)
->
toArray
();
}
$listInfo
=
[];
if
(
isset
(
$strategyInfo
[
'data'
])
&&
!
empty
(
$strategyInfo
[
'data'
])){
foreach
(
$strategyInfo
[
'data'
]
as
$k
=>
$v
){
$strategyInfo
[
'data'
][
$k
][
'project_name'
]
=
isset
(
$projectArr
[
$v
[
'project_sn'
]])
?
$projectArr
[
$v
[
'project_sn'
]]
:
''
;
$strategyInfo
[
'data'
][
$k
][
'is_created_name'
]
=
$v
[
'is_created'
]
==
0
?
'未建'
:
'已建'
;
$strategyInfo
=
StrategyTask
::
where
(
function
(
$query
)
use
(
$searchArr
){
if
(
isset
(
$searchArr
[
'phone'
])
&&
!
empty
(
$searchArr
[
'phone'
])){
$query
->
where
(
'phone'
,
'like'
,
"%
{
$searchArr
[
'phone'
]
}
%"
);
}
if
(
isset
(
$searchArr
[
'is_created'
])
&&
is_numeric
(
$searchArr
[
'is_created'
])){
$query
->
where
(
'is_created'
,
"
{
$searchArr
[
'is_created'
]
}
"
);
}
if
(
isset
(
$searchArr
[
'callTimeStart'
])
&&
!
empty
(
$searchArr
[
'callTimeStart'
])){
$query
->
whereRaw
(
" call_date || ' ' || call_time >= '
{
$searchArr
[
'callTimeStart'
]
}
'"
);
}
if
(
isset
(
$searchArr
[
'callTimeStop'
])
&&
!
empty
(
$searchArr
[
'callTimeStop'
])){
$query
->
whereRaw
(
" call_date || ' ' || call_time <= '
{
$searchArr
[
'callTimeStop'
]
}
'"
);
}
});
if
(
empty
(
$pageSize
)){
$strategyInfo
=
$strategyInfo
->
orderBy
(
'call_date'
,
'desc'
)
->
orderBy
(
'call_time'
,
'desc'
)
->
get
()
->
toArray
();
}
else
{
$strategyInfo
=
$strategyInfo
->
orderBy
(
'call_date'
,
'desc'
)
->
orderBy
(
'call_time'
,
'desc'
)
->
paginate
(
$pageSize
)
->
toArray
();
}
}
return
$this
->
successWithInfo
(
$strategyInfo
);
$listInfo
=
[];
if
(
isset
(
$strategyInfo
[
'data'
])
&&
!
empty
(
$strategyInfo
[
'data'
])){
foreach
(
$strategyInfo
[
'data'
]
as
$k
=>
$v
){
$strategyInfo
[
'data'
][
$k
][
'project_name'
]
=
isset
(
$projectArr
[
$v
[
'project_sn'
]])
?
$projectArr
[
$v
[
'project_sn'
]]
:
''
;
$strategyInfo
[
'data'
][
$k
][
'is_created_name'
]
=
$v
[
'is_created'
]
==
0
?
'未建'
:
'已建'
;
}
}
return
$this
->
successWithInfo
(
$strategyInfo
);
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
public
function
update
(
Request
$request
,
$id
)
{
$phone
=
$request
->
phone
;
$name
=
$request
->
name
;
$callTime
=
$request
->
call_time
;
$validator
=
Validator
::
make
(
$request
->
all
(),
[
'phone'
=>
'required|regex:/^1[3-8]{1}[0-9]{9}$/'
,
'user_sn'
=>
'required'
,
'call_time'
=>
'required'
,
'name'
=>
'max:20'
]);
if
(
$validator
->
fails
())
{
return
$this
->
errorWithInfo
(
'表单验证失败'
,
401
);
}
$taskInfo
=
StrategyTask
::
find
(
$id
);
if
(
empty
(
$taskInfo
)){
return
$this
->
errorWithInfo
(
'任务数据不存在'
,
401
);
}
if
(
$taskInfo
->
is_created
==
1
){
return
$this
->
errorWithInfo
(
'任务已经创建不能编辑'
,
401
);
}
$taskInfo
->
phone
=
$phone
;
$taskInfo
->
name
=
$name
;
$taskInfo
->
call_time
=
$callTime
;
$taskInfo
->
save
();
return
$this
->
successWithInfo
(
'更新成功'
);
try
{
$phone
=
$request
->
phone
;
$name
=
$request
->
name
;
$callTime
=
$request
->
call_time
;
$validator
=
Validator
::
make
(
$request
->
all
(),
[
'phone'
=>
'required|regex:/^1[3-8]{1}[0-9]{9}$/'
,
'user_sn'
=>
'required'
,
'call_time'
=>
'required'
,
'name'
=>
'max:20'
]);
if
(
$validator
->
fails
())
{
return
$this
->
errorWithInfo
(
'表单验证失败'
,
401
);
}
$taskInfo
=
StrategyTask
::
find
(
$id
);
if
(
empty
(
$taskInfo
)){
return
$this
->
errorWithInfo
(
'任务数据不存在'
,
401
);
}
if
(
$taskInfo
->
is_created
==
1
){
return
$this
->
errorWithInfo
(
'任务已经创建不能编辑'
,
401
);
}
$taskInfo
->
phone
=
$phone
;
$taskInfo
->
name
=
$name
;
$taskInfo
->
call_time
=
$callTime
;
$taskInfo
->
save
();
return
$this
->
successWithInfo
(
'更新成功'
);
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
...
...
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