12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare (strict_types=1);
- namespace app\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Argument;
- use think\console\input\Option;
- use think\console\Output;
- use think\facade\Db;
- use think\facade\Log;
- use app\enterprise\model\Talent;
- use app\common\api\TalentState;
- use app\common\api\MenuApi;
- use app\admin\model\SysRelation;
- use app\admin\model\User;
- /**
- * 人才认定过期检测
- */
- class ExpireVerifyChecker extends Command {
- protected function configure() {
- // 指令配置
- $this->setName('ExpireVerifyChecker')
- ->setDescription('Expire Verify Checker');
- }
- protected function execute(Input $input, Output $output) {
- $where = [];
- $where[] = ["active", "=", 1];
- $where[] = ["type", "=", \app\common\state\ProjectState::TALENT];
- $whereRaw = sprintf("submitEndTime is not null and submitEndTime<>'' and submitEndTime < '%s'", date("Y-m-d H:i:s"));
- $batchs = \app\common\model\Batch::where($where)->whereRaw($whereRaw)->select();
- if ($batchs) {
- unset($where);
- //存在激活的批次,并且有设置提交截止时间,且已经超过截止时间,则检查此批次的申报是否存在驳回或者尚在保存未提交状态
- foreach ($batchs as $batch) {
- $where[] = ["e.type", "=", $batch["source"]];
- $where[] = ["ti.checkState", "=", TalentState::SCND_SAVE];
- $where[] = ["apply_year", "in", $batch["batch"]];
- $list = Talent::alias("ti")
- ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
- ->field("ti.*,e.type as enterpriseType")
- ->where($where)->select();
- foreach ($list as $ti) {
- queue("app\job\Talent", ["type" => 2, "talentInfo" => $ti]);
- }
- }
- }
- }
- }
|