setName('DeptVerifyChecker') ->setDescription('Dept Verify Checker'); } protected function execute(Input $input, Output $output) { /* $where[] = ["e.type", "=", 1]; $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS]; $where[] = ["ti.pass_dept_check", "=", 0]; $jjrc_list = Talent::alias("ti") ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition") ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id") ->leftJoin("(select description,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)->column("companyIds"); */ $where[] = ["type", "=", ProjectState::TALENT]; $where[] = ["step", "=", 3]; $where[] = ["active", "=", 0]; $jjrc_list = TalentChecklog::where($where)->column("companyId"); $jjrc_counts = []; for ($i = 0; $i < count($jjrc_list); $i++) { $jjrc_counts[$jjrc_list[$i]] += 1; } $codes = ["talentInfo_dep"]; $menuIds = MenuApi::getMenuIdsByCodes($codes); $where = []; $where[] = ["menuid", "in", $menuIds]; $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid"); foreach ($jjrc_counts as $companyId => $count) { $where = []; $where[] = ["type", "=", 1]; $where[] = ["status", "=", 1]; $where[] = ["roleid", "<>", 1]; $where[] = ["companyId", "=", $companyId]; $regstr = ",(" . implode("|", $roleIds) . "),"; $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'"; $users = User::where($where)->whereRaw($whereRaw)->select()->toArray(); foreach ($users as $user) { if ($user["phone"]) { queue("app\job\Messenger", ["type" => 3, "userId" => $user["id"], "name" => $user["name"], "phone" => $user["phone"], "count" => $count]); } } } } }