officialwebsite.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: yunzhong
  5. * Date: 2020/6/11
  6. * Time: 15:33
  7. */
  8. //参数获取
  9. include_once "./official/fun.php";
  10. $name = "";
  11. $article_id = 0;
  12. $page = 0;
  13. $cate = 0;
  14. $param = $_SERVER['QUERY_STRING'];
  15. if (!empty($param)) {
  16. $param = explode("&",$param);
  17. foreach ($param as $kk=>$vv) {
  18. if (strpos($vv,'page_name=') !== false) {
  19. $name = explode('page_name=',$vv)[1];
  20. }
  21. if (strpos($vv,'article=') !== false) {
  22. $article_id = explode('article=',$vv)[1];
  23. }
  24. if (strpos($vv,'page=') !== false) {
  25. $page = explode('page=',$vv)[1];
  26. }
  27. if (strpos($vv,'cate=') !== false) {
  28. $cate = explode('cate=',$vv)[1];
  29. }
  30. }
  31. }
  32. if (empty($name)) {
  33. $name = "default_home";
  34. }
  35. //获取数据库配置
  36. $result = getOfficial($name);
  37. $connect = null;
  38. $top = [];
  39. $custom = [];
  40. $basic = [];
  41. $content = "";
  42. $tail = [];
  43. if (!$result) {
  44. include_once "./official/common/404.html";
  45. return ;
  46. }
  47. //处理数据
  48. if ($result) {
  49. if ($result['top']) {
  50. $result['top'] = json_decode($result['top'],true);
  51. $result['top']['logo'] = empty($result['top']['logo']) ? "official/images/footer_qr_contact.png" : $result['top']['logo'];
  52. if (count($result['top']['navigation'])>0) {
  53. foreach ($result['top']['navigation'] as $kk=>$vv) {
  54. $result['top']['navigation'][$kk]['url'] = $vv['url'];
  55. $tool = explode("page_name=",$vv['url']);
  56. $result['top']['navigation'][$kk]['tool'] = $tool[1];
  57. }
  58. }
  59. $top = $result['top'];
  60. }
  61. $app_top = '';
  62. $app_bottom='';
  63. // if ($result['theme_id'] == 21){
  64. // $app_top = '<div class="swiper-container" style="display: block; height: calc(100vh - 74px)"><div class="swiper-wrapper middle_detail">';
  65. // $app_bottom = '</div><div class="swiper-pagination"></div></div>';
  66. // }
  67. if ($result['basic']) {
  68. $result['basic'] = json_decode($result['basic'],true);
  69. if (isset($result['basic']['cus_url'])) {
  70. $result['basic']['cus_url'] = empty($result['basic']['cus_url']) ? "official/images/footer_qr_contact.png" : $result['basic']['cus_url'];
  71. }
  72. $basic = $result['basic'];
  73. }
  74. if ($result['tail']) {
  75. if ($result['tail']) {
  76. $result['tail'] = htmlspecialchars_decode($result['tail']);
  77. }
  78. $tail = $result['tail'];
  79. }
  80. $result['detail'] = htmlspecialchars_decode($result['detail']);
  81. $identification = $result['idft'];
  82. $title = $result['mul_title'];
  83. $keywords = $result['keyword'];
  84. $describe = $result['describe'];
  85. $content = $result['detail'];
  86. $article_name = [];
  87. $article = [];
  88. $help = [];
  89. if ($identification == "common") {
  90. if ($name == "resource_page") {
  91. $article = empty($result['article']) ? [] : json_decode($result['article'],true);
  92. if (!empty($article)) {
  93. foreach ($article as $kk=>$vv) {
  94. $data = [];
  95. if (!empty($vv['has_many_article'])) {
  96. foreach ($vv['has_many_article'] as $k=>$v) {
  97. $data[$k]['id'] = $v['id'];
  98. $data[$k]['img'] = $v['thumb'];
  99. $data[$k]['author'] = $v['author'];
  100. $data[$k]['created_at'] = $v['created_at'];
  101. $data[$k]['title'] = $v['title'];
  102. $data[$k]['content'] = $v['desc'];
  103. $data[$k]['url'] = "https://".$_SERVER['HTTP_HOST']."/officialwebsite.php?page_name=resource_detail&article=".$v['id'];
  104. }
  105. }
  106. $article[$kk]['datas'] = $data;
  107. }
  108. }
  109. $help = empty($result['helper']) ? [] : json_decode($result['helper'],true);
  110. if (!empty($help)) {
  111. foreach ($help as $kk=>$vv) {
  112. $help[$kk]['id'] = $kk;
  113. }
  114. }
  115. }
  116. } elseif ($identification == "website") {
  117. //获取文章
  118. $uniacid = $basic['cus_uniacid'];
  119. $web_rel = getCommonArticle($uniacid,$cate);
  120. $pager = $page+1;
  121. $follow_url = $_SERVER['REQUEST_SCHEME'] . '://' .$_SERVER['HTTP_HOST']."/admin/followArticle";
  122. if ($name == "default_home") {
  123. $contact_url = $_SERVER['REQUEST_SCHEME'] . '://' .$_SERVER['HTTP_HOST']."/admin/contactInformation";
  124. $home_data = getReadVolumeArticle($uniacid);
  125. }
  126. if ($name == "resource_page") {
  127. $article_cate_data = getPageCate($uniacid,$cate);
  128. $article_total_rel = getTotalCate($uniacid,$cate);
  129. }
  130. }
  131. if ($name == "resource_detail") {
  132. $rel = getDetailArticle($article_id);
  133. $describe = $rel['desc'];
  134. $keywords = $rel['keyword'];
  135. $title = $rel['title']."-".$shop_data['value']['name'];
  136. $cate_url = $_SERVER['REQUEST_SCHEME'] . '://' .$_SERVER['HTTP_HOST']."/officialwebsite.php?page_name=resource_page&cate=".$rel['cate_id'];
  137. $title_url = $_SERVER['REQUEST_SCHEME'] . '://' .$_SERVER['HTTP_HOST']."/addons/yun_shop/?menu#/articleContent/".$rel['id']."?i=".$rel['uniacid'];
  138. $shop_data = getShopData();
  139. $shop_data['value'] = unserialize($shop_data['value']);
  140. $connect2 = null;
  141. }
  142. if (file_exists("./official/".$identification."/".$name.".html")) {
  143. include_once("./official/".$identification."/".$name.".html");
  144. return ;
  145. } else {
  146. include_once "./official/common/404.html";
  147. return ;
  148. }
  149. }