No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

area.htm 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /*
  3. * 应该写一个公共组件
  4. * 这个组件代码 虽然与现有的代码功能 有点重复
  5. * 但不影响 现有代码变量即可 不管那么多
  6. * 先用if整合 后续再调 变量都不统一
  7. *
  8. */
  9. /*
  10. * 针对存在二级域名 进行处理
  11. * 主域名只是执行 获取参数
  12. */
  13. $sql2 = '';
  14. $sql3 = '';
  15. //判断是什么省份
  16. $route_param = request()->route();
  17. $route_domain = request()->domain();
  18. $route_url = request()->url();
  19. //判断区域
  20. $domain = explode('//',$route_domain); //str_replace('https://', '', $route_domain);
  21. $domain = explode('.',$domain[1]);
  22. $site = $domain[0];
  23. //城市主页需要执行
  24. if(!empty($site) && $site != 'zc' && $site != 'www'){
  25. //判定为二级域名
  26. $area_name = '';
  27. $sql2 = "SELECT id,name FROM ey_citysite WHERE domain = '".$site."'";
  28. }else{
  29. $site = 'www';
  30. }
  31. //伪山东 $page === "provincial"
  32. //var_dump($route_param);die;
  33. $site_1 = $route_param['site']?$route_param['site']:'';
  34. if($site_1 == 'shandong' && $site == 'www'){
  35. $site = 'shandong';
  36. }
  37. //处理城市参数
  38. if(!empty($route_param['site'])){
  39. $city_domain = $route_param['site'];
  40. $sql3 = "SELECT id,name FROM ey_citysite WHERE domain = '".$city_domain."'";
  41. }else{
  42. $city_domain = 'none';
  43. }
  44. $is_area_data = 0;
  45. $where = '';
  46. ?>
  47. {eyou:if condition='($sql2 !== "")'}
  48. <?php
  49. //-得到区域 省级
  50. ?>
  51. {eyou:sql sql='$sql2' cachetime='3600' id='area'}
  52. {eyou:php}
  53. $area_name = ''.$area['name'].'';
  54. $area_id = ''.$area['id'].'';
  55. $area_where = "province_id=".$area_id." ";
  56. {/eyou:php}
  57. {/eyou:sql}
  58. {/eyou:if}
  59. <?php
  60. /*
  61. * 文章列表和详情
  62. * 资料文档详情
  63. */
  64. ?>
  65. {eyou:if condition='($site == "www")'}
  66. {eyou:assign name='provid' value="0" /}
  67. {eyou:assign name='provid_name' value="山东" /}
  68. {eyou:else /}
  69. {eyou:assign name='provid' value="$area_id" /}
  70. {eyou:assign name='provid_name' value="$area_name" /}
  71. {/eyou:if}
  72. {eyou:if condition='($sql3 !== "")'}
  73. <?php
  74. //-得到区域 城市
  75. ?>
  76. {eyou:sql sql='$sql3' cachetime='3600' id='area'}
  77. {eyou:php}
  78. $city_name = ''.$area['name'].'';
  79. $city_id = ''.$area['id'].'';
  80. $area_where = "province_id=".$area_id." and city_id=".$city_id." ";
  81. {/eyou:php}
  82. {/eyou:sql}
  83. {/eyou:if}
  84. <?php
  85. /*
  86. * 文章列表和详情
  87. */
  88. ?>
  89. {eyou:assign name='cityid' value="$city_id" /}
  90. {eyou:assign name='cityid_name' value="$city_name" /}
  91. <?php
  92. //再优化
  93. ?>
  94. {eyou:if condition='($sql2 !== "")'}
  95. {eyou:php}
  96. //针对常见问题
  97. $sql4 = "SELECT count(*) as num FROM ey_archives WHERE ".$area_where." and typeid=111 and is_del=0 and status=1 and arcrank=0 ";
  98. {/eyou:php}
  99. {eyou:sql sql='$sql4' cachetime='3600' id='area_data'}
  100. {eyou:php}
  101. if((int)$area_data['num'] > 0){
  102. //存在区域数据
  103. $is_area_data = 1;
  104. }
  105. {/eyou:php}
  106. {/eyou:sql}
  107. {/eyou:if}
  108. <?php
  109. ?>