request->param();
        return json(["code" => 200, "obj" => VerifyApi::getPublicList($params)]);
    }
    public function common_check() {
        $request = $this->request;
        $params = $request->param();
        $id = $params["id"];
        $info = VerifyApi::getTalentInfoById($id);
        if ($info["checkState"] == 2) {
            return view("talentInfo_base_check", ["info" => $info]);
        } else {
            return view("talentInfo_common_check", ["info" => $info]);
        }
    }
    public function cancel_verify() {
        $params = $this->request->param();
        $ids = $params["ids"];
        $msg = $params["msg"];
        if ($msg == "") {
            return json(["msg" => "请填写审核不通过的原因"]);
        }
        $ids_arr = array_filter(explode(",", $ids));
        $counts = 0;
        foreach ($ids_arr as $id) {
            $ti = VerifyApi::getOne($id);
            $data["id"] = $id;
            if ($ti["checkState"] == TalentState::FST_SUBMIT) {
                $data["checkState"] = TalentState::BASE_VERIFY_FAIL;
                TalentLogApi::write(1, $id, TalentState::BASE_VERIFY_FAIL, $msg, 1);
                TalentModel::update($data);
                $counts++;
            } else if ($ti["checkState"] == TalentState::SCND_SAVE) {
                $data["checkState"] = TalentState::FST_VERIFY_FAIL;
                TalentLogApi::write(1, $id, TalentState::FST_VERIFY_FAIL, $msg, 1);
                TalentModel::update($data);
                $counts++;
            } else {
                return json(["msg" => "不在审核范围"]);
            }
        }
        return json(["code" => 200, sprintf("%d个申请已审核失败", $counts)]);
    }
    public function base_verify() {
        return view();
    }
    public function base_verify_list() {
        $request = $this->request;
        return json(VerifyApi::getList($request));
    }
    /**
     * 部门初审
     * @auth {{/talentInfo/gotoIndex/-1}}
     */
    public function dept_fst_verify() {
        return view();
    }
    /**
     * 初审
     * @auth {{/talentInfo/gotoIndex/1}}
     */
    public function fst_verify() {
        return view();
    }
    /**
     * 初审-审核
     * @auth {{/talentInfo/firstCheck}}
     */
    public function fst_check() {
        
    }
    /**
     * 初审-修改驳回字段
     * @auth {{/talentInfo/updateFieldsAndFiles}}
     */
    public function updateFieldsAndFiles() {
        
    }
    /**
     * 初审-审核不通过
     * @auth {{/talentInfo/setNotPass}}
     */
    public function dis_pass() {
        
    }
    /**
     * 部门审核
     * @auth {{/talentInfo/gotoIndex/2}}
     */
    public function dept_verify() {
        return view();
    }
    /**
     * 复审
     * @auth {{/talentInfo/gotoIndex/3}}
     */
    public function re_verify() {
        return view();
    }
    /**
     * 复审-撤销复核
     * @auth {{/talentInfo/cancleThirdCheck}}
     */
    public function cancel_check() {
        
    }
    /**
     * 预备人才库
     * @auth {{/talentInfo/gotoIndex/4}}
     */
    public function pre_list() {
        return view();
    }
    /**
     * 预备人才库-公示
     * @auth {{/talentInfo/preparePublic}}
     */
    public function pre_public() {
        
    }
    /**
     * 预备人才库-核查征信
     * @auth {{/talentInfo/prepareHczx}}
     */
    public function pre_hczx() {
        
    }
    /**
     * 预备人才库-征信通过
     * @auth {{/talentInfo/hczxPass}}
     */
    public function hczxPass() {
        $params = $this->request->param();
        $ids = $params["ids"];
        $ids = array_filter(explode(",", $ids));
        $msg = "征信通过";
        $state = 2; //征信核查
        $pass = true;
        $total = count($ids);
        $error = 0;
        $success = 0;
        foreach ($ids as $id) {
            $talent_info = VerifyApi::getOne($id);
            if ($talent_info["isPublic"] != 1 || $talent_info["checkState"] != TalentState::REVERIFY_PASS) {
                $error++;
                continue;
            }
            if (VerifyApi::setPublic($id, $state, $pass, $msg)) {
                $success++;
            } else {
                $error++;
            }
        }
        return json(["code" => 200, "msg" => sprintf("核查征信成功:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
    }
    /**
     * 预备人才库-征信失信
     * @auth {{/talentInfo/hczxReject}}
     */
    public function hczxReject() {
        $params = $this->request->param();
        $id = $params["id"];
        $msg = "征信失信:" . $params["outMsg"];
        $state = 2; //征信核查
        $pass = false;
        $talent_info = VerifyApi::getOne($id);
        if ($talent_info["isPublic"] != 1 || $talent_info["checkState"] != TalentState::REVERIFY_PASS) {
            return json(["msg" => "当前记录不是待核查征信状态,无法核查"]);
        }
        VerifyApi::setPublic($id, $state, $pass, $msg);
        return json(["code" => 200, "msg" => "已设置征信失信"]);
    }
    public function exportPublic() {
        $params = $this->request->param();
        $ids_arr = array_filter(explode(",", $params["ids"]));
        $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
        if ($ids_arr) {
            $where[] = ["id", "in", $ids_arr];
            $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
            $rows = [];
            $i = 1;
            $talentArranges = DictApi::selectByParentCode("talent_arrange");
            foreach ($list as $item) {
                $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
                $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
                $row = [
                    $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == 11 ? "审核通过" : "审核不通过", $enterprise["description"]
                ];
                $rows[] = $row;
                $i++;
            }
        }
        if ($rows) {
            $filename = "优秀人才公示预览导出";
            export($columns, $rows, $filename);
        }
    }
    /**
     * 预备人才库-公示再审核
     * @auth {{/talentInfo/prepareCheck}}
     */
    public function pre_check() {
        
    }
    /**
     * 预备人才库-公布
     * @auth {{/talentInfo/preparePublish}}
     */
    public function pre_publish() {
        
    }
    /**
     * 预备人才库-发证
     * @auth {{/talentInfo/prepareCertification}}
     */
    public function pre_certification() {
        
    }
    /**
     * 预备人才库-撤销公布
     * @auth {{/talentInfo/prepareCanclePublish}}
     */
    public function pre_cancel_publish() {
        
    }
    /**
     * 预备人才库-公示预览
     * @auth {{/talentInfo/publicExportBefore}}
     */
    public function pre_public_preview() {
        
    }
    /**
     * 预备人才库-公布预览
     * @auth {{/talentInfo/publishExportBefore}}
     */
    public function pre_publish_preview() {
        
    }
    /**
     * 基本条件审核-提交未保存
     * @param \think\Request $request
     * @param type $talent_info
     * @return type json
     */
    private function baseCheck(\think\Request $request, $talent_info) {
        $params = $request->param();
        if ($params["checkState"] == 3) {
            //审核成功
            $log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //初审成功
        } else {
            //审核驳回并记录需要修改的字段和上传文件
            $checkState = TalentState::FST_SAVE; //退回提交材料阶段
            $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
        }
        $log = TalentLogApi::getLastLog($talent_info["id"], 1);
        if (!$log)
            return json(["msg" => "日志数据异常,保存失败"]);
        if ($log["active"] == 0) {
            TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        } else {
            TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        }
        $data["id"] = $talent_info["id"];
        $data["modify_files"] = $params["files"];
        $data["modify_fields"] = $params["fields"];
        TalentModel::update($data);
        return json(["code" => 200, "msg" => "保存成功"]);
    }
    /**
     * 基本条件审核-提交审核
     * @param type $talent_info
     * @return type json
     */
    private function baseSubmitCheck($talent_info) {
        return $this->commonSubmitCheck($talent_info, 1);
    }
    /**
     * 初审-提交未保存
     * @param \think\Request $request
     * @param type $talent_info
     * @return type json
     */
    private function fstCheck(\think\Request $request, $talent_info) {
        $params = $request->param();
        if ($params["checkState"] == 3) {
            //审核成功,并取消设置越过部门并审
            $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
            $data["pass_dept_check"] = 0;
        } else if ($params["checkState"] == 4) {
            //审核成功,并设置越过部门并审。附加条件:最高进度曾经超过初审2(包含初审,因为再次初审也就证明从上面驳回过,这步是防止前端改checkState=4进来)
            $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
            $data["pass_dept_check"] = $talent_info["highProcess"] >= 2 ? 1 : 0;
        } else {
            //审核驳回并记录需要修改的字段和上传文件
            $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
            $log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
        }
        $log = TalentLogApi::getLastLog($talent_info["id"], 1);
        if (!$log)
            return json(["msg" => "日志数据异常,保存失败"]);
        if ($log["active"] == 0) {
            TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        } else {
            TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        }
        $data["id"] = $talent_info["id"];
        $data["modify_files"] = $params["files"];
        $data["modify_fields"] = $params["fields"];
        TalentModel::update($data);
        return json(["code" => 200, "msg" => "保存成功"]);
    }
    /**
     * 初审-提交审核
     * @param type $talent_info
     * @return type json
     */
    private function fstSubmitCheck($talent_info) {
        $nowProcess = 2;
        $log = TalentLogApi::getLastLog($talent_info["id"], 1);
        if (!$log || $log["active"] == 1)
            return json(["msg" => "日志数据异常,审核失败"]);
        if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
            $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
        }
        if ($log["new_state"] == TalentState::FST_VERIFY_PASS && $talent_info["pass_dept_check"] == 0) {
            $data["first_dept_check_time"] = date("Y-m-d H:i:s");
            $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
            $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
            //这边去除已经审核通过的单位,主要通过日志是否存在记录。
            $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
            $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
            TalentLogApi::writeDeptLogs($talent_info["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
        }
        $data["id"] = $talent_info["id"];
        $data["checkState"] = $log["new_state"];
        TalentModel::update($data);
        TalentLogApi::setActive($log["id"], 1);
        return json(["code" => 200, "msg" => "审核成功"]);
    }
    /**
     * 部门审核-提交未保存
     * @param \think\Request $request
     * @param type $talent_info
     * @return type json
     */
    private function deptCheck(\think\Request $request, $talent_info, $companys) {
        if ($talent_info["pass_dept_check"] == 1)
            return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
        if (!in_array($this->user["companyId"], $companys))
            return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
        if (in_array($this->user["companyId"], $pass_companyIds))
            return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
        $params = $request->param();
        if ($params["checkState"] == 3) {
            //审核成功
            $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
            $checkState = TalentState::DEPT_VERIFY_PASS; //审核成功
        } else {
            //审核驳回并记录需要修改的字段和上传文件
            $checkState = TalentState::SCND_SUBMIT; //退回待初审
            $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
        }
        $fst_dept_check_time = $talent_info["first_dept_check_time"];
        $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $fst_dept_check_time);
        if (!$dept_log)
            return json(["msg" => "未匹配日志,审核失败"]);
        if ($dept_log["active"] == 1)
            return json(["msg" => "您的部门已经审核过了"]);
        $data["id"] = $talent_info["id"];
        $data["modify_files"] = $params["files"];
        $data["modify_fields"] = $params["fields"];
        TalentModel::update($data);
        //修改日志
        TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        return json(["code" => 200, "msg" => "保存成功"]);
    }
    /**
     * 部门审核-提交审核
     * @param type $talent_info
     * @return type json
     */
    private function deptSubmitCheck($talent_info, $companys) {
        if ($talent_info["pass_dept_check"] == 1)
            return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
        if (!in_array($this->user["companyId"], $companys))
            return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
        if (in_array($this->user["companyId"], $pass_companyIds))
            return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
        $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
        $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
        $error = 0; //失败数
        $nowProcess = 3;
        if (!$dept_log)
            return json(["msg" => "未匹配日志,审核失败"]);
        if ($dept_log["active"] == 1)
            return json(["msg" => "您的部门已经审核过了"]);
        $over++;
        if ($dept_log["new_state"] == TalentState::SCND_SUBMIT) {
            $error++;
        }
        $logs = TalentLogApi::getListLogByTime($talent_info["id"], $talent_info["first_dept_check_time"]);
        for ($i = 0; $i < count($logs); $i++) {
            $over += $logs[$i]["active"] == 1 ? 1 : 0;
            if ($logs[$i]["new_state"] == TalentState::SCND_SUBMIT) {
                $error++;
            }
        }
        if ($over == count($companys)) {
            //全部已审核
            $checkState = TalentState::SCND_SUBMIT;
            $log_checkState = TalentState::DEPT_VERIFY_REJECT;
            if ($error == 0) {
                $log_checkState = $checkState = TalentState::DEPT_VERIFY_PASS;
                $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
            }
            $data["id"] = $talent_info["id"];
            $data["checkState"] = $checkState;
            $data["first_dept_check_time"] = null;
            TalentModel::update($data);
            TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], "部门审核结束", 1);
        }
        TalentLogApi::setActive($dept_log["id"], 1);
        return json(["code" => 200, "msg" => "审核成功"]);
    }
    /**
     * 复审-提交未保存
     * @param \think\Request $request
     * @param type $talent_info
     * @param type json
     */
    private function reCheck(\think\Request $request, $talent_info) {
        $params = $request->param();
        if ($params["checkState"] == 3) {
            //审核成功
            $log_checkState = $checkState = TalentState::REVERIFY_PASS; //复核成功
        } else if ($params["checkState"] == 2) {
            //审核驳回并记录需要修改的字段和上传文件
            $checkState = TalentState::SCND_SUBMIT; //退回待初审
            $log_checkState = TalentState::REVERIFY_REJECT; //日志记录拒绝状态
        } else {
            $log_checkState = $checkState = TalentState::REVERIFY_FAIL; //审核失败
        }
        $log = TalentLogApi::getLastLog($talent_info["id"], 1);
        if (!$log)
            return json(["msg" => "日志数据异常,保存失败"]);
        if ($log["active"] == 0) {
            TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        } else {
            TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
        }
        $data["id"] = $talent_info["id"];
        $data["modify_files"] = $params["files"];
        $data["modify_fields"] = $params["fields"];
        TalentModel::update($data);
        return json(["code" => 200, "msg" => "保存成功"]);
    }
    /**
     * 复审-提交审核
     * @param type $talent_info
     * @return type json
     */
    private function reSubmitCheck($talent_info) {
        return $this->commonSubmitCheck($talent_info, 4);
    }
    private function commonSubmitCheck($talent_info, $nowProcess) {
        $log = TalentLogApi::getLastLog($talent_info["id"], 1);
        if (!$log || $log["active"] == 1)
            return json(["msg" => "日志数据异常,审核失败"]);
        if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
            $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
        }
        $data["id"] = $talent_info["id"];
        $data["checkState"] = $log["new_state"];
        TalentModel::update($data);
        TalentLogApi::setActive($log["id"], 1);
        return json(["code" => 200, "msg" => "审核成功"]);
    }
    public function check() {
        //公共调度方法
        $request = $this->request;
        $params = $request->param();
        $check = $params["checkState"];
        $check_msg = trim($params["checkMsg"]);
        $files = $params["files"];
        $fields = $params["fields"];
        $id = $params["id"];
        $talent_info = VerifyApi::getOne($id);
        $checkState = $talent_info["checkState"];
        if (!$talent_info) {
            return json(["msg" => "数据错误"]);
        }
        if (!$check) {
            return json(["msg" => "请选择审核状态"]);
        }
        if (!$check_msg) {
            return json(["msg" => "请填写审核说明"]);
        }
        if ($checkState == TalentState::FST_SUBMIT) {
            return $this->baseCheck($request, $talent_info);
        } else if ($checkState == TalentState::SCND_SUBMIT) {
            return $this->fstCheck($request, $talent_info);
        } else if ($checkState == TalentState::FST_VERIFY_PASS) {
            $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
            $companys = array_filter(explode(",", $condition["companyIds"]));
            if ($companys && $talent_info["pass_dept_check"] != 1) {
                if (!in_array($this->user["companyId"], $companys))
                    return json(["msg" => "你的部门不在并审部门列表"]);
                return $this->deptCheck($request, $talent_info, $companys);
            } else {
                return $this->reCheck($request, $talent_info);
            }
        } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
            return $this->reCheck($request, $talent_info);
        } else {
            return json(["msg" => "不在审核范围内,保存失败"]);
        }
    }
    public function submitCheck() {
        //公共调度方法
        $id = $this->request->param("id");
        $talent_info = VerifyApi::getOne($id);
        $checkState = $talent_info["checkState"];
        if (!$talent_info) {
            return json(["msg" => "数据错误"]);
        }
        if ($checkState == TalentState::FST_SUBMIT) {
            return $this->baseSubmitCheck($talent_info);
        } else if ($checkState == TalentState::SCND_SUBMIT) {
            return $this->fstSubmitCheck($talent_info);
        } else if ($checkState == TalentState::FST_VERIFY_PASS) {
            $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
            $companys = array_filter(explode(",", $condition["companyIds"]));
            if ($companys && $talent_info["pass_dept_check"] != 1) {
                if (!in_array($this->user["companyId"], $companys))
                    return json(["msg" => "你的部门不在并审部门列表"]);
                return $this->deptSubmitCheck($talent_info, $companys);
            } else {
                return $this->reSubmitCheck($talent_info);
            }
        } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
            return $this->reSubmitCheck($talent_info);
        } else {
            return json(["msg" => "不在审核范围内,审核失败"]);
        }
    }
    public function validateIsCheck() {
        $params = $this->request->param();
        $id = $params["id"];
        $talent_info = VerifyApi::getOne($id);
        if ($talent_info) {
            $checkState = $talent_info["checkState"];
            // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
            $process = 0;
            if (in_array($checkState, [2, 6, 7, 9])) {
                switch ($checkState) {
                    case 2:
                        $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
                        $fields = DictApi::getTalentFields(1);
                        $field_tmp = [];
                        foreach ($fields as $key => $field) {
                            $field_tmp[] = ["key" => $key, "value" => $field];
                        }
                        $where[] = ["project", "=", 1];
                        $where[] = ["step", "=", 1];
                        $where[] = ["active", "=", 1];
                        $where[] = ["type", "=", $enterprise["type"]];
                        $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
                        $process = 1;
                        break;
                    case 6:
                        $process = 2;
                        break;
                    case 7:
                        $tc = TalentConditionApi::getOne($talent_info["talent_condition"]);
                        if ($tc["companyId"] && $talent_info["pass_dept_check"] != 1) {
                            $process = 3;
                        } else {
                            $process = 4;
                        }
                        $fields = DictApi::getTalentFields(3);
                        break;
                    case 9:
                        $fields = DictApi::getTalentFields(3);
                        $process = 4;
                        break;
                }
                if ($checkState != 2) {
                    $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
                    $fields = DictApi::getTalentFields(2);
                    $field_tmp = [];
                    foreach ($fields as $key => $field) {
                        $field_tmp[] = ["key" => $key, "value" => $field];
                    }
                    $where = [];
                    $whr = [];
                    $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
                    $where[] = ["project", "=", 1];
                    $where[] = ["step", "=", 2];
                    $where[] = ["active", "=", 1];
                    $where[] = ["type", "=", $enterprise["type"]];
                    if ($condition && $condition["bindFileTypes"]) {
                        $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
                        $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->select();
                    } else {
                        $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
                    }
                }
                $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
                $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
                return json(["code" => 200, "obj" => ["process" => $process, "talentInfo" => $talent_info, "fieldList" => $field_tmp, "fileList" => $files]]);
            } else {
                return json(["msg" => "该申报不在审核范围内,无法审核"]);
            }
        }
    }
    public function findFieldsAndFiles() {
        
    }
    public function exportHczx() {
        $ids = $this->request->param("ids");
        $ids_arr = array_filter(explode(",", $ids));
        if (!$ids_arr) {
            $res = ["code" => 500, "msg" => "没有选择导出的名单"];
            echo sprintf("", json_encode($res));
        }
        $where[] = ["ti.id", "in", $ids_arr];
        $list = TalentModel::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")->field("ti.name,ti.card_type,ti.card_number,e.name as enterpriseName,e.description")->where($where)->select();
        if (!$list) {
            $res = ["code" => 500, "msg" => "没有可以导出的内容"];
            echo sprintf("", json_encode($res));
        }
        $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
        $rows = [];
        $i = 1;
        $card_types = DictApi::selectByParentCode("card_type");
        foreach ($list as $item) {
            $row = [
                $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
            ];
            $rows[] = $row;
            $i++;
        }
        $filename = "优秀人才核查征信名单导出";
        export($columns, $rows, $filename);
    }
    public function commonExport() {
        $params = $this->request->param();
        $fields = $params["export"];
        if (!$fields)
            return json(["msg" => "请选择要导出的数据"]);
        $names = DictApi::getTalentFields(3);
        $names["industryFieldNew"] = "产业领域";
        $names["enterpriseName"] = "单位名称";
        $names["enterpriseTag"] = "单位标签";
        $names["street"] = "所属镇街";
        $names["checkState"] = "审核状态";
        $list = VerifyApi::getExportDatas($fields);
        foreach ($fields as $field) {
            $columns[] = $names[$field];
        }
        $datas = [];
        for ($i = 0; $i < count($list); $i++) {
            $data = [];
            for ($n = 0; $n < count($fields); $n++) {
                $data[] = $list[$i][$fields[$n]];
            }
            $datas[] = $data;
        }
        if ($datas) {
            export($columns, $datas);
        }
    }
    public function getPhones() {
        $list = VerifyApi::getListByProcess($this->request->param("process"));
        $result = [];
        if ($list) {
            foreach ($list as $item) {
                if ($item["phone"] && $item["name"]) {
                    $result[] = sprintf("%s:%s", $item["name"], $item["phone"]);
                }
            }
        }
        return json(["code" => 200, "obj" => implode(";", $result)]);
    }
    public function getEnterprisePhones() {
        $list = VerifyApi::getListByProcess($this->request->param("process"));
        $result = [];
        if ($list) {
            foreach ($list as $item) {
                if ($item["agentName"] && $item["agentPhone"]) {
                    $result[] = sprintf("%s:%s", $item["agentName"], $item["agentPhone"]);
                }
            }
        }
        return json(["code" => 200, "obj" => implode(";", $result)]);
    }
}