CommonController.class.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. * ==========================================================================
  6. * @link https://www.nanodreamtech.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.nanodreamtech.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Home\Controller;
  15. use Think\Controller;
  16. class CommonController extends Controller{
  17. /* 初始化,权限控制,菜单显示 */
  18. protected function _initialize(){
  19. /* 读取数据库中的配置 */
  20. $config = S('DB_CONFIG_DATA');
  21. if(!$config){
  22. $config = api('Config/lists');
  23. S('DB_CONFIG_DATA',$config);
  24. }
  25. C($config); //添加配置
  26. if(!C('WEB_SITE_CLOSE')){
  27. die('站点已经关闭,请稍后访问~');
  28. }
  29. //模拟进入电脑端
  30. if(isset($_GET['front']))
  31. {
  32. session('user_auth', null);
  33. session('user_auth_sign', null);
  34. cookie('auth_rp_string','', -1);
  35. }
  36. if(!$this->is_weixin() && !isset($_GET['ok']) && !is_login())
  37. {
  38. $this->site_in = 'computer';
  39. }else {
  40. $this->site_in = 'weixin';
  41. $rmid = I('get.rmid',0);
  42. if( !empty($rmid) )
  43. {
  44. cookie('rmid', $rmid);
  45. }
  46. if(!is_login() && !in_array(CONTROLLER_NAME,array('Public','Platform','Utility','Payment','Image','Apiindex','Apiquan','Apicart','Apigoods','Apiuser','Api','Apicheckout') ))
  47. {
  48. }
  49. }
  50. //share_rmid/NjAwXzBfMA==
  51. }
  52. public function is_weixin(){
  53. if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
  54. return true;
  55. }
  56. return false;
  57. }
  58. /* 空操作,用于输出404页面 */
  59. public function _empty(){
  60. // $this->display('Public:404');die();
  61. //die('空操作');
  62. header('Location: seller.php');
  63. die();
  64. var_dump($_SERVER['REQUEST_URI']);die();
  65. $data = array();
  66. $data['domain'] = $_SERVER['REQUEST_URI'];
  67. $data['add_time'] = time();
  68. M('bad_domain')->add($data);
  69. $this->redirect('Index/index');
  70. }
  71. }
  72. ?>