setName('FstVerifyChecker') ->setDescription('First Verify Checker'); } protected function execute(Input $input, Output $output) { $where[] = ["e.type", "=", 1]; $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT]; $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]]; $jjrc_count = Talent::alias("ti") ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id") ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id") ->where($where)->count(); $where = []; $where[] = ["e.type", "=", 2]; $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT]; $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]]; $ic_count = Talent::alias("ti") ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id") ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id") ->where($where)->count(); $codes = ["talentInfo_first"]; $menuIds = MenuApi::getMenuIdsByCodes($codes); $where = []; $where[] = ["menuid", "in", $menuIds]; $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid"); $where = []; $where[] = ["status", "=", 1]; $where[] = ["roleid", "<>", 1]; $regstr = ",(" . implode("|", $roleIds) . "),"; $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'"; $users = User::where($where)->whereRaw($whereRaw)->select(); foreach ($users as $user) { switch ($user["type"]) { case 1: if ($jjrc_count > 0 && $user["phone"]) { queue("app\job\Messenger", ["type" => 2, "userId" => $user["id"], "name" => $user["name"], "phone" => $user["phone"], "count" => $jjrc_count]); } break; case 2: if ($ic_count > 0 && $user["phone"]) { queue("app\job\Messenger", ["type" => 2, "userId" => $user["id"], "name" => $user["name"], "phone" => $user["phone"], "count" => $ic_count]); } break; } } } }