Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
8ae404cb
Commit
8ae404cb
authored
Nov 04, 2016
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入计划任务
parent
6a527b67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
TaskController.php
src/console/controllers/TaskController.php
+19
-2
No files found.
src/console/controllers/TaskController.php
View file @
8ae404cb
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
namespace
console\controllers
;
namespace
console\controllers
;
use
Jobby\Jobby
;
use
Jobby\Jobby
;
use
Yii
;
use
yii\console\Controller
;
use
yii\console\Controller
;
class
TaskController
extends
Controller
class
TaskController
extends
Controller
...
@@ -17,11 +17,12 @@ class TaskController extends Controller
...
@@ -17,11 +17,12 @@ class TaskController extends Controller
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$jobby
=
new
Jobby
();
$jobby
=
new
Jobby
();
$yiiCommand
=
$_SERVER
[
'SCRIPT_FILENAME'
];
$output
=
Yii
::
getAlias
(
'@runtime'
)
.
"/logs/jobs-"
.
date
(
'Y-m-d'
)
.
".log"
;
if
(
YII_DEBUG
){
if
(
YII_DEBUG
){
$time
=
date
(
'Y-m-d H:i:s'
);
$time
=
date
(
'Y-m-d H:i:s'
);
$output
=
\Yii
::
getAlias
(
'@runtime'
)
.
"/logs/jobs-"
.
date
(
'Y-m-d'
)
.
".log"
;
$jobby
->
add
(
'CommandExample'
,
[
$jobby
->
add
(
'CommandExample'
,
[
// Run a shell commands
// Run a shell commands
'command'
=>
"echo
$time
"
,
'command'
=>
"echo
$time
"
,
...
@@ -39,6 +40,22 @@ class TaskController extends Controller
...
@@ -39,6 +40,22 @@ class TaskController extends Controller
]);
]);
}
}
//minute hour mday month wday [year]
$jobby
->
add
(
'WithdrawSettle'
,
[
'command'
=>
"
$yiiCommand
withdraw/settle"
,
'schedule'
=>
'30 8 * * 1-5'
,
//每周一到周五上午8:30
'output'
=>
$output
,
'enabled'
=>
true
]);
$jobby
->
add
(
'ClearUploadPool'
,
[
'command'
=>
"
$yiiCommand
maintain/clear-upload-pool"
,
'schedule'
=>
'15 */2 * * *'
,
//每隔两小时的第15分钟
'output'
=>
$output
,
'enabled'
=>
true
]);
$jobby
->
run
();
$jobby
->
run
();
}
}
...
...
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