SiteController.php 827 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace console\controllers;
  3. use yii\console\ExitCode;
  4. use yii\console\Controller;
  5. use addons\SignIn\common\login\SignInReward;
  6. use console\services\SiteService;
  7. /**
  8. * 站点
  9. *
  10. * Class SiteController
  11. * @package console\controllers
  12. */
  13. class SiteController extends Controller
  14. {
  15. /**
  16. * 站点到期提醒
  17. *
  18. * @return string
  19. */
  20. public function actionDecomeDue()
  21. {
  22. try {
  23. $service = new SiteService();
  24. $service->expirationDetection();
  25. echo 'success';
  26. return ExitCode::OK;
  27. } catch (\Exception $e) {
  28. echo '定时任务到期提醒: ' . $e->getMessage();
  29. $this->stderr('Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
  30. return ExitCode::UNSPECIFIED_ERROR;
  31. }
  32. }
  33. }