ExpireVerifyChecker.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\command;
  4. use think\console\Command;
  5. use think\console\Input;
  6. use think\console\input\Argument;
  7. use think\console\input\Option;
  8. use think\console\Output;
  9. use think\facade\Db;
  10. use think\facade\Log;
  11. use app\enterprise\model\Talent;
  12. use app\common\api\TalentState;
  13. use app\common\api\MenuApi;
  14. use app\admin\model\SysRelation;
  15. use app\admin\model\User;
  16. /**
  17. * 人才认定过期检测
  18. */
  19. class ExpireVerifyChecker extends Command {
  20. protected function configure() {
  21. // 指令配置
  22. $this->setName('ExpireVerifyChecker')
  23. ->setDescription('Expire Verify Checker');
  24. }
  25. protected function execute(Input $input, Output $output) {
  26. $where = [];
  27. $where[] = ["active", "=", 1];
  28. $where[] = ["type", "=", \app\common\state\ProjectState::TALENT];
  29. $whereRaw = sprintf("submitEndTime is not null and submitEndTime<>'' and submitEndTime < '%s'", date("Y-m-d H:i:s"));
  30. $batchs = \app\common\model\Batch::where($where)->whereRaw($whereRaw)->select();
  31. if ($batchs) {
  32. unset($where);
  33. //存在激活的批次,并且有设置提交截止时间,且已经超过截止时间,则检查此批次的申报是否存在驳回或者尚在保存未提交状态
  34. foreach ($batchs as $batch) {
  35. $where[] = ["e.type", "=", $batch["source"]];
  36. $where[] = ["ti.checkState", "=", TalentState::SCND_SAVE];
  37. $where[] = ["apply_year", "in", $batch["batch"]];
  38. $list = Talent::alias("ti")
  39. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  40. ->field("ti.*,e.type as enterpriseType")
  41. ->where($where)->select();
  42. foreach ($list as $ti) {
  43. queue("app\job\Talent", ["type" => 2, "talentInfo" => $ti]);
  44. }
  45. }
  46. }
  47. }
  48. }