Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Download.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 think\Db;
  15. class Download extends Base
  16. {
  17. // 模型标识
  18. public $nid = 'download';
  19. // 模型ID
  20. public $channeltype = '';
  21. public function _initialize()
  22. {
  23. parent::_initialize();
  24. $channeltype_list = config('global.channeltype_list');
  25. $this->channeltype = $channeltype_list[$this->nid];
  26. }
  27. public function lists($tid)
  28. {
  29. $tid_tmp = $tid;
  30. $seo_pseudo = config('ey_config.seo_pseudo');
  31. if (empty($tid)) {
  32. $map = array(
  33. 'channeltype' => $this->channeltype,
  34. 'parent_id' => 0,
  35. 'is_hidden' => 0,
  36. 'status' => 1,
  37. );
  38. } else {
  39. if (3 == $seo_pseudo) {
  40. $map = array('dirname' => $tid);
  41. } else {
  42. if (!is_numeric($tid) || strval(intval($tid)) !== strval($tid)) {
  43. to_index("404");
  44. }
  45. $map = array('id' => $tid);
  46. }
  47. }
  48. $map['lang'] = $this->home_lang; // 多语言
  49. $row = M('arctype')->field('id,dirname')->where($map)->order('sort_order asc')->limit(1)->find();
  50. $tid = !empty($row['id']) ? intval($row['id']) : 0;
  51. $dirname = !empty($row['dirname']) ? $row['dirname'] : '';
  52. /*301重定向到新的伪静态格式*/
  53. $this->jumpRewriteFormat($tid, $dirname, 'lists');
  54. /*--end*/
  55. if (3 == $seo_pseudo) {
  56. $tid = $dirname;
  57. } else {
  58. $tid = $tid_tmp;
  59. }
  60. return action('home/Lists/index', $tid);
  61. }
  62. public function view($aid)
  63. {
  64. $param = I('param.');
  65. $aid = !empty($param['aid']) ? intval($param['aid']) : '';
  66. if (empty($aid)) {
  67. to_index("404");
  68. }
  69. $result = model('Download')->getInfo($aid);
  70. if (empty($result)) {
  71. to_index("404");
  72. } elseif ($result['arcrank'] == -1) {
  73. $this->success('待审核稿件,你没有权限阅读!');
  74. exit;
  75. }
  76. // 外部链接跳转
  77. if ($result['is_jump'] == 1) {
  78. header('Location: ' . $result['jumplinks']);
  79. exit;
  80. }
  81. /*--end*/
  82. $tid = $result['typeid'];
  83. $arctypeInfo = model('Arctype')->getInfo($tid);
  84. /*301重定向到新的伪静态格式*/
  85. $this->jumpRewriteFormat($aid, $arctypeInfo['dirname'], 'view');
  86. /*--end*/
  87. return action('home/View/index', $aid);
  88. }
  89. }