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
Show 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
...
...
@@ -21,6 +21,7 @@ class StrategySetController extends Controller
use
Tool
;
public
function
index
(){
try
{
$projectArr
=
$this
->
getAllowProjects
(
1
);
$strategyInfo
=
StrategySet
::
all
()
->
toArray
();
$listInfo
=
[];
...
...
@@ -36,9 +37,14 @@ class StrategySetController extends Controller
$listInfo
[]
=
$v
;
}
return
$this
->
successWithInfo
(
$listInfo
);
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
public
function
store
(
Request
$request
,
StrategyService
$StrategyService
){
try
{
$allowLoginUser
=
$this
->
getAllowLoginUser
();
$validator
=
Validator
::
make
(
$request
->
all
(),
[
...
...
@@ -99,9 +105,14 @@ class StrategySetController extends Controller
//返回成功数、失败数、失败导出文件
$returnArr
=
compact
(
'total'
,
'successTotal'
,
'failTotal'
,
'failDataFile'
);
return
$this
->
successWithInfo
(
$returnArr
);
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
//删除策略
public
function
destroy
(
$strategySn
){
try
{
DB
::
transaction
(
function
()
use
(
$strategySn
)
{
// 删除逻辑 注意多表关联的情况
StrategySet
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
...
...
@@ -110,6 +121,10 @@ class StrategySetController extends Controller
StrategyTask
::
where
([[
'strategy_sn'
,
$strategySn
],[
'is_created'
,
0
]])
->
delete
();
//删除未新建的任务数据
});
return
$this
->
successWithInfo
(
'操作完成'
);
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
//子账号列表
public
function
getUsersList
(){
...
...
@@ -165,6 +180,7 @@ class StrategySetController extends Controller
//导入excel数据
public
function
importExcelData
(
Request
$request
,
StrategyService
$StrategyService
){
try
{
$validator
=
Validator
::
make
(
$request
->
all
(),
[
'strategy_sn'
=>
'required'
,
'upload'
=>
'required'
...
...
@@ -205,5 +221,9 @@ class StrategySetController extends Controller
}
else
{
return
$this
->
errorWithInfo
(
'请选择导入文件'
,
401
);
}
}
catch
(
\Exception
$e
){
Log
::
channel
(
'api'
)
->
error
(
$e
->
getFile
()
.
'-'
.
$e
->
getLine
()
.
'-'
.
$e
->
getMessage
());
return
$this
->
errorWithInfo
(
'操作异常'
,
500
);
}
}
}
app/Http/Controllers/strategy/StrategyTaskController.php
View file @
f91cc4e8
...
...
@@ -16,7 +16,7 @@ class StrategyTaskController extends Controller
use
Tool
;
public
function
index
(
Request
$request
){
//搜索分页?
try
{
$pageSize
=
request
()
->
pageSize
;
$projectArr
=
$this
->
getAllowProjects
(
1
);
//$strategyInfo = StrategyTask::all()->toArray();
...
...
@@ -66,17 +66,20 @@ class StrategyTaskController extends Controller
}
}
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
)
{
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'
,
...
...
@@ -100,7 +103,10 @@ class StrategyTaskController extends Controller
$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