完善标签功能
This commit is contained in:
@@ -25,4 +25,18 @@ class Channel extends \think\Model {
|
||||
$status = [0 => '禁用', 1 => '启用'];
|
||||
return isset($status[$data['status']]) ? $status[$data['status']] : '禁用';
|
||||
}
|
||||
|
||||
public static function getChannelList($pid, $tree){
|
||||
$map = [];
|
||||
$map[] = ['status', '=', 1];
|
||||
if ($pid !== '') {
|
||||
$map[] = ['pid', '=', $pid];
|
||||
}
|
||||
|
||||
$list = self::where($map)->order('sort asc, id desc')->column("*");
|
||||
if ($tree) {
|
||||
$list = (new \sent\tree\Tree())->listToTree($list);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
33
app/model/Document.php
Normal file
33
app/model/Document.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 文档模型
|
||||
*/
|
||||
class Document {
|
||||
|
||||
public static function getDocumentList($model, $category_id, $limit = 20, $order = "id desc", $field = "*"){
|
||||
$map = [];
|
||||
if (!$model) {
|
||||
return [];
|
||||
}
|
||||
//判断model是否为内容模型
|
||||
$info = Model::where('name', $model)->where('status', 1)->findOrEmpty();
|
||||
|
||||
if ($info->isEmpty()) {
|
||||
return [];
|
||||
}
|
||||
$list = Db::name($model)->where($map)->limit($limit)->order($order)->field($field)->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user