12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * Created by PhpStorm.
- * User: chengxun
- * Date: 2017/7/18
- * Time: 16:14
- */
- use think\Route;
- use think\Request;
- use think\Cookie;
- use think\Config;
- use app\common\model\DomainConfig;
- $host = Request::instance()->host();
- $domain_model = new DomainConfig();
- $domain_data = $domain_model->get_host_module($host);
- //$path = 'logs';
- //$msg = $domain_data;
- //if (! is_dir($path)) {
- // mkdir($path);
- //}
- //$filename = $path . '/' . date('YmdHi') . '.log';
- //$content = date("Y-m-d H:i:s")."\r\n".json_encode($msg,JSON_UNESCAPED_UNICODE)."\r\n \r\n \r\n ";
- //file_put_contents($filename, $content, FILE_APPEND);
- if($host !== null){
- if(empty($domain_data)){
- if(Request::instance()->isMobile()){
- header('Location: '.Config::get('url.mobile'));
- exit;
- }else{
- header('Location: '.Config::get('url.home'));
- exit;
- }
- }elseif ($domain_data['user_id'] > 0){
- $con = Request::instance()->controller();
- $fun = Request::instance()->action();
- Route::domain($host,$domain_data['module']);
- Route::rule('','shop/index');
- Route::rule('index/index','shop/index');
- Cookie::set('shop_id',$domain_data['user_id']);
- }else{
- Route::domain($host,$domain_data['module']);
- }
- if($domain_data['module'] != 'shop'){
- Route::rule('goods/:id','detail/index');//商品链接
- }
- //Route::rule('user','user/index');
- Route::rule('share/:code','share/index');//分享链接
- Route::rule('sweep/:r','Spc/sweep');//扫码二维码
- // Route::rule('c/:c','Spc/sweep');//扫码二维码
- // Route::rule('d/:d','Spc/sweep');//扫码二维码
- Route::rule('query/:data','Spc/query');//扫码结果页
- Route::rule('archive/:token','Spc/archive');//追溯档案展示
- }
|