<?php
/*
 * @Author: xiaohai zmhwork@qq.com
 * @Date: 2024-01-23 10:45:56
 * @LastEditTime: 2024-02-19 09:18:01
 * @LastEditors: xiaohai zmhwork@qq.com
 * @FilePath: \eyoucms\application\route_ext.php
 * @Description: 扩展路由
 */

use think\Route;


$route_ext_pattern = [
    'tid' => '[\d]+',
    'dirname' => '[\-\w]+',
    'aid' => '[\d]+',
];

$route_ext = [];


/**
 * @description: 获取tid对应的map
 * @return {*}
 */
function get_tid_map() {
    $tid_map = [
        'zczl' => '38',
        '38' => 'zczl',
        'gonglve' => '117',
        '117' => 'gonglve',

        'zclw' => '116',
        '116' => 'zclw',
        'lwck' => '127',
        '127' => 'lwck',

        'fpzn' => '131',
        '131' => 'fpzn',
        'zcdb' => '132',
        '132' => 'zcdb',
        'lnzt' => '133',
        '133' => 'lnzt',
        'wthz' => '111',
        '111' => 'wthz',
        'zlwd' => '125',
        '125' => 'zlwd',
        'zcbt' => '306',
        '306' => 'zcbt',

        'zcsb' => '118',
        '118' => 'zcsb',
        'anli' => '120',
        '120' => 'anli',
        'xgwt' => '122',
        '122' => 'xgwt',

        'zx' => '1231',
        '1231' => 'zx',
        'zc' => '1232',
        '1232' => 'zc',
        'cl' => '1233',
        '1233' => 'cl',
        'cp' => '1234',
        '1234' => 'cp',
        'tg' => '1235',
        '1235' => 'tg',
        'tglist' => '1236',
        '1236' => 'tglist',


        'zhengce' => '115',
        '115' => 'zhengce',
    ];

    return $tid_map;
}

/**
 * @description: 获取tid对应的url
 * @param {*} $tid
 * @param {*} $aid
 * @return {*}
 */
function get_tid_url($tid = 0, $aid = 0,$module = 'home', $controller = 'lists', $action = 'index') {


    //array(4) { ["/?m"]=> string(4) "home" ["c"]=> string(5) "Lists" ["a"]=> string(5) "index" ["tid"]=> string(3) "116" }

    if ($tid <= 0) {
        return false;
    }

    $tid_map = get_tid_map();

    $module = strtolower($module);
    $controller = strtolower($controller);
    $action = strtolower($action);

    // 存在aid
    if ($aid > 0) {
        if ($module == 'home' && $controller == 'view' && $action == 'index') {
            if (array_key_exists($tid, $tid_map)) {
                switch ($tid_map[$tid]) {
                    case 'zczl':
                        return "/" . $tid_map[$tid] . "/jzzc" . $aid;
                        break;
                    case 'gonglve':
                    case 'zclw':
                    case 'wthz':
                        return "/" . $tid_map[$tid] . $aid;
                        break;
                    case 'fpzn':
                    case 'zcdb':
                    case 'lntz':
                    case 'zhengce':
                        return "/" . $tid_map[$tid] . "/cms" . $aid;
                }

            }
        }
    } else {
        if ($module == 'home' && $controller == 'lists' && $action == 'index') {
            if (array_key_exists($tid, $tid_map)) {
                return "/" . $tid_map[$tid];
            }
        }
    }


    return false;
}


/**
 * @description: 扩展路由设置
 * @return {*}
 */
