File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 55use Yii ;
66use yii \base \Behavior ;
77use yii \console \Controller ;
8+ use yii \helpers \ArrayHelper ;
89use yii2mod \cron \models \CronScheduleModel ;
910use yii2mod \cron \models \enumerables \CronScheduleStatus ;
1011
@@ -69,7 +70,7 @@ public function beforeAction($event)
6970 {
7071 if (in_array ($ event ->action ->id , $ this ->actions ) || in_array ('* ' , $ this ->actions )) {
7172 $ sender = $ event ->sender ;
72- $ command = $ sender ->id . '/ ' . $ sender ->action ->id ;
73+ $ command = $ sender ->id . '/ ' . $ sender ->action ->id . $ this -> getActionParams () ;
7374 $ this ->schedule = new CronScheduleModel ();
7475 $ this ->schedule ->startCronSchedule ($ command );
7576 $ this ->setupApplicationErrorHandlers ();
@@ -101,4 +102,26 @@ protected function setupApplicationErrorHandlers()
101102 $ errorHandler = Yii::$ app ->get ('errorHandler ' );
102103 $ errorHandler ->schedule = &$ this ->schedule ;
103104 }
104- }
105+
106+ /**
107+ * Get action params
108+ *
109+ * @return string
110+ */
111+ private function getActionParams ()
112+ {
113+ $ result = '' ;
114+ $ requestParams = Yii::$ app ->request ->getParams ();
115+ ArrayHelper::remove ($ requestParams , 0 );
116+
117+ foreach ($ requestParams as $ key => $ value ) {
118+ if (is_string ($ key )) {
119+ $ result .= " -- {$ key }= {$ value }" ;
120+ } else {
121+ $ result .= " {$ value }" ;
122+ }
123+ }
124+
125+ return $ result ;
126+ }
127+ }
You can’t perform that action at this time.
0 commit comments