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
e874dbcf
Commit
e874dbcf
authored
May 18, 2020
by
yinxiaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务数据定时任务
parent
b6d91f61
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
6 deletions
+70
-6
CreatedTaskCommand.php
app/Console/Commands/CreatedTaskCommand.php
+8
-2
CreatedTaskDataCommand.php
app/Console/Commands/CreatedTaskDataCommand.php
+54
-0
Kernel.php
app/Console/Kernel.php
+5
-2
StrategySetController.php
app/Http/Controllers/strategy/StrategySetController.php
+2
-1
DatabaseSeeder.php
database/seeds/DatabaseSeeder.php
+1
-1
No files found.
app/Console/Commands/CreatedTaskCommand.php
View file @
e874dbcf
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Console\Commands
;
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
use
Illuminate\Console\Command
;
use
App\Models\StrategyTask
;
class
CreatedTaskCommand
extends
Command
class
CreatedTaskCommand
extends
Command
{
{
...
@@ -18,7 +19,7 @@ class CreatedTaskCommand extends Command
...
@@ -18,7 +19,7 @@ class CreatedTaskCommand extends Command
*
*
* @var string
* @var string
*/
*/
protected
$description
=
'每
月1号
创建任务'
;
protected
$description
=
'每
天早上6点
创建任务'
;
/**
/**
* Create a new command instance.
* Create a new command instance.
...
@@ -37,6 +38,11 @@ class CreatedTaskCommand extends Command
...
@@ -37,6 +38,11 @@ class CreatedTaskCommand extends Command
*/
*/
public
function
handle
()
public
function
handle
()
{
{
//
//新建任务、失败原任务重呼3次,接口调用失败重试3次
$taskInfo
=
StrategyTask
::
where
(
'is_created'
,
0
)
->
get
()
->
toArray
();
//获取需要新建任务的数据
//dd($taskInfo);
foreach
(
$taskInfo
as
$k
=>
$v
){
//批量调用接口新建任务
}
}
}
}
}
app/Console/Commands/CreatedTaskDataCommand.php
0 → 100644
View file @
e874dbcf
<?php
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
//use App\Service\StrategyService;
use
App\Models\StrategySet
;
use
App\Jobs\StrategyTaskJob
;
class
CreatedTaskDataCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'command:CreatedTaskDataCommand'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'每月1号4点创建任务数据'
;
/**
* Create a new command instance.
*
* @return void
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
$setInfo
=
StrategySet
::
where
([[
'disabled'
,
0
]])
->
get
(
'strategy_sn'
)
->
toArray
();
if
(
!
empty
(
$setInfo
)){
//$StrategyService = new StrategyService();
foreach
(
$setInfo
as
$k
=>
$v
){
//$StrategyService->createTaskDataJob($v['strategy_sn']);
$jobParams
=
[
'strategySn'
=>
$v
[
'strategy_sn'
]];
$job
=
(
new
StrategyTaskJob
(
$jobParams
))
->
onQueue
(
'StrategyTask'
);
dispatch
(
$job
);
}
}
}
}
app/Console/Kernel.php
View file @
e874dbcf
...
@@ -13,7 +13,8 @@ class Kernel extends ConsoleKernel
...
@@ -13,7 +13,8 @@ class Kernel extends ConsoleKernel
* @var array
* @var array
*/
*/
protected
$commands
=
[
protected
$commands
=
[
Commands\CreatedTaskCommand
::
class
,
//流程录音上传ftp服务器
Commands\CreatedTaskCommand
::
class
,
//创建任务
Commands\CreatedTaskDataCommand
::
class
,
//创建任务数据
];
];
/**
/**
...
@@ -26,7 +27,9 @@ class Kernel extends ConsoleKernel
...
@@ -26,7 +27,9 @@ class Kernel extends ConsoleKernel
{
{
// $schedule->command('inspire')
// $schedule->command('inspire')
// ->hourly();
// ->hourly();
$schedule
->
command
(
"command:CreatedTaskCommand"
)
->
cron
(
'1 6 * * *'
);
$schedule
->
command
(
"command:CreatedTaskCommand"
)
->
cron
(
'0 6 * * *'
);
//每天6点执行,注意与command:CreatedTaskDataCommand 的前后关系
$schedule
->
command
(
"command:CreatedTaskDataCommand"
)
->
cron
(
'0 4 1 * *'
);
//每月1号5点执行
}
}
/**
/**
...
...
app/Http/Controllers/strategy/StrategySetController.php
View file @
e874dbcf
...
@@ -100,7 +100,8 @@ class StrategySetController extends Controller
...
@@ -100,7 +100,8 @@ class StrategySetController extends Controller
// 删除逻辑 注意多表关联的情况
// 删除逻辑 注意多表关联的情况
StrategySet
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
StrategySet
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
StrategyExcel
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
StrategyExcel
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
StrategyTask
::
where
(
'strategy_sn'
,
$strategySn
)
->
delete
();
//StrategyTask::where('strategy_sn', $strategySn)->delete();
StrategyTask
::
where
([[
'strategy_sn'
,
$strategySn
],[
'is_created'
,
0
]])
->
delete
();
//删除未新建的任务数据
});
});
return
$this
->
successWithInfo
(
'操作完成'
);
return
$this
->
successWithInfo
(
'操作完成'
);
}
}
...
...
database/seeds/DatabaseSeeder.php
View file @
e874dbcf
...
@@ -29,7 +29,7 @@ class DatabaseSeeder extends Seeder
...
@@ -29,7 +29,7 @@ class DatabaseSeeder extends Seeder
$table
->
unsignedSmallInteger
(
'day_type'
)
->
default
(
0
)
->
comment
(
'外呼日期类型 0每天 1日期前一天和当天'
);
$table
->
unsignedSmallInteger
(
'day_type'
)
->
default
(
0
)
->
comment
(
'外呼日期类型 0每天 1日期前一天和当天'
);
$table
->
unsignedSmallInteger
(
'frequency_type'
)
->
default
(
1
)
->
comment
(
'外呼频率类型 (1 一天一次 2 一天两次)'
);
$table
->
unsignedSmallInteger
(
'frequency_type'
)
->
default
(
1
)
->
comment
(
'外呼频率类型 (1 一天一次 2 一天两次)'
);
$table
->
char
(
'call_time_set'
,
50
)
->
comment
(
'呼叫设置时间点,两个用#号分割'
);
$table
->
char
(
'call_time_set'
,
50
)
->
comment
(
'呼叫设置时间点,两个用#号分割'
);
$table
->
unsignedSmallInteger
(
'disabled'
)
->
default
(
1
)
->
comment
(
'是否不可用 0启用 1停用'
);
$table
->
unsignedSmallInteger
(
'disabled'
)
->
default
(
0
)
->
comment
(
'是否不可用 0启用 1停用'
);
$table
->
integer
(
'total'
)
->
default
(
0
)
->
comment
(
'excel导入号码总数量'
);
$table
->
integer
(
'total'
)
->
default
(
0
)
->
comment
(
'excel导入号码总数量'
);
$table
->
integer
(
'latest_total'
)
->
default
(
0
)
->
comment
(
'最新一次导入excel号码数量'
);
$table
->
integer
(
'latest_total'
)
->
default
(
0
)
->
comment
(
'最新一次导入excel号码数量'
);
$table
->
timestamp
(
'updated_at'
)
->
nullable
()
->
comment
(
'更新时间'
);
$table
->
timestamp
(
'updated_at'
)
->
nullable
()
->
comment
(
'更新时间'
);
...
...
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