function set_route_ext()
{
    $tid_map = get_tid_map();

    // 获取二级域名
    $sub_doman = request()->subDomain();
    $home_site = get_home_site();

    // var_dump($tid_map['zczl']);
    //var_dump($sub_doman);
    //var_dump($home_site);

    //没有html 文件
    Route::get('sitemap$','home/City/fileMapHandle',['ext'=>'|txt|xml']);
    //Route::get('sitemap$','home/City/fileMapHandle');  //不能重复定义


    // 主站点
    if (empty($sub_doman) || $sub_doman == "www" || $sub_doman == "zc.dev") {
        // Route::get('zczl','home/Lists/index?tid=38');
        Route::get([

            //新增栏目
            'zx$' => 'home/Lists/index?tid=' . $tid_map['zx'],
            'zx-<page>$' => ['home/Lists/index?tid='.$tid_map['zx'], [], ['page' => '[\d]+']],
            'zx<aid>$' => ['home/View/index?tid=' . $tid_map['zx'], [], ['aid' => '[\d]+']],

            'zc$' => 'home/Lists/index?tid=' . $tid_map['zc'],
            'zc-<page>$' => ['home/Lists/index?tid='.$tid_map['zc'], [], ['page' => '[\d]+']],
            'zc/<areaname>$' => ['home/Lists/index?tid=' . $tid_map['zc'],[],['areaname' => "[\w]+"]],
            'zc/<areaname>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zc'],[],['areaname' => "[\w]+",'page'=>'[\d]+']],
            'zc/<areaname>/<aid>$' => ['home/View/index?tid=' . $tid_map['zc'], [], ['areaname' => "[\w]+",'aid' => '[\d]+']],
            //'zc/<aid>$' => ['home/View/index?tid=' . $tid_map['zc'], [], ['aid' => '[\d]+']], //无效 使用action()

            'cl$' => 'home/Lists/index?tid=' . $tid_map['cl'],
            'cl-<page>$' => ['home/Lists/index?tid='.$tid_map['cl'], [], ['page' => '[\d]+']],
            'cl/<aid>$' => ['home/View/index?tid=' . $tid_map['cl'], [], ['aid' => '[\d]+']],


            'cp$' => 'home/Lists/index?tid=' . $tid_map['cp'],
            'cp-<page>$' => ['home/Lists/index?tid='.$tid_map['cp'], [], ['page' => '[\d]+']],
            'cp<aid>$' => ['home/View/index?tid=' . $tid_map['cp'], [], ['aid' => '[\d]+']],


            'taglist$' => 'home/Lists/index?tid=' . $tid_map['tglist'],
            'taglist-<page>$' => ['home/Lists/index?tid='.$tid_map['tglist'], [], ['page' => '[\d]+']],
            'tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['tg'],[], ['tagid' => '[\d]+']],
            'tag<tagid>-<page>$' => ['home/Lists/index?tid='.$tid_map['tg'], [], ['tagid' => '[\d]+','page' => '[\d]+']],



             // 职称分类
            'zczl$' => 'home/Lists/index?tid=' . $tid_map['zczl'],
            'zczl-<pa>$' => ['home/Lists/index?tid='.$tid_map['zczl'], [], ['pa' => '[\d]+']],
            //'zczl/jzzc<tid>$' => ['home/Lists/index',[],['tid' => '[\d]+']],
            //'zczl/jzzc<tid>$' => ['home/Lists/index?', [], ['tid' => '[\d]+']],
            //'zczl/jzzc<tid>-<pa>$' => ['home/Lists/index?', [], ['tid' => '[\d]+','pa' => '[\d]+']],
            'zczl/jzzc<areaid>$' => ['home/Lists/index?tid=38', [], ['areaid' => '[\d]+']],
            'zczl/jzzc<areaid>-<pa>$' => ['home/Lists/index?tid=38', [], ['areaid' => '[\d]+','pa' => '[\d]+']],

            //职称679个产品页
            //获取不到aid
            //'id<tid>$' => ['home/Lists/index?', [], ['tid' => '[\d]+']],
            'id<catids>$' => ['home/Lists/index?tid=56', [], ['catids' => '[\d]+']],
            'id<catids>h<pa>$' => ['home/Lists/index?tid=56', [], ['catids' => '[\d]+','pa' => '[\d]+']],
            'id<cid>/sid<catids>$' => ['home/Lists/index?tid=56', [], ['cid' => '[\d]+','catids' => '[\d]+']],
            'id<cid>/sid<catids>h<pa>$' => ['home/Lists/index?tid=56', [], ['cid' => '[\d]+','catids' => '[\d]+','pa' => '[\d]+']],
            
            
            // 评审攻略
            'gonglve$' => 'home/Lists/index?tid=' . $tid_map['gonglve'],
            'gonglve/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'gonglve/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'gonglve1-<aid>$' => ['home/View/index?tid=' . $tid_map['gonglve'], [], ['aid' => '[\d]+']],
            'gonglve-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+']],
            
            // 职称论文
            'zclw$' => 'home/Lists/index?tid=' . $tid_map['zclw'],
            'zclw/lunwen<aid>$' => ['home/View/index?tid=' . $tid_map['zclw'], [], ['aid' => '[\d]+']],
            'zclw-<page>$' => ['home/Lists/index?tid=' . $tid_map['zclw'], [], ['page' => '[\d]+']],
            
            // 职称参考
            'lwck$' => 'home/Lists/index?tid=' . $tid_map['lwck'],
            'lwck/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['lwck'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'lwck/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['lwck'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'lwck/cankao<aid>$' => ['home/View/index?tid=' . $tid_map['lwck'], [], ['aid' => '[\d]+']],
            'lwck-<page>$' => ['home/Lists/index?tid=' . $tid_map['lwck'], [], ['page' => '[\d]+']],

            // 防骗指南
            'fpzn$' => 'home/Lists/index?tid=' . $tid_map['fpzn'],
            'fpzn/cms<aid>$' => ['home/View/index?tid=' . $tid_map['fpzn'], [], ['aid' => '[\d]+']],
            'fpzn-<page>$' => ['home/Lists/index?tid=' . $tid_map['fpzn'], [], ['page' => '[\d]+']],
            // 答辩问题
            'zcdb$' => 'home/Lists/index?tid=' . $tid_map['zcdb'],
            'zcdb/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zcdb'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zcdb/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zcdb'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zcdb1-<aid>$' => ['home/View/index?tid=' . $tid_map['zcdb'], [], ['aid' => '[\d]+']],
            'zcdb-<page>$' => ['home/Lists/index?tid=' . $tid_map['zcdb'], [], ['page' => '[\d]+']],
            // 历年真题
            'lnzt$' => 'home/Lists/index?tid=' . $tid_map['lnzt'],
            'lnzt/cms<aid>$' => ['home/View/index?tid=' . $tid_map['lnzt'], [], ['aid' => '[\d]+']],
            'lnzt-<page>$' => ['home/Lists/index?tid=' . $tid_map['lnzt'], [], ['page' => '[\d]+']],

            // 常见问题
            'wthz$' => 'home/Lists/index?tid=' . $tid_map['wthz'],
            'wthz<aid>$' => ['home/View/index?tid=' . $tid_map['wthz'], [], ['aid' => '[\d]+']],
            'wthz-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+']],
            'wthz/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'wthz/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+','tagid' => '[\d]+']],

            // 职称补贴
            'zcbt$' => 'home/Lists/index?tid=' . $tid_map['zcbt'],
            'zcbt/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zcbt'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zcbt/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zcbt'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zcbt<aid>$' => ['home/View/index?tid=' . $tid_map['zcbt'], [], ['aid' => '[\d]+']],
            'zcbt-<page>$' => ['home/Lists/index?tid=' . $tid_map['zcbt'], [], ['page' => '[\d]+']],

            // 补充 职称申报
            'zcsb$' => 'home/Lists/index?tid=' . $tid_map['zcsb'],
            'zcsb<aid>$' => ['home/View/index?tid=' . $tid_map['zcsb'], [], ['aid' => '[\d]+']],
            'zcsb-<page>$' => ['home/Lists/index?tid=' . $tid_map['zcsb'], [], ['page' => '[\d]+']],
            // 补充 案例展示
            'anli$' => 'home/Lists/index?tid=' . $tid_map['anli'],
            'anli/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['anli'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'anli/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['anli'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'anli<aid>$' => ['home/View/index?tid=' . $tid_map['anli'], [], ['aid' => '[\d]+']],
            'anli-<page>$' => ['home/Lists/index?tid=' . $tid_map['anli'], [], ['page' => '[\d]+']],
            // 补充 相关问题
            'xgwt$' => 'home/Lists/index?tid=' . $tid_map['xgwt'],
            'xgwt<aid>$' => ['home/View/index?tid=' . $tid_map['xgwt'], [], ['aid' => '[\d]+']],
            'xgwt-<page>$' => ['home/Lists/index?tid=' . $tid_map['xgwt'], [], ['page' => '[\d]+']],

            //职称材料
            'zccl$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',
            'zccl-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['pa' => '[\d]+']],

            'zccl/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',[],['tagid'=>'[\d]+']],
            'zccl/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],
            
            //使用_符号 很多地方用 / 或者 - 分割 避免冲突
            '<areaname>_zccl$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',
            '<areaname>_zccl-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['areaname' => "[\w]+",'pa' => '[\d]+']],

            '<areaname>_zccl/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',[],['areaname' => "[\w]+",'tagid'=>'[\d]+']],
            '<areaname>_zccl/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['areaname' => "[\w]+",'tagid'=>'[\d]+','pa' => '[\d]+']],
            

            // 资料文档 - 变成通用文件
            'zlwd$' => 'home/Lists/index?tid=' . $tid_map['zlwd'],
            'zlwd-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['pa' => '[\d]+']],

            'zlwd/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'],[],['tagid'=>'[\d]+']],
            'zlwd/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['tagid'=>'[\d]+','pa' => '[\d]+']],
            
            //使用_符号 很多地方用 / 或者 - 分割 避免冲突
            '<areaname>_zlwd$' => 'home/Lists/index?tid=' . $tid_map['zlwd'],
            '<areaname>_zlwd-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['areaname' => "[\w]+",'pa' => '[\d]+']],

            '<areaname>_zlwd/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'],[],['areaname' => "[\w]+",'tagid'=>'[\d]+']],
            '<areaname>_zlwd/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['areaname' => "[\w]+",'tagid'=>'[\d]+','pa' => '[\d]+']],

            //政策文件 - 变成政策指引
            'zcwj$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',
            'zcwj-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['pa' => '[\d]+']],

            'zcwj/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',[],['tagid'=>'[\d]+']],
            'zcwj/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],
            
            //使用_符号 很多地方用 / 或者 - 分割 避免冲突
            '<areaname>_zcwj$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',
            '<areaname>_zcwj-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['areaname' => "[\w]+",'pa' => '[\d]+']],

            '<areaname>_zcwj/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',[],['areaname' => "[\w]+",'tagid'=>'[\d]+']],
            '<areaname>_zcwj/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['areaname' => "[\w]+",'tagid'=>'[\d]+','pa' => '[\d]+']],

            
            //其他
            'zlwd/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
            'zlwd/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],

            'zcwj/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
            'zcwj/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],

            'ckwj/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
            'ckwj/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],
            
            //参考文件 - 隐藏
            'ckwj$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=3',
            'ckwj-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=3', [], ['pa' => '[\d]+']],
            'ckwj/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=3',[],['tagid'=>'[\d]+']],
            'ckwj/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=3', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],

            //存在site 该规则不匹配 会报404
            'zlwd<aid>$' => ['home/View/index?tid='.$tid_map['zlwd'], [], ['aid' => '[\d]+']],
            'zlwd-c<catid>-p<provid>-y<cityid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'], [], ['catid' => '[\d]+','provid' => '[\d]+','cityid' => '[\d]+']],
            // 城市
            //这样写 后台 https://www.zc10000.com/login.php?s=Admin/login 进不去 404
            //'<site>' => ['home/Lists/index?tid=139', [], ['site' => "[\w]+"]],

            //政策资讯
            //https://www.zc10000.com/?m=home&c=View&a=index&aid=732
            'zhengce$' => 'home/Lists/index?tid=' . $tid_map['zhengce'],
            'zhengce-<page>$' => ['home/Lists/index?tid='.$tid_map['zhengce'], [], ['page' => '[\d]+']],
            'zhengce/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zhengce/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
            'zhengce/cms<aid>$' => ['home/View/index?tid='.$tid_map['zhengce'], [], ['aid' => '[\d]+']],
            
            //https://www.zc10000.com/zczl/jzzc48/732
            'zczl/jzzc<tid>/<aid>$' => ['home/View/index?', [], ['tid' => '[\d]+','aid' => '[\d]+']],

            //301链接
            'zhengcefabu/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'gongshichaxun/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshenshijian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'shenbaozhidao/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'lunwenzhuanli/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'zhichengongzhong/gongchengshigongzhong/zhuligongchengshi/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'zhichengongzhong/gongchengshigongzhong/zhongjigongchengshi/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'zhichengongzhong/gongchengshigongzhong/gaojigongchengshi/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'changjianwenti/zhichenshenbaozhuyishixiang/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'lunwenzhuanli/zhichenpingshenlunwenfabiao/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'lunwenzhuanli/zhichenpingshenzhuanlishenqing/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'lunwenzhuanli/zhichenpingshenkejichengguo/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/chujizhichenpingshentiaojian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/zhongjizhichenpingshentiaojian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/gaojizhichenpingshentiaojian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/zhenggaojizhichenpingshentiaojian/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshentiaojian/pingshenyiwenjieda/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshengonglue/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshengonglue/zhichenlunwen/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            'pingshengonglue/zhichenzhuanli/<aid>$' => ['home/City/tourl?', [], ['aid' => '[\d]+']],
            //原城市301
            //'<site>$' => ['home/City/chenshi?tid=139', [], ['site' => "[\w]+"]],
            '<site>$' => ['home/City/tourl?', [], ['site' => "[\w]+"]],
            'baidu_verify_codeva-<number>$' => ['home/City/fileHandle?', [], ['number' => '[\w]+']],

        ]);
        // $route_ext += [
        //     // 职称分类
        //     'zczl$' => [
        //         '/?m=home&c=Lists&a=index&tid=38',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'zczl/jzzc<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 职称679个产品页
        //     'jzgczc<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 评审攻略
        //     'gonglve$' => [
        //         '/?m=home&c=Lists&a=index&tid=117',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'gonglve<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 职称论文
        //     'zclw$' => [
        //         '/?m=home&c=Lists&a=index&tid=116',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'zclw/lunwen<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 防骗指南
        //     'fpzn$' => [
        //         '/?m=home&c=Lists&a=index&tid=131',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'fpzn/cms<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 答辩问题
        //     'zcdb$' => [
        //         '/?m=home&c=Lists&a=index&tid=132',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'zcdb<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 历年真题
        //     'lnzt$' => [
        //         '/?m=home&c=Lists&a=index&tid=133',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'lnzt/cms<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 常见问题
        //     'wthz$' => [
        //         '/?m=home&c=Lists&a=index&tid=111',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        //     'wthz<aid>$' => [
        //         '/?m=home&c=View&a=index',
        //         ['method' => 'get', 'ext' => ''],
        //         ['aid' => '[\d]+'],
        //         'cache' => 1
        //     ],
        //     // 资料文档
        //     'zlwd$' => [
        //         '/?m=home&c=Lists&a=index&tid=125',
        //         ['method' => 'get', 'ext' => ''],
        //         'cache' => 1
        //     ],
        // ];
    } else {
        // 城市站点
        //var_dump($sub_doman);
        //var_dump($home_site);
        //二级域名等于 省级site
        if ($sub_doman == $home_site) {
            // 城市站点
            // $route_ext += [
            //     // 政策
            //     'zhengce$' => [
            //         '/?m=home&c=Lists&a=index&tid=115',
            //         ['method' => 'get', 'ext' => ''],
            //         ['aid' => '[\d]+'],
            //         'cache' => 1
            //     ],
            //     'zhengce/cms<aid>$' => [
            //         '/?m=home&c=View&a=index',
            //         ['method' => 'get', 'ext' => ''],
            //         ['aid' => '[\d]+'],
            //         'cache' => 1
            //     ],
            //     // 攻略
            //     'gonglve$' => [
            //         '/?m=home&c=Lists&a=index&tid=117',
            //         ['method' => 'get', 'ext' => ''],
            //         'cache' => 1
            //     ],
            //     'gonglve<aid>$' => [
            //         '/?m=home&c=View&a=index',
            //         ['method' => 'get', 'ext' => ''],
            //         ['aid' => '[\d]+', 'site' => $home_site],
            //         'cache' => 1
            //     ],
            // ];
            Route::get([
                // 政策
                'zhengce$' => 'home/Lists/index?tid=' . $tid_map['zhengce'],
                'zhengce-<page>$' => ['home/Lists/index?tid='.$tid_map['zhengce'], [], ['page' => '[\d]+']],
                'zhengce/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
                'zhengce/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
                //'zhengce/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zhengce'], [], ['aid' => '[\d]+']],
                'zhengce/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zhengce'], [], ['aid' => '[\d]+']],


                //增加常见问题
                'wthz$' => 'home/Lists/index?tid=' . $tid_map['wthz'],
                'wthz<aid>$' => ['home/View/index?tid=' . $tid_map['wthz'], [], ['aid' => '[\d]+']],
                'wthz-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+']],
                'wthz/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
                'wthz/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['page' => '[\d]+','tagid' => '[\d]+']],


                //职称材料
                'zccl$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',
                'zccl-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['pa' => '[\d]+']],

                'zccl/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=5',[],['tagid'=>'[\d]+']],
                'zccl/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=5', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],

                //资料文档
                'zlwd$' => 'home/Lists/index?tid=' . $tid_map['zlwd'],
                'zlwd-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['pa' => '[\d]+']],
                'zlwd/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'],[],['tagid'=>'[\d]+']],
                'zlwd/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['tagid'=>'[\d]+','pa' => '[\d]+']],

                //政策文件
                'zcwj$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',
                'zcwj-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['pa' => '[\d]+']],
                'zcwj/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=2',[],['tagid'=>'[\d]+']],
                'zcwj/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=2', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],

                //参考文件
                'ckwj$' => 'home/Lists/index?tid=' . $tid_map['zlwd'].'&type=3',
                'ckwj-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=3', [], ['pa' => '[\d]+']],
                'ckwj/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'].'&type=3',[],['tagid'=>'[\d]+']],
                'ckwj/tag<tagid>-<pa>$' => ['home/Lists/index?tid='.$tid_map['zlwd'].'&type=3', [], ['tagid'=>'[\d]+','pa' => '[\d]+']],

                //其他
                'zlwd/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
                'zlwd/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],

                'zcwj/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
                'zcwj/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],

                'ckwj/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+']],
                'ckwj/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['aid' => '[\d]+','pa' => '[\d]+']],

                //https://guangdong.zc10000.com/zlwd/zccp39
                'zlwd/zccp<catid>$' => ['home/Lists/index?tid='.$tid_map['zlwd'], [], ['catid' => '[\d]+']],
                //https://guangdong.zc10000.com/zlwd/zccp39/cms1071
                'zlwd/zccp<catid>/cms<aid>$' => ['home/View/index?tid='.$tid_map['zlwd'], [], ['catid' => '[\d]+','aid'=>'[\d]+']],
                'zlwd/zccp<catid>/cms<aid>-<pa>$' => ['home/View/index?tid='.$tid_map['zlwd'], [], ['catid' => '[\d]+','aid'=>'[\d]+','pa'=>'[\d]+']],

                // 攻略
                'gonglve$' => 'home/Lists/index?tid=' . $tid_map['gonglve'],
                'gonglve1-<aid>$' => ['home/View/index?tid=' . $tid_map['gonglve'], [], ['aid' => '[\d]+']],
                'gonglve-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+']],
                'gonglve/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
                'gonglve/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['page' => '[\d]+','tagid' => '[\d]+']],
                
                //这是谁弄的 有问题的
                'gonglve/<site>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+"]],
                'gonglve1-<aid>/<site>$' => ['home/View/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+", 'aid' => '[\d]+']],

                'id<catids>$' => ['home/Lists/index?tid=56', [], ['catids' => '[\d]+']],
                'id<catids>h<pa>$' => ['home/Lists/index?tid=56', [], ['catids' => '[\d]+','pa' => '[\d]+']],

                'id<cid>/sid<catids>$' => ['home/Lists/index?tid=56', [], ['cid' => '[\d]+','catids' => '[\d]+']],
                'id<cid>/sid<catids>h<pa>$' => ['home/Lists/index?tid=56', [], ['cid' => '[\d]+','catids' => '[\d]+','pa' => '[\d]+']],

                // 城市
                /*'/city/<city>' => ['home/City/index?tid=' . $tid_map['gonglve'], [], ['city' => "[\w]+"]],

                '/<city>/gonglve$' => ['home/City/index?tid=' . $tid_map['gonglve'], [], ['city' => "[\w]+"]],
                '/<city>/gonglve<aid>$' => ['home/City/view?tid=' . $tid_map['gonglve'], [], ['city' => "[\w]+", 'aid' => '[\d]+']],
                */

                // //不知道是什么
                // '/$' => 'home/City/provincial?tid=138',
            ]);
        } else {
            // 其他域名
            // 业务咨询
            if ($sub_doman == "zcdp") {
                // $route_ext += [
                //     '/' => [
                //         '/?m=home&c=Lists&a=index&tid=136',
                //         ['method' => 'get', 'ext' => ''],
                //         ['aid' => '[\d]+'],
                //         'cache' => 1
                //     ],
                // ];
                Route::get([
                    '/$' => 'home/Lists/index?tid=136',
                ]);
            } elseif ($sub_doman == "zczl") {
                // 专利申请
                // $route_ext += [
                //     '/' => [
                //         '/?m=home&c=Lists&a=index&tid=134',
                //         ['method' => 'get', 'ext' => ''],
                //         ['aid' => '[\d]+'],
                //         'cache' => 1
                //     ],
                // ];
                Route::get([
                    //'/$' => 'home/Lists/index?tid=134',
                    '/$' => 'home/Guestbook/lists?tid=134',
                ]);
            }else{
                /*var_dump($sub_doman);
                var_dump($home_site);
                die;*/
                //https://shanxi.zc10000.com/?m=home&c=View&a=index&aid=1023&site=yuncheng
                //var_dump($home_site);
                //Route::rule('<site>/zlwd/cms<aid>$', 'home/View/index?');
                //https://shanxi.zc10000.com/yuncheng/zlwd/cms1023
                //资料文档
                Route::get([

                    //存在城市-列表
                    '<site>/zhengce$' => 'home/Lists/index?tid=' . $tid_map['zhengce'],
                    '<site>/zhengce/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],
                    '<site>/zhengce/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['zhengce'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],
                    '<site>/zhengce-<page>$' => ['home/Lists/index?tid='.$tid_map['zhengce'], [], ['site' => "[\w]+",'page' => '[\d]+']],
                    //存在城市-详情
                    '<site>/zhengce/cms<aid>$' => ['home/View/index?tid='.$tid_map['zhengce'], [], ['site' => "[\w]+",'aid' => '[\d]+']],

                    //存在城市-列表
                    '<site>/gonglve$' => 'home/Lists/index?tid=' . $tid_map['gonglve'],
                    '<site>/gonglve1-<aid>$' => ['home/View/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+",'aid' => '[\d]+']],
                    '<site>/gonglve-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+",'page' => '[\d]+']],
                    '<site>/gonglve/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],
                    '<site>/gonglve/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['gonglve'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],

                    //增加常见问题
                    '<site>/wthz$' => 'home/Lists/index?tid=' . $tid_map['wthz'],
                    '<site>/wthz<aid>$' => ['home/View/index?tid=' . $tid_map['wthz'], [], ['site' => "[\w]+",'aid' => '[\d]+']],
                    '<site>/wthz-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['site' => "[\w]+",'page' => '[\d]+']],
                    '<site>/wthz/tag<tagid>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],
                    '<site>/wthz/tag<tagid>-<page>$' => ['home/Lists/index?tid=' . $tid_map['wthz'], [], ['site' => "[\w]+",'page' => '[\d]+','tagid' => '[\d]+']],


                    //城市主页
                    //https://guangdong.zc10000.com/?site=guangzhou
                    //https://guangdong.zc10000.com/guangzhou
                    '<site>$' => ['home/City/chenshi?tid=139', [], ['site' => "[\w]+"]],
                    
                    //无用了
                    '<site>/zlwd/cms<aid>$' => ['home/View/index?tid='.$tid_map['zlwd'], [], ['site' => "[\w]+",'aid' => '[\d]+']],
                    '<site>/zlwd/cms<aid>-<pa>$' => ['home/View/index?tid='.$tid_map['zlwd'], [], ['site' => "[\w]+",'aid' => '[\d]+','pa' => '[\d]+']],
                    
                    //资料文档筛选页面-已不用
                    //https://guangdong.zc10000.com/guangzhou/zlwd
                    '<site>/zlwd$' => ['home/Lists/index?tid=' . $tid_map['zlwd'], [], ['site' => "[\w]+"]],
                    //https://guangdong.zc10000.com/guangzhou/zlwd/zccp39
                    '<site>/zlwd/zccp<catid>$' => ['home/Lists/index?tid=' . $tid_map['zlwd'], [], ['site' => "[\w]+",'catid' => '[\d]+']],
                    //https://guangdong.zc10000.com/guangzhou/zlwd/zccp39/cms1023
                    '<site>/zlwd/zccp<catid>/cms<aid>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['site' => "[\w]+",'catid' => '[\d]+','aid' => '[\d]+']],
                    '<site>/zlwd/zccp<catid>/cms<aid>-<pa>$' => ['home/View/index?tid=' . $tid_map['zlwd'], [], ['site' => "[\w]+",'catid' => '[\d]+','aid' => '[\d]+','pa' => '[\d]+']],
                ]);
            }
        }
    }


    // var_dump(Route::getBind("module"));
    // var_dump(Route::getBind("namespace"));
}

return $route_ext;