123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- <?php
-
-
-
- namespace app\home\controller;
-
- use think\Db;
- use app\user\logic\PayLogic;
-
- class Index extends Base
- {
- public function _initialize()
- {
- parent::_initialize();
- $this->wechat_return();
- $this->alipay_return();
- $this->Express100();
- $this->ey_agent();
- $this->tikTok_return();
- }
-
- public function index()
- {
-
- $sub_doman = request()->subDomain();
- $home_site = get_home_site();
-
- if (empty($sub_doman) || $sub_doman == "www" || $sub_doman == "zc.dev") {
- $this->assign("city_domain_name", $sub_doman);
- } else {
- if ($sub_doman == $home_site) {
-
-
- return action('home/City/provincial', 138);
- }else{
-
-
- $city = Db::name('citysite')->where(['domain'=>$sub_doman])->find();
-
- if(empty($city)){
-
- header('HTTP/1.1 301 Moved Permanently');
-
- header('Location: https://www.zc10000.com');
-
- exit();
- }else{
-
-
-
- if((int)$city['status'] === 0 || (int)$city['is_open'] === 0){
- header('HTTP/1.1 301 Moved Permanently');
-
- header('Location: https://www.zc10000.com');
-
- exit();
- }else{
-
-
- return action('home/City/chenshi', 139);
- }
- }
- }
- }
-
- $preview_templet = input('param.templet/s');
-
- $lang = input('param.lang/s');
- if (preg_match("/\?lang=" . $this->home_lang . "\/$/i", $this->request->url(true)) && $lang == $this->home_lang . '/') {
- $langurl = $this->request->url(true);
- $langurl = rtrim($langurl, '/');
- header('HTTP/1.1 301 Moved Permanently');
- header('Location: ' . $langurl);
- exit;
- }
-
-
-
- $m = input('param.m/s');
- if (empty($m)) {
- $this->request->get(['m' => 'Index']);
- }
-
-
- $filename = 'index.html';
- $seo_pseudo = config('ey_config.seo_pseudo');
- if (!isset($_GET['clear']) && file_exists($filename) && 2 == $seo_pseudo) {
- if ((isMobile() && !file_exists('./template/' . TPL_THEME . 'mobile')) || !isMobile()) {
- header('HTTP/1.1 301 Moved Permanently');
- header('Location:' . $filename);
- exit;
- }
- } else if (!isset($_GET['clear']) && 2 == $seo_pseudo && !empty($this->eyou['global']['seo_showmod']) && !empty($this->eyou['global']['seo_html_position'])) {
- $seo_html_position_arr = explode('/', $this->eyou['global']['seo_html_position']);
- $filename = end($seo_html_position_arr);
- if (file_exists($filename)) {
- $html = @file_get_contents($filename);
- if (!empty($html)) {
- echo $html;
- exit;
- }
- }
- }
-
- $result['pageurl'] = $this->request->url(true);
- $result['pageurl_m'] = pc_to_mobile_url($result['pageurl']);
-
- if (!config('city_switch_on')) {
- if (3 != $seo_pseudo && stristr($result['pageurl'], '/Index/index')) {
- to_index("404");
- } else if (3 == $seo_pseudo && preg_match('/m=([^&]+)&c=([^&]+)&a=([^&]+)/i', $result['pageurl'])) {
- to_index("404");
- }
- }
-
-
- $result['mobile_domain'] = '';
- if (!empty($this->eyou['global']['web_mobile_domain_open']) && !empty($this->eyou['global']['web_mobile_domain'])) {
- $result['mobile_domain'] = $this->eyou['global']['web_mobile_domain'] . '.' . $this->request->rootDomain();
- }
- $eyou = array(
- 'field' => $result,
- );
- $this->eyou = array_merge($this->eyou, $eyou);
- $this->assign('eyou', $this->eyou);
-
-
- $viewfile = 'index';
- if (config('city_switch_on') && !empty($this->home_site)) {
- $viewfilepath = TEMPLATE_PATH . $this->theme_style_path . DS . $this->home_site;
- $viewfilepath2 = TEMPLATE_PATH . $this->theme_style_path . DS . 'city' . DS . $this->home_site;
- if (!empty($this->eyou['global']['site_template'])) {
- if (file_exists($viewfilepath2)) {
- $viewfile = "city/{$this->home_site}/{$viewfile}";
- } else if (file_exists($viewfilepath)) {
- $viewfile = "{$this->home_site}/{$viewfile}";
- }
- }
- } else if (config('lang_switch_on') && !empty($this->home_lang)) {
- $viewfilepath = TEMPLATE_PATH . $this->theme_style_path . DS . $viewfile . "_{$this->home_lang}." . $this->view_suffix;
- if (file_exists($viewfilepath)) {
- $viewfile .= "_{$this->home_lang}";
- }
- }
-
-
-
- $html = '';
-
- if (file_exists('./weapp/Recruits/model/RecruitsModel.php')) {
- $recruitsModel = new \weapp\Recruits\model\RecruitsModel;
- $recruitsViewfile = $recruitsModel->setHome($this->eyou);
- if (!empty($recruitsViewfile)) {
- $this->assign('eyou', $this->eyou);
- $html = $this->fetch($recruitsViewfile);
- return $html;
- }
- }
-
-
-
- if (!empty($preview_templet)) {
- $viewfile = preg_replace('/\.(.*)$/i', '', $preview_templet);
- }
- $html = $this->fetch(":{$viewfile}");
-
- return $html;
- }
-
-
-
- private function wechat_return()
- {
-
- $InputXml = file_get_contents("php://input");
- if (!empty($InputXml)) {
- $pay_info = Db::name('pay_api_config')->where('pay_mark', 'wechat')->value('pay_info');
- if (!empty($pay_info)) {
- $pay_info = unserialize($pay_info);
- if (empty($pay_info['appid']) || !stristr($InputXml, "[{$pay_info['appid']}]")) {
- return true;
- }
- } else {
- return true;
- }
-
-
- $JsonXml = json_encode(simplexml_load_string($InputXml, 'SimpleXMLElement', LIBXML_NOCDATA));
-
- $JsonArr = json_decode($JsonXml, true);
-
- if (!empty($JsonArr) && 'SUCCESS' == $JsonArr['result_code'] && 'SUCCESS' == $JsonArr['return_code']) {
-
- $attach = explode('|,|', $JsonArr['attach']);
- if (!empty($attach) && 'wechat' == $attach[0] && 'is_notify' == $attach[1] && !empty($attach[2])) {
-
- $pay_logic = new PayLogic();
- $pay_logic->wechat_return($JsonArr);
- }
- }
- }
- }
-
-
-
- private function tikTok_return()
- {
- $inputData = file_get_contents("php://input");
- if (!empty($inputData)) {
- $inputData = json_decode($inputData, true);
- $inputData['msg'] = !empty($inputData['msg']) ? json_decode($inputData['msg'], true) : [];
- if (!empty($inputData['msg'])) model('TikTok')->tikTokAppletsPayDealWith($inputData, true);
- }
- }
-
-
-
- private function alipay_return()
- {
- $param = input('param.');
- if (isset($param['transaction_type']) && isset($param['is_notify'])) {
-
- $pay_logic = new PayLogic();
- $pay_logic->alipay_return();
- }
- }
-
-
-
- private function Express100()
- {
- $coname = input('param.coname/s', '');
- $m = input('param.m/s', '');
- if (!empty($coname) || 'user' == $m) {
- if (isWeixin()) {
- $this->redirect(url('user/Shop/shop_centre'));
- exit;
- } else {
- $this->redirect(url('api/Rewrite/close_parent_layer'));
- exit;
- }
- }
- }
-
-
-
- private function ey_agent()
- {
- $ey_agent = input('param.ey_agent/d', 0);
- if (!IS_AJAX && !empty($ey_agent) && 'home' == MODULE_NAME) {
- to_index("404");
- }
- }
-
-
-
- private function getViewFile($viewfile = "index")
- {
-
- if (config('city_switch_on') && !empty($this->home_site)) {
- $viewfilepath = TEMPLATE_PATH . $this->theme_style_path . DS . $this->home_site;
- $viewfilepath2 = TEMPLATE_PATH . $this->theme_style_path . DS . 'city' . DS . $this->home_site;
- if (!empty($this->eyou['global']['site_template'])) {
- if (file_exists($viewfilepath2)) {
- $viewfile = "city/{$this->home_site}/{$viewfile}";
- } else if (file_exists($viewfilepath)) {
- $viewfile = "{$this->home_site}/{$viewfile}";
- }
- }
- } else if (config('lang_switch_on') && !empty($this->home_lang)) {
- $viewfilepath = TEMPLATE_PATH . $this->theme_style_path . DS . $viewfile . "_{$this->home_lang}." . $this->view_suffix;
- if (file_exists($viewfilepath)) {
- $viewfile .= "_{$this->home_lang}";
- }
- }
-
- return $viewfile;
- }
-
-
-
- public function category()
- {
-
- $viewfile = $this->getViewFile($this->request->action());
- $html = '';
- $html = $this->fetch(":{$viewfile}");
-
- return $html;
- }
-
-
-
- public function goods()
- {
- $viewfile = $this->getViewFile($this->request->action());
- $html = '';
- $html = $this->fetch(":{$viewfile}");
-
- return $html;
- }
-
-
-
- public function article()
- {
- $viewfile = $this->getViewFile($this->request->action());
- $html = '';
- $html = $this->fetch(":{$viewfile}");
-
- return $html;
- }
-
-
-
- public function categoryall()
- {
-
- $viewfile = $this->getViewFile($this->request->action());
- $html = '';
- $html = $this->fetch(":{$viewfile}");
-
- return $html;
- }
- }
|