Index.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. namespace app\home\controller;
  14. use app\user\logic\PayLogic;
  15. class Index extends Base
  16. {
  17. public function _initialize() {
  18. parent::_initialize();
  19. $this->alipay_return();
  20. $this->Express100();
  21. }
  22. public function index()
  23. {
  24. /*处理多语言首页链接最后带斜杆,进行301跳转*/
  25. $lang = input('param.lang/s');
  26. if (preg_match("/\?lang=".$this->home_lang."\/$/i", $this->request->url(true)) && $lang == $this->home_lang.'/') {
  27. $langurl = $this->request->url(true);
  28. $langurl = rtrim($langurl, '/');
  29. header('HTTP/1.1 301 Moved Permanently');
  30. header('Location: '.$langurl);
  31. exit;
  32. }
  33. /*end*/
  34. /*首页焦点*/
  35. $m = input('param.m/s');
  36. if (empty($m)) {
  37. $this->request->get(['m'=>'Index']);
  38. }
  39. /*end*/
  40. $filename = 'index.html';
  41. $seo_pseudo = config('ey_config.seo_pseudo');
  42. if (file_exists($filename) && 2 == $seo_pseudo && !isset($_GET['clear'])) {
  43. if ((isMobile() && !file_exists('./template/mobile')) || !isMobile()) {
  44. header('HTTP/1.1 301 Moved Permanently');
  45. header('Location:index.html');
  46. exit;
  47. }
  48. }
  49. /*获取当前页面URL*/
  50. $result['pageurl'] = request()->url(true);
  51. /*--end*/
  52. $eyou = array(
  53. 'field' => $result,
  54. );
  55. $this->eyou = array_merge($this->eyou, $eyou);
  56. $this->assign('eyou', $this->eyou);
  57. /*模板文件*/
  58. $viewfile = 'index';
  59. /*--end*/
  60. /*多语言内置模板文件名*/
  61. if (!empty($this->home_lang)) {
  62. $viewfilepath = TEMPLATE_PATH.$this->theme_style.DS.$viewfile."_{$this->home_lang}.".$this->view_suffix;
  63. if (file_exists($viewfilepath)) {
  64. $viewfile .= "_{$this->home_lang}";
  65. }
  66. }
  67. /*--end*/
  68. $html = $this->fetch(":{$viewfile}");
  69. return $html;
  70. }
  71. /**
  72. * 支付宝回调
  73. */
  74. private function alipay_return()
  75. {
  76. $param = input('param.');
  77. if (isset($param['transaction_type']) && isset($param['is_ailpay_notify'])) {
  78. // 跳转处理回调信息
  79. $pay_logic = new PayLogic();
  80. $pay_logic->alipay_return();
  81. }
  82. }
  83. /**
  84. * 快递100返回时,重定向关闭父级弹框
  85. */
  86. private function Express100()
  87. {
  88. $coname = input('param.coname/s', '');
  89. $m = input('param.m/s', '');
  90. if (!empty($coname) || 'user' == $m) {
  91. if (isWeixin()) {
  92. $this->redirect(url('user/Shop/shop_centre'));
  93. exit;
  94. }else{
  95. $this->redirect(url('api/Rewrite/close_parent_layer'));
  96. exit;
  97. }
  98. }
  99. }
  100. }