Go.php 707 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace addons\cms\controller;
  3. use addons\cms\model\Autolink;
  4. use think\Config;
  5. /**
  6. * 跳转控制器
  7. * Class Go
  8. * @package addons\cms\controller
  9. */
  10. class Go extends Base
  11. {
  12. protected $noNeedLogin = ['*'];
  13. public function index()
  14. {
  15. $url = $this->request->get("url", "", 'trim,xss_clean');
  16. $id = $this->request->get("id/d", "0");
  17. if ($id) {
  18. $autolink = Autolink::get($id);
  19. if ($autolink) {
  20. $autolink->setInc("views");
  21. $this->redirect($autolink['url']);
  22. }
  23. }
  24. Config::set('cms.title', '跳转提示');
  25. return $this->view->fetch("/outlink", ['url' => $url]);
  26. }
  27. }