BossWeightCrontabController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * BossWeight股东分红加权分红 定时任务
  4. */
  5. namespace addons\BossWeight\console\controllers;
  6. use addons\BossWeight\common\logic\CommissionLogLogic;
  7. use addons\BossWeight\common\logic\WeightRuleLogic;
  8. use yii\console\Controller;
  9. use yii\console\ExitCode;
  10. class BossWeightCrontabController extends Controller
  11. {
  12. /**
  13. * 自动发放股东分红佣金定时任务
  14. * 0 20 0 * * * *
  15. * @Author: lun
  16. * @DateTime: 2021/11/17 0017 20:38
  17. * @Copyright: copyright (c) 2021 广东七件事集团
  18. * @return int
  19. */
  20. public function actionSendCommission(){
  21. try {
  22. $logic = new CommissionLogLogic();
  23. $res = $logic->execute();
  24. if($res == true) {
  25. echo '操作成功';
  26. return ExitCode::OK;
  27. }
  28. } catch (\Exception $e) {
  29. echo $e->getMessage();
  30. $this->stderr('BossWeightCrontab Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
  31. return ExitCode::UNSPECIFIED_ERROR;
  32. }
  33. }
  34. /**
  35. * 股东加权分红状态每天更新定时任务
  36. * 0 20 0 * * * *
  37. * @Author: lun
  38. * @DateTime: 2021/11/17 0017 20:38
  39. * @Copyright: copyright (c) 2021 广东七件事集团
  40. * @return int
  41. */
  42. public function actionUpdateWeightRule(){
  43. try {
  44. $logic = new WeightRuleLogic();
  45. $res = $logic->execute();
  46. if($res == true) {
  47. echo '操作成功';
  48. return ExitCode::OK;
  49. }
  50. } catch (\Exception $e) {
  51. echo $e->getMessage();
  52. $this->stderr('BossWeightCrontab Error: ' . ExitCode::getReason(ExitCode::UNSPECIFIED_ERROR));
  53. return ExitCode::UNSPECIFIED_ERROR;
  54. }
  55. }
  56. }