123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /*
- * 应该写一个公共组件
- * 这个组件代码 虽然与现有的代码功能 有点重复
- * 但不影响 现有代码变量即可 不管那么多
- * 先用if整合 后续再调 变量都不统一
- *
- */
-
- /*
- * 针对存在二级域名 进行处理
- * 主域名只是执行 获取参数
- */
- $sql2 = '';
- $sql3 = '';
- //判断是什么省份
- $route_param = request()->route();
- $route_domain = request()->domain();
- $route_url = request()->url();
- //判断区域
- $domain = explode('//',$route_domain); //str_replace('https://', '', $route_domain);
- $domain = explode('.',$domain[1]);
- $site = $domain[0];
-
- //城市主页需要执行
- if(!empty($site) && $site != 'zc' && $site != 'www'){
- //判定为二级域名
- $area_name = '';
- $sql2 = "SELECT id,name FROM ey_citysite WHERE domain = '".$site."'";
- }else{
- $site = 'www';
- }
-
- //伪山东 $page === "provincial"
- //var_dump($route_param);die;
- $site_1 = $route_param['site']?$route_param['site']:'';
- if($site_1 == 'shandong' && $site == 'www'){
- $site = 'shandong';
- }
-
- //处理城市参数
- if(!empty($route_param['site'])){
- $city_domain = $route_param['site'];
- $sql3 = "SELECT id,name FROM ey_citysite WHERE domain = '".$city_domain."'";
- }else{
- $city_domain = 'none';
- }
- $is_area_data = 0;
- $where = '';
- ?>
-
-
-
- {eyou:if condition='($sql2 !== "")'}
- <?php
- //-得到区域 省级
- ?>
- {eyou:sql sql='$sql2' cachetime='3600' id='area'}
- {eyou:php}
- $area_name = ''.$area['name'].'';
- $area_id = ''.$area['id'].'';
- $area_where = "province_id=".$area_id." ";
- {/eyou:php}
- {/eyou:sql}
- {/eyou:if}
- <?php
- /*
- * 文章列表和详情
- * 资料文档详情
- */
- ?>
- {eyou:if condition='($site == "www")'}
- {eyou:assign name='provid' value="0" /}
- {eyou:assign name='provid_name' value="山东" /}
- {eyou:else /}
- {eyou:assign name='provid' value="$area_id" /}
- {eyou:assign name='provid_name' value="$area_name" /}
- {/eyou:if}
-
- {eyou:if condition='($sql3 !== "")'}
- <?php
- //-得到区域 城市
- ?>
- {eyou:sql sql='$sql3' cachetime='3600' id='area'}
- {eyou:php}
- $city_name = ''.$area['name'].'';
- $city_id = ''.$area['id'].'';
- $area_where = "province_id=".$area_id." and city_id=".$city_id." ";
- {/eyou:php}
- {/eyou:sql}
- {/eyou:if}
- <?php
- /*
- * 文章列表和详情
- */
- ?>
- {eyou:assign name='cityid' value="$city_id" /}
- {eyou:assign name='cityid_name' value="$city_name" /}
-
-
- <?php
- //再优化
- ?>
- {eyou:if condition='($sql2 !== "")'}
- {eyou:php}
- //针对常见问题
- $sql4 = "SELECT count(*) as num FROM ey_archives WHERE ".$area_where." and typeid=111 and is_del=0 and status=1 and arcrank=0 ";
- {/eyou:php}
- {eyou:sql sql='$sql4' cachetime='3600' id='area_data'}
- {eyou:php}
- if((int)$area_data['num'] > 0){
- //存在区域数据
- $is_area_data = 1;
- }
- {/eyou:php}
- {/eyou:sql}
- {/eyou:if}
-
- <?php
-
- ?>
|