| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\api\lists\property;
- use app\api\lists\BaseApiDataLists;
- use app\common\lists\ListsSearchInterface;
- use app\common\model\property\PropertyHead;
- use app\common\model\property\PropertySurplusLog;
- /**
- * 订单列表
- */
- class PropertySurplusLogLists extends BaseApiDataLists implements ListsSearchInterface
- {
- public function setSearch(): array
- {
- return [
- '=' => ['status','property_head_id'],
- ];
- }
- public function queryWhere()
- {
- // 指定用户
- $propertyHeadId = PropertyHead::where('user_id',$this->userId)->value('id');
- $where[] = ['property_head_id', '=', $propertyHeadId];
- return $where;
- }
- public function lists(): array
- {
- $lists = PropertySurplusLog::where($this->searchWhere)
- ->where($this->queryWhere())
- ->limit($this->limitOffset, $this->limitLength)
- ->field(['id','in_out','amount','status','remark','create_time','update_time','property_head_id'])
- ->order('create_time desc')
- ->select()
- ->toArray();
- return $lists;
- }
- /**
- * @notes 获取数量
- * @return int
- */
- public function count(): int
- {
- return PropertySurplusLog::where($this->searchWhere)->where($this->queryWhere())->count();
- }
- }
|