// +---------------------------------------------------------------------- namespace app\common\repositories\system; use app\common\dao\system\AppUpdateDao; use app\common\repositories\BaseRepository; use think\db\exception\DbException; use think\exception\ValidateException; use think\facade\Cache; /** * Class LhappRepository * @package app\common\repositories\system * @author xaboy * @day 2020-04-24 * @mixin CacheDao */ class LhappRepository extends BaseRepository { /** * CacheRepository constructor. * @param CacheDao $dao */ public function __construct(AppUpdateDao $dao) { $this->dao = $dao; } public function getList($where, $page, $limit) { $query = $this->dao->search($where); $count = $query->count(); $list = $query->page($page, $limit)->order('id DESC')->select(); return compact('count', 'list'); } public function detail($id) { $find = $this->dao->search(['id' => $id])->find(); if (!$find) throw new ValidateException('数据不存在'); return $find; } public function delete($id) { $res = $this->dao->delete($id); return $res; } }