SignController.php 812 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace console\controllers;
  3. use yii\console\ExitCode;
  4. use yii\console\Controller;
  5. use addons\SignIn\common\login\SignInReward;
  6. class SignController extends Controller
  7. {
  8. /**
  9. * 清除累计签到天数
  10. *
  11. * @author hpei
  12. * 0 0 0 * * *
  13. */
  14. public function actionCleanTotalSignIn() {
  15. try {
  16. $object = new SignInReward();
  17. $result = $object->cleanTotalSignIn();
  18. if($result === true) {
  19. echo 'success';
  20. return ExitCode::OK;
  21. }
  22. } catch (\Exception $e) {
  23. echo '定时任务清除累计签到天数' . $e->getMessage();
  24. $this->stderr('Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
  25. return ExitCode::UNSPECIFIED_ERROR;
  26. }
  27. }
  28. }