mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
fbc3cee33a
commit
fde1e60552
|
|
@ -3,39 +3,15 @@
|
|||
|
||||
namespace app\index\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class Document
|
||||
* @package app\admin\model\system
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class Document extends BaseModel
|
||||
class Document extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
$categoryList = DocumentCategory::where('id','in',array_column($data,'category_id'))->column('title','id');
|
||||
foreach ($data as &$item){
|
||||
if (!empty($categoryList[$item['category_id']])){
|
||||
$item['category_title'] = $categoryList[$item['category_id']];
|
||||
}else{
|
||||
$item['category_title'] = '';
|
||||
}
|
||||
}
|
||||
return compact('data','count');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class DocumentArticle
|
||||
|
|
@ -12,7 +12,7 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class DocumentArticle extends BaseModel
|
||||
class DocumentArticle extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class DocumentCategory
|
||||
|
|
@ -12,44 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class DocumentCategory extends BaseModel
|
||||
class DocumentCategory extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$model = $model->field(['id','pid','title','sort','display'])->order('sort asc,id asc');
|
||||
if (isset($where['title']) && $where['title'] != '') $model = $model->where("title|id","like","%$where[title]%");
|
||||
$data = $model->select();
|
||||
return $data->toArray() ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类选择类型
|
||||
* @param int $type
|
||||
* @param array $ids
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public static function selectByType(int $type = 0,array $ids = [])
|
||||
{
|
||||
$model = new self;
|
||||
if (!empty($ids)) $model = $model->where("id","not in", $ids);
|
||||
if ($type != 0) $model = $model->where("type",$type);
|
||||
$model = $model->where("status",1);
|
||||
$model = $model->field("id,title");
|
||||
$data = $model->select();
|
||||
return $data ? $data->toArray() : [];
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class DocumentCategoryContent
|
||||
|
|
@ -12,25 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class DocumentCategoryContent extends BaseModel
|
||||
class DocumentCategoryContent extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data','count');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class DocumentProduct
|
||||
|
|
@ -12,25 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class DocumentProduct extends BaseModel
|
||||
class DocumentProduct extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data','count');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class FriendLink
|
||||
|
|
@ -12,29 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class FriendLink extends BaseModel
|
||||
class FriendLink extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
if ($where['title'] != '') $model = $model->where("title|url","like","%$where[title]%");
|
||||
if ($where['start_time'] != '') $model = $model->where("create_time",">",strtotime($where['start_time']." 00:00:00"));
|
||||
if ($where['end_time'] != '') $model = $model->where("create_time","<", strtotime($where['end_time']." 23:59:59"));
|
||||
if ($where['status'] != '') $model = $model->where("status",$where['status']);
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data','count');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class Document
|
||||
|
|
@ -12,31 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class MessageForm extends BaseModel
|
||||
class MessageForm extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$model = $model->order('create_time','desc');
|
||||
if (isset($where['name']) && $where['name'] !== '') $model->where('name', "like", "%$where[name]%");
|
||||
if (isset($where['email']) && $where['email'] !== '') $model->where('email', "like", "%$where[email]%");
|
||||
if (isset($where['tel']) && $where['tel'] !== '') $model->where('tel', "like", "%$where[tel]%");
|
||||
if (isset($where['start_time']) && $where['start_time'] != '') $model = $model->where("m.created_at", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||
if (isset($where['end_time']) && $where['end_time'] != '') $model = $model->where("m.created_at", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data','count');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
namespace app\index\model;
|
||||
|
||||
|
||||
use app\admin\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class Slides
|
||||
|
|
@ -12,29 +12,6 @@ use app\admin\model\BaseModel;
|
|||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class Slides extends BaseModel
|
||||
class Slides extends Model
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']);
|
||||
$data = $model->select()->each(function ($item){
|
||||
if (!empty($item->pic)){
|
||||
$item->pic = file_cdn($item->pic);
|
||||
}
|
||||
});
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data','count');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class UrlLog
|
||||
* @package app\index\model
|
||||
* @author 李玉坤
|
||||
* @date 2021-05-09 23:04
|
||||
*/
|
||||
class UrlLog extends Model
|
||||
{
|
||||
}
|
||||
Loading…
Reference in New Issue