| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 | <?phpnamespace app\enterprise\controller;use app\admin\model\Enterprise;use app\enterprise\common\EnterpriseController;use app\common\api\DictApi;use app\common\state\CommonConst;/** * Description of Index * * @author sgq */class Index extends EnterpriseController {    public function index() {        $vars["user"] = [            "name" => $this->user["name"],            "rolename" => $this->user["rolename"],            "avatar" => $this->user["avatar"]        ];        $ep = \app\common\api\EnterpriseApi::getOne($this->user["uid"]);        switch ($ep["special"]) {            case 0:                if ($ep["type"] == 1) {                    $checkEnterpriseFullFields = ["agencyType", "enterpriseTag", "enterpriseType", "bankCard", "bankNetwork", "bank", "imgurl", "bankImg", "beian"];                    if ($ep["agencyType"] == 1) {                        $checkEnterpriseFullFields[] = "industryFieldNew";                        $checkEnterpriseFullFields[] = "industryFieldOld";                        $checkEnterpriseFullFields[] = "domainImg";                    }                    if (in_array($ep["enterpriseType"], ['guishang', 'gaoxinjishu', 'zhuanjingtexin'])) {                        $checkEnterpriseFullFields[] = "typeImg";                    }                } else {                    if (!in_array($ep["type"], [CommonConst::ENTERPRISE_WJ, CommonConst::ENTERPRISE_GJ])) {                        $checkEnterpriseFullFields = ["bankCard", "bankNetwork", "bank", "imgurl", "bankImg", "beian"];                    } else {                        $checkEnterpriseFullFields = [];                    }                }                break;            case 1:                $checkEnterpriseFullFields = ["institutionTag"];                break;            case 3:                $checkEnterpriseFullFields = ["organizationTag"];                break;        }        $errorCounts = 0;        while ($chk = array_shift($checkEnterpriseFullFields)) {            if ($ep[$chk] == null)                $errorCounts++;        }        $vars["isEnterpriseFull"] = $errorCounts > 0 ? 0 : 1;        $menus = \app\common\api\MenuApi::getEnterpriseMenuByType($ep);        $vars["menus"] = $menus;        return view("", $vars);    }    public function centerPage() {        $ep = Enterprise::where('id', $this->user['uid'])->find();        if ($ep["imgurl"]) {            $pathinfo = pathinfo($ep["imgurl"]);            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {                $ep["imgurl_is_img"] = 1;            }        }        if ($ep["bankImg"]) {            $pathinfo = pathinfo($ep["bankImg"]);            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {                $ep["bankImg_is_img"] = 1;            }        }        if ($ep["domainImg"]) {            $pathinfo = pathinfo($ep["domainImg"]);            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {                $ep["domainImg_is_img"] = 1;            }        }        if ($ep["typeImg"]) {            $pathinfo = pathinfo($ep["typeImg"]);            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {                $ep["typeImg_is_img"] = 1;            }        }        if ($ep["beian"]) {            $pathinfo = pathinfo($ep["beian"]);            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {                $ep["beian_is_img"] = 1;            }        }        switch ($ep['type']) {            case CommonConst::ENTERPRISE_NORMAL:                $ep['typeName'] = '晋江市现代产业体系人才';                break;            case CommonConst::ENTERPRISE_JC:                $ep['typeName'] = '集成电路优秀人才';                break;            case 3:                $ep['typeName'] = '海峡计划团队';                break;            case CommonConst::ENTERPRISE_WJ:                $ep['typeName'] = '卫健医院';                break;            case CommonConst::ENTERPRISE_GJ:                $ep['typeName'] = '高教学校';                break;        }        switch ($ep['checkState']) {            case 1:                $ep['checkStateName'] = '待审核';                break;            case 2:                $ep['checkStateName'] = '审核驳回';                break;            case 3:                $ep['checkStateName'] = '审核通过';                break;            case 4:                $ep['checkStateName'] = '重新提交';                break;        }        switch ($ep['active']) {            case 1:                $ep['activeName'] = '账号有效';                break;            case 2:                $ep['activeName'] = '冻结/拉黑';                break;        }        $template = "";        switch ($ep['type']) {            case CommonConst::ENTERPRISE_WJ:                $template = "/index/hospital/center_page";                $ep["medicalCommunityName"] = \app\common\api\Nhc::getMedicalCommunityMap()[$ep["medicalCommunityId"]];                break;            case CommonConst::ENTERPRISE_GJ:                $template = "/index/school/center_page";                break;            default:                $ep['agencyTypeName'] = DictApi::findByParentCodeAndCode('agency_type', $ep['agencyType'])->name ?? "";                $ep['industryFieldNewName'] = DictApi::findDictByCode($ep['industryFieldNew'])->name ?? '';                $ep['industryFieldOldName'] = DictApi::findDictByCode($ep['industryFieldOld'])->name ?? '';                $ep['enterpriseTagName'] = DictApi::findDictByCode($ep['enterpriseTag'])->name ?? '';                $ep['organizationTagName'] = DictApi::findDictByCode($ep['organizationTag'])->name ?? '';                $ep['institutionTagName'] = DictApi::findDictByCode($ep['institutionTag'])->name ?? '';                $ep['streetName'] = DictApi::findDictByCode($ep['street'])->name ?? '';                $ep['enterpriseTypeName'] = DictApi::findDictByCode($ep['enterpriseType'])->name ?? '';                break;        }        $area = array_filter([$ep["provinceName"], $ep["cityName"], $ep["countyName"]]);        if ($area) {            $ep["fullLocationName"] = implode("", $area);        }        $where = [];        $where[] = ["enterpriseId", "=", $this->user["uid"]];        $closeAccountRecord = \think\facade\Db::table("un_enterpriseclose_record")->where($where)->order("createTime desc")->find();        if ($closeAccountRecord["files"]) {            $files = json_decode($closeAccountRecord["files"], true);            $fileTmp = [];            foreach ($files as $file) {                $ext = pathinfo($file)["extension"];                $fileTmp[] = ["ext" => $ext, "path" => $file];            }            $closeAccountRecord["files"] = $fileTmp;        }        return view($template, ['ep' => $ep, 'closeAccountRecord' => $closeAccountRecord]);    }}
 |