WorkerScript.php 592 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace backend\models;
  3. /**
  4. * worker
  5. * Class WorkerScript
  6. * @package backend\models
  7. */
  8. class WorkerScript extends \yii\db\ActiveRecord
  9. {
  10. const STATUS_RUN = 1;
  11. const STATUS_STOP = 0;
  12. /**
  13. * @inheritdoc
  14. */
  15. public static function tableName()
  16. {
  17. return '{{%worker_script}}';
  18. }
  19. /**
  20. * [所有需要运行的脚本]
  21. * @author: libingke
  22. * @return array|\yii\db\ActiveRecord[]
  23. */
  24. public static function getRunScriptList()
  25. {
  26. $data = self::find()
  27. ->where(['status' => static::STATUS_RUN])
  28. ->asArray()->all();
  29. return $data;
  30. }
  31. }