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
96797e3a
Commit
96797e3a
authored
May 18, 2020
by
yinxiaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
呼叫频率下反
parent
fefd72d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
22 deletions
+70
-22
CreatedTaskCommand.php
app/Console/Commands/CreatedTaskCommand.php
+48
-1
StrategySetController.php
app/Http/Controllers/strategy/StrategySetController.php
+1
-1
StrategyService.php
app/Service/StrategyService.php
+21
-20
No files found.
app/Console/Commands/CreatedTaskCommand.php
View file @
96797e3a
...
...
@@ -4,9 +4,11 @@ namespace App\Console\Commands;
use
Illuminate\Console\Command
;
use
App\Models\StrategyTask
;
//use App\Http\Controllers\Tool;
class
CreatedTaskCommand
extends
Command
{
//use Tool;
/**
* The name and signature of the console command.
*
...
...
@@ -39,10 +41,55 @@ class CreatedTaskCommand extends Command
public
function
handle
()
{
//新建任务、失败原任务重呼3次,接口调用失败重试3次
//$userInfo = $this->getAllowLoginUser();
$userInfo
=
[
'user_name'
=>
'yxl001'
,
'user_sn'
=>
'SYSUSER|9da548a2e392a679eb274a0b2abeb627'
,
'parent_sn'
=>
'ljs'
];
$taskInfo
=
StrategyTask
::
where
(
'is_created'
,
0
)
->
get
()
->
toArray
();
//获取需要新建任务的数据
//dd($taskInfo);
$url
=
"https://test117.ciopaas.com/api/addJsonNoLogin"
;
foreach
(
$taskInfo
as
$k
=>
$v
){
//批量调用接口新建任务
//处理参数
$client_info_json
=
[
[
'姓名'
=>
$v
[
'name'
],
'电话'
=>
$v
[
'phone'
],
'地址'
=>
''
,
'公司名称'
=>
''
,
'备注'
=>
''
,
'手机号码'
=>
$v
[
'phone'
],
'值班日期'
=>
$v
[
'duty_date'
]
]
];
$params
=
[
'user_sn'
=>
$userInfo
[
'user_sn'
],
'project_sn'
=>
$v
[
'project_sn'
],
'source'
=>
date
(
'YmdHis'
)
.
$k
,
//任务名称,年月日时分秒,加上循环键值避免重复任务名
'ai_user_sn'
=>
$v
[
'user_sn'
],
'is_zidong'
=>
'off'
,
//是否自动启动,否,任务定时启动
'is_open_remove_duplication'
=>
'0'
,
'is_auto_fail_recall'
=>
'1'
,
//是否自动重呼,是
'total_fail_recall_times'
=>
'3'
,
//重呼次数
'fail_recall_interval'
=>
''
,
//重呼间隔时间
'mark'
=>
'值班策略创建任务'
,
'fail_recall_of_reason'
=>
'关机,来电提醒,稍后再拨,停机,无法接通,正在通话中,用户正忙,用户拒接,欠费,无人应答,其他,对方示忙'
,
'ai_distribution_type'
=>
'0'
//0公用ai 1按主账号分配ai(6.2人工外呼分配方式 0平均,1抢拨)
];
$params
[
'client_info_json'
]
=
json_encode
(
$client_info_json
);
$params
[
'url'
]
=
substr
(
md5
(
json_encode
(
$params
)),
1
,
8
);
$requestReturn
=
$this
->
requestPost
(
$url
,
$params
);
dd
(
$requestReturn
);
$requestReturnArr
=
json_decode
(
$requestReturn
,
true
);
if
(
isset
(
$requestReturnArr
[
'code'
])){
}
else
{
}
}
}
}
app/Http/Controllers/strategy/StrategySetController.php
View file @
96797e3a
...
...
@@ -55,7 +55,7 @@ class StrategySetController extends Controller
return
$this
->
errorWithInfo
(
'表单验证失败'
,
401
);
}
$params
=
$request
->
all
();
if
(
$params
[
'
day_type'
]
==
1
||
$params
[
'
frequency_type'
]
==
2
){
//日期前一天和当天,一天两次时间、项目格式验证,#号分割
if
(
$params
[
'frequency_type'
]
==
2
){
//日期前一天和当天,一天两次时间、项目格式验证,#号分割
$checkCallTimeSet
=
explode
(
"#"
,
$params
[
'call_time_set'
]);
$checkProjectSn
=
explode
(
"#"
,
$params
[
'project_sn'
]);
if
(
!
isset
(
$checkCallTimeSet
[
1
])
||
empty
(
$checkCallTimeSet
[
1
])
||
!
isset
(
$checkProjectSn
[
1
])
||
empty
(
$checkProjectSn
[
1
])){
...
...
app/Service/StrategyService.php
View file @
96797e3a
...
...
@@ -227,14 +227,15 @@ class StrategyService
$project_sn
=
explode
(
"#"
,
$strategyInfo
[
'project_sn'
]);
$tempi
=
0
;
if
(
$strategyInfo
[
'day_type'
]
==
0
){
//每天拨打
if
(
$strategyInfo
[
'day_type'
]
==
0
&&
$strategyInfo
[
'frequency_type'
]
==
2
){
//每天拨打,一天两次
$doubleTotal
=
$total
*
2
;
$startDay
=
date
(
'Y-m-d'
);
//执行当天时间
//这个月最后一天日期
$endDay
=
date
(
'Y-m-d'
,
strtotime
(
"-1 day"
,
strtotime
(
"+1 month"
,
strtotime
(
date
(
'Y-m-01'
)))));
for
(
$i
=
$startDay
;
$i
<=
$endDay
;
$i
=
date
(
"Y-m-d"
,
strtotime
(
"+1 day"
,
strtotime
(
$i
)))){
foreach
(
$data
as
$k
=>
$v
){
$tempi
++
;
$tempi
=
$tempi
+
2
;
$taskData
[]
=
[
'strategy_sn'
=>
$strategySn
,
'name'
=>
$v
->
name
,
...
...
@@ -249,7 +250,21 @@ class StrategyService
'created_at'
=>
$now
];
if
(
count
(
$taskData
)
==
$batch
||
$total
==
$batch
||
$tempi
==
$total
){
$taskData
[]
=
[
'strategy_sn'
=>
$strategySn
,
'name'
=>
$v
->
name
,
'phone'
=>
$v
->
phone
,
'duty_date'
=>
$v
->
duty_date
,
'import_date'
=>
$v
->
created_at
,
'parent_sn'
=>
$strategyInfo
[
'parent_sn'
],
'call_number'
=>
$strategyInfo
[
'call_number'
],
'project_sn'
=>
isset
(
$project_sn
[
1
])
?
$project_sn
[
1
]
:
''
,
'call_date'
=>
$v
[
'duty_date'
],
'call_time'
=>
isset
(
$call_time
[
1
])
?
$call_time
[
1
]
:
''
,
'created_at'
=>
$now
];
if
(
count
(
$taskData
)
==
$batch
||
$doubleTotal
==
$batch
||
$tempi
==
$doubleTotal
){
if
(
!
empty
(
$taskData
)){
StrategyTask
::
insert
(
$taskData
);
$taskData
=
[];
...
...
@@ -259,9 +274,9 @@ class StrategyService
}
}
}
else
{
$doubleTotal
=
$total
*
2
;
foreach
(
$data
as
$k
=>
$v
){
$tempi
=
$tempi
+
2
;
$tempi
=
$tempi
+
1
;
$yesterday
=
date
(
'Y-m-d'
,
strtotime
(
"-1 day"
,
strtotime
(
$v
->
duty_date
)));
$taskData
[]
=
[
'strategy_sn'
=>
$strategySn
,
...
...
@@ -276,22 +291,8 @@ class StrategyService
'call_time'
=>
isset
(
$call_time
[
0
])
?
$call_time
[
0
]
:
''
,
'created_at'
=>
$now
];
$taskData
[]
=
[
'strategy_sn'
=>
$strategySn
,
'name'
=>
$v
->
name
,
'phone'
=>
$v
->
phone
,
'duty_date'
=>
$v
->
duty_date
,
'import_date'
=>
$v
->
created_at
,
'parent_sn'
=>
$strategyInfo
[
'parent_sn'
],
'call_number'
=>
$strategyInfo
[
'call_number'
],
'project_sn'
=>
isset
(
$project_sn
[
1
])
?
$project_sn
[
1
]
:
''
,
'call_date'
=>
$v
[
'duty_date'
],
'call_time'
=>
isset
(
$call_time
[
1
])
?
$call_time
[
1
]
:
''
,
'created_at'
=>
$now
];
if
(
count
(
$taskData
)
==
$batch
||
$
doubleTotal
==
$batch
||
$tempi
==
$doubleT
otal
){
if
(
count
(
$taskData
)
==
$batch
||
$
total
==
$batch
||
$tempi
==
$t
otal
){
if
(
!
empty
(
$taskData
)){
StrategyTask
::
insert
(
$taskData
);
$taskData
=
[];
...
...
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