12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- declare(strict_types=1);
- namespace app\logics;
- use app\model\ToolDecohelper;
- /**
- * 装修助手
- */
- class ToolDecohelperLogic
- {
- /**
- * 列表获取
- */
- public function list($where=[], $page=null, $limit=null)
- {
- $modelObj = ToolDecohelper::where($where);
- if(!is_null($page)) $modelObj->page($page);
- if(!is_null($limit)) $modelObj->limit($limit);
- $data = $modelObj->order('type,id')->select()->toArray();
- return $data;
- }
- /**
- * 总数获取
- */
- public function count($where=[])
- {
- $modelObj = ToolDecohelper::where($where);
- $num = $modelObj->count();
- return $num;
- }
- /**
- * 保存
- */
- public function save($data)
- {
- if (isset($data['id'])) {
- return ToolDecohelper::update($data);
- } else {
- return ToolDecohelper::create($data);
- }
- }
- /**
- * 删除
- */
- public function delete($id)
- {
- return ToolDecohelper::destroy($id);
- }
- /*
- * 获取单独post
- */
- public function getpost($title){
- return ToolDecohelper::where('title',$title)->find();
- }
- }
|