|
123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
-
- namespace app\admin\model;
-
- use think\Model;
-
- class Target extends Model
- {
-
- public function getAll($param, $page, $pageSize)
- {
- unset($param['page']);
- unset($param['pageSize']);
- foreach ($param as $k => $v) {
- if ($param[$k] === '' || $param[$k] === null) {
- unset($param[$k]);
- }
- }
- if (empty($pageSize)) {
- $result = $this->where($param)->select();
- return ['rows' => $result];
- } else {
- $result = $this->where($param)->limit($page, $pageSize)->select();
- $total = $this->where($param)->count();
- return ['rows' => $result, 'total' => $total];
- }
- }
-
- // public function read($param)
- // {
- // $result = $this->where($this->getPk(), $param[$this->getPk()])->find();
- // if (isset($result[$this->getPk()])) {
- // return $result->toArray();
- // } else {
- // return [];
- // }
- // }
-
- }
|