Procházet zdrojové kódy

1,type,link标签新增not参数。
2,vod,art,actor,website新增typenot参数。
3,修复自定义规则查看采集内容的问题。
4,修复标签独立缓存时间cachetime参数失效的问题。
5,其他细节。

magicblack před 5 roky
rodič
revize
930d55d016

+ 16 - 2
application/admin/controller/Cj.php

@@ -160,10 +160,9 @@ class Cj extends Base
 
         $param['page'] = isset($param['page']) ? intval($param['page']) : 1;
 
-        $url_list = $urls[$param['page']];
+        $url_list = $urls[$param['page']-1];
         $url = $collection->get_url_lists($url_list, $data);
 
-
         $total = count($url);
         $re = 0;
         if (is_array($url) && !empty($url)) {
@@ -312,6 +311,21 @@ class Cj extends Base
         return $this->fetch('admin@cj/publish');
     }
 
+    public function show()
+    {
+        $id = input('id');
+        $where=[];
+        $where['id'] = ['eq',$id];
+        $info = Db::name('cj_content')->where($where)->find();
+        if(!empty($info['data'])){
+            $info['data'] = @json_decode($info['data'],true);
+        }
+        $this->assign('info',$info);
+        $this->assign('title','详情信息');
+        return $this->fetch('admin@cj/show');
+
+    }
+
     public function content_del()
     {
         $param = input();

+ 4 - 0
application/admin/controller/User.php

@@ -15,6 +15,10 @@ class User extends Base
         $param['page'] = intval($param['page']) <1 ? 1 : $param['page'];
         $param['limit'] = intval($param['limit']) <1 ? $this->_pagesize : $param['limit'];
 
+        if($param['page'] ==1){
+            model('User')->expire();
+        }
+
         $where=[];
         if(in_array($param['status'],['0','1'],true)){
             $where['user_status'] = $param['status'];

+ 1 - 1
application/admin/view/cj/publish.html

@@ -40,7 +40,7 @@
                             <td>{$vo.title}</td>
                             <td>{$vo.url}</td>
                             <td>
-                                <a class="layui-badge-rim " data-href="{:url('show?ids='.$vo['id'])}" href="javascript:;" title="查看">查看</a>
+                                <a class="layui-badge-rim j-iframe " data-href="{:url('show?id='.$vo['id'])}" href="javascript:;" title="查看">查看</a>
                             </td>
                         </tr>
                         {/volist}

+ 64 - 0
application/admin/view/cj/show.html

@@ -0,0 +1,64 @@
+{include file="../../../application/admin/view/public/head" /}
+
+<div class="page-container p10">
+    <form class="layui-form layui-form-pane" method="post" action="">
+
+        <div class="layui-form-item">
+            <label class="layui-form-label">url:</label>
+            <div class="layui-input-block">
+                <input type="text" class="layui-input" value="{$info.url}" lay-verify="url" placeholder="" id="url" name="url">
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label">title:</label>
+            <div class="layui-input-block">
+                <input type="text" class="layui-input" value="{$info.title}" lay-verify="title" placeholder="" id="title" name="title">
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label">other:</label>
+            <div class="layui-input-block">
+                {volist name="$info.data" id="vo"}
+                    {$key}<input type="text" class="layui-input" value="{$vo}"><br>
+                {/volist}
+            </div>
+        </div>
+
+        <div class="layui-form-item center">
+            <div class="layui-input-block">
+
+            </div>
+        </div>
+    </form>
+
+</div>
+
+{include file="../../../application/admin/view/public/foot" /}
+
+<script type="text/javascript">
+    layui.use(['form', 'layer'], function () {
+        // 操作对象
+        var form = layui.form
+                , layer = layui.layer
+                , $ = layui.jquery;
+
+        // 验证
+        form.verify({
+            link_name: function (value) {
+                if (value == "") {
+                    return "请输入链接名称";
+                }
+            },
+            link_url: function (value) {
+                if (value == "") {
+                    return "请输入链接地址";
+                }
+            }
+        });
+
+
+    });
+</script>
+
+</body>
+</html>

+ 8 - 2
application/common/model/Actor.php

@@ -91,7 +91,7 @@ class Actor extends Base {
         $hits = $lp['hits'];
         $not = $lp['not'];
         $cachetime = $lp['cachetime'];
-
+        $typenot = $lp['typenot'];
         $page = 1;
         $where = [];
         $totalshow=0;
@@ -229,6 +229,9 @@ class Actor extends Base {
                 $where['type_id'] = ['in', implode(',', $type)];
             }
         }
+        if(!empty($typenot)){
+            $where['type_id'] = ['not in',$typenot];
+        }
         if(!empty($tid)) {
             $where['type_id|type_id_1'] = ['eq',$tid];
         }
@@ -323,10 +326,13 @@ class Actor extends Base {
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('actor_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$page,$num,$start,'*',1,$totalshow);
             if($GLOBALS['config']['app']['cache_core']==1){
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 8 - 2
application/common/model/Art.php

@@ -145,6 +145,7 @@ class Art extends Base {
         $hits = $lp['hits'];
         $not = $lp['not'];
         $cachetime = $lp['cachetime'];
+        $typenot = $lp['typenot'];
         $page = 1;
         $where = [];
         $totalshow=0;
@@ -279,6 +280,9 @@ class Art extends Base {
                 $where['type_id'] = ['in', implode(',', $type)];
             }
         }
+        if(!empty($typenot)){
+            $where['type_id'] = ['not in',$typenot];
+        }
         if(!empty($tid)) {
             $where['type_id|type_id_1'] = ['eq',$tid];
         }
@@ -368,12 +372,14 @@ class Art extends Base {
             $where_cache['order'] = 'rnd';
         }
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('art_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
-
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$page,$num,$start,'*',1,$totalshow);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 9 - 2
application/common/model/Link.php

@@ -40,7 +40,7 @@ class Link extends Base {
         $start = intval(abs($lp['start']));
         $num = intval(abs($lp['num']));
         $cachetime = $lp['cachetime'];
-
+        $not = $lp['not'];
         $page = 1;
         $where = [];
 
@@ -60,15 +60,22 @@ class Link extends Base {
             $type = ($type === 'font') ? 0 : 1;
             $where['link_type'] = $type;
         }
+        if(!empty($not)){
+            $where['link_id'] = ['not in',explode(',',$not)];
+        }
+
         $by = 'link_'.$by;
         $order = $by . ' ' . $order;
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' . md5('link_listcache_'.join('&',$where).'_'.$order.'_'.$page.'_'.$num.'_'.$start);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where, $order, $page, $num, $start);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         return $res;

+ 4 - 3
application/common/model/Role.php

@@ -96,7 +96,6 @@ class Role extends Base {
         $hits = $lp['hits'];
         $not = $lp['not'];
         $cachetime = $lp['cachetime'];
-
         $page = 1;
         $where = [];
         $totalshow=0;
@@ -259,12 +258,14 @@ class Role extends Base {
         }
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' . md5('role_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
-
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$page,$num,$start,'*',1,$totalshow);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 4 - 1
application/common/model/Topic.php

@@ -247,10 +247,13 @@ class Topic extends Base {
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('topic_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$page,$num,$start,'*',$totalshow);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 9 - 1
application/common/model/Type.php

@@ -97,6 +97,7 @@ class Type extends Base {
         $start = intval(abs($lp['start']));
         $num = intval(abs($lp['num']));
         $cachetime = $lp['cachetime'];
+        $not = $lp['not'];
         $page=1;
         $where = [];
 
@@ -163,6 +164,10 @@ class Type extends Base {
             }
             $where['type_pid'] = ['in',$parent];
         }
+        if(!empty($not)){
+            $where['type_id'] = ['not in',$not];
+        }
+
         if(defined('ENTRANCE') && ENTRANCE == 'index' && $GLOBALS['config']['app']['popedom_filter'] ==1){
             $type_ids = mac_get_popedom_filter($GLOBALS['user']['group']['group_type']);
             if(!empty($type_ids)){
@@ -182,11 +187,14 @@ class Type extends Base {
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('type_listcache_'.http_build_query($where).'_'.$order.'_'.$num.'_'.$start);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$format,$mid,$num,$start,0);
             $res['list'] = array_values($res['list']);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
 

+ 16 - 0
application/common/model/User.php

@@ -394,6 +394,22 @@ class User extends Base
         return ['code' => 1, 'msg' => '登录成功'];
     }
 
+    public function expire()
+    {
+        $where=[];
+        $where['group_id'] = ['gt',2];
+        $where['user_end_time'] = ['elt',time()];
+
+        $update=[];
+        $update['group_id'] = 2;
+
+        $res = $this->where($where)->update($update);
+        if ($res === false) {
+            return ['code' => 101, 'msg' => '更新会员组过期会员信息失败'];
+        }
+        return ['code' => 1, 'msg' => '更新过期信息成功'];
+    }
+
     public function logout()
     {
         cookie('user_id', null);

+ 8 - 1
application/common/model/Vod.php

@@ -140,6 +140,7 @@ class Vod extends Base {
         $cachetime = $lp['cachetime'];
         $isend = $lp['isend'];
         $plot = $lp['plot'];
+        $typenot = $lp['typenot'];
 
         $page = 1;
         $where=[];
@@ -337,6 +338,9 @@ class Vod extends Base {
                 $where['type_id'] = ['in', implode(',',$type) ];
             }
         }
+        if(!empty($typenot)){
+            $where['type_id'] = ['not in',$typenot];
+        }
         if(!empty($tid)) {
             $where['type_id|type_id_1'] = ['eq',$tid];
         }
@@ -446,10 +450,13 @@ class Vod extends Base {
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('vod_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where, $order, $page, $num, $start,'*',1, $totalshow);
             if($GLOBALS['config']['app']['cache_core']==1) {
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 8 - 2
application/common/model/Website.php

@@ -137,7 +137,7 @@ class Website extends Base {
         $hits = $lp['hits'];
         $not = $lp['not'];
         $cachetime = $lp['cachetime'];
-
+        $typenot = $lp['typenot'];
         $refermonth = $lp['refermonth'];
         $referweek = $lp['refermonth'];
         $referday = $lp['refermonth'];
@@ -269,6 +269,9 @@ class Website extends Base {
                 $where['type_id'] = ['in', implode(',', $type)];
             }
         }
+        if(!empty($typenot)){
+            $where['type_id'] = ['not in',$typenot];
+        }
         if(!empty($tid)) {
             $where['type_id|type_id_1'] = ['eq',$tid];
         }
@@ -395,10 +398,13 @@ class Website extends Base {
 
         $cach_name = $GLOBALS['config']['app']['cache_flag']. '_' .md5('website_listcache_'.http_build_query($where_cache).'_'.$order.'_'.$page.'_'.$num.'_'.$start.'_'.$pageurl);
         $res = Cache::get($cach_name);
+        if(empty($cachetime)){
+            $cachetime = $GLOBALS['config']['app']['cache_time'];
+        }
         if($GLOBALS['config']['app']['cache_core']==0 || empty($res)) {
             $res = $this->listData($where,$order,$page,$num,$start,'*',1,$totalshow);
             if($GLOBALS['config']['app']['cache_core']==1){
-                Cache::set($cach_name, $res, $GLOBALS['config']['app']['cache_time']);
+                Cache::set($cach_name, $res, $cachetime);
             }
         }
         $res['pageurl'] = $pageurl;

+ 6 - 6
application/common/taglib/Maccms.php

@@ -6,7 +6,7 @@ use think\Db;
 class Maccms extends Taglib {
 
 	protected $tags = [
-	    'link'=> ['attr'=>'order,by,type,start,num,cachetime'],
+	    'link'=> ['attr'=>'order,by,type,not,start,num,cachetime'],
         'area'=> ['attr'=>'order,start,num'],
         'lang'=> ['attr'=>'order,start,num'],
         'year'=> ['attr'=>'order,start,num'],
@@ -14,15 +14,15 @@ class Maccms extends Taglib {
         'version'=> ['attr'=>'order,start,num'],
         'state'=> ['attr'=>'order,start,num'],
         'letter'=> ['attr'=>'order,start,num'],
-        'type' => ['attr' =>'order,by,start,num,id,ids,parent,flag,mid,format,cachetime'],
+        'type' => ['attr' =>'order,by,start,num,id,ids,not,parent,flag,mid,format,cachetime'],
         'comment'=>['attr' =>'order,by,start,num,paging,pageurl,id,pid,rid,mid,uid,half'],
         'gbook'=>['attr' =>'order,by,start,num,paging,pageurl,rid,uid,half'],
         'role'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,rid,actor,name,level,letter,half,timeadd,timehits,time,cachetime'],
-        'actor'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,sex,name,level,letter,type,starsign,blood,half,timeadd,timehits,time,cachetime'],
+        'actor'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,sex,name,level,letter,type,typenot,starsign,blood,half,timeadd,timehits,time,cachetime'],
         'topic' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,class,tag,half,timeadd,timehits,time,cachetime'],
-        'art' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,class,tag,level,letter,half,rel,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,cachetime'],
-        'vod' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,class,tag,area,lang,year,level,letter,half,rel,version,state,tv,weekday,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,isend,cachetime'],
-        'website'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,lang,name,level,letter,type,half,timeadd,timehits,time,cachetime'],
+        'art' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,typenot,class,tag,level,letter,half,rel,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,cachetime'],
+        'vod' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,typenot,class,tag,area,lang,year,level,letter,half,rel,version,state,tv,weekday,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,isend,cachetime'],
+        'website'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,lang,name,level,letter,type,typenot,half,timeadd,timehits,time,cachetime'],
         'foreach' => ['attr'=>'name,id,key'],
         'for' => ['attr'=>'start,end,comparison,step,name'],
     ];

+ 4 - 1
application/common/util/Collection.php

@@ -145,12 +145,15 @@ class Collection {
      */
     public static function url_list(&$config, $num = '') {
         $url = array();
+
         switch ($config['sourcetype']) {
             case '1'://序列化
                 $num = empty($num) ? $config['pagesize_end'] : $num;
                 if($num<$config['pagesize_start']) $num=$config['pagesize_start'];
+                $p=0;
                 for ($i = $config['pagesize_start']; $i <= $num; $i = $i + $config['par_num']) {
-                    $url[$i] = str_replace('(*)', $i, $config['urlpage']);
+                    $url[$p] = str_replace('(*)', $i, $config['urlpage']);
+                    $p++;
                 }
                 break;
             case '2'://多网址

+ 1 - 1
application/extra/version.php

@@ -3,7 +3,7 @@ return array (
     'name' => '苹果CMS',
     'copyright' => 'MacCMS.LA',
     'url' => '//www.maccms.la/',
-    'code' => '2019.1000.1029',
+    'code' => '2020.1000.1030',
     'license' => '免费版',
 );
 ?>

+ 1 - 0
说明文档/标签说明.txt

@@ -269,6 +269,7 @@ num获取条数
 ids指定分类parent获取一级分诶;child获取子分类;1,2,3一组指定ID;
 parent父分类id
 flag视频=vod文章=art
+not排除id
 cachetime自定义缓存时间单位秒
 
 {maccms:type num="10" order="asc" by="sort" ids="all"}