diff --git a/app/index/model/Document.php b/app/index/model/Document.php index a1fa3a6..db5ee99 100644 --- a/app/index/model/Document.php +++ b/app/index/model/Document.php @@ -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'); - } + } \ No newline at end of file diff --git a/app/index/model/DocumentArticle.php b/app/index/model/DocumentArticle.php index 6546c3c..442d63e 100644 --- a/app/index/model/DocumentArticle.php +++ b/app/index/model/DocumentArticle.php @@ -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 { /** * 列表 diff --git a/app/index/model/DocumentCategory.php b/app/index/model/DocumentCategory.php index 6c28d46..572af5c 100644 --- a/app/index/model/DocumentCategory.php +++ b/app/index/model/DocumentCategory.php @@ -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() : []; - } } \ No newline at end of file diff --git a/app/index/model/DocumentCategoryContent.php b/app/index/model/DocumentCategoryContent.php index f3f3ee0..ac0558a 100644 --- a/app/index/model/DocumentCategoryContent.php +++ b/app/index/model/DocumentCategoryContent.php @@ -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'); - } } \ No newline at end of file diff --git a/app/index/model/DocumentProduct.php b/app/index/model/DocumentProduct.php index 754a151..7bfcb11 100644 --- a/app/index/model/DocumentProduct.php +++ b/app/index/model/DocumentProduct.php @@ -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'); - } } \ No newline at end of file diff --git a/app/index/model/FriendLink.php b/app/index/model/FriendLink.php index 8cd7545..9a506ad 100644 --- a/app/index/model/FriendLink.php +++ b/app/index/model/FriendLink.php @@ -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'); - } } \ No newline at end of file diff --git a/app/index/model/MessageForm.php b/app/index/model/MessageForm.php index a6eabb7..e609af4 100644 --- a/app/index/model/MessageForm.php +++ b/app/index/model/MessageForm.php @@ -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'); - } } \ No newline at end of file diff --git a/app/index/model/Slides.php b/app/index/model/Slides.php index e3cf404..810e8f3 100644 --- a/app/index/model/Slides.php +++ b/app/index/model/Slides.php @@ -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'); - } } \ No newline at end of file diff --git a/app/index/model/UrlLog.php b/app/index/model/UrlLog.php new file mode 100644 index 0000000..3c94101 --- /dev/null +++ b/app/index/model/UrlLog.php @@ -0,0 +1,17 @@ +