multi-store/app/admin/lists/user_ship/UserShipLists.php

65 lines
1.4 KiB
PHP

<?php
namespace app\admin\lists\user_ship;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\user_ship\UserShip;
use app\common\lists\ListsSearchInterface;
/**
* 会员类型列表
* Class UserShipLists
* @package app\admin\listsuser_ship
*/
class UserShipLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/06/29 14:18
*/
public function setSearch(): array
{
return [
'=' => ['title'],
];
}
/**
* @notes 获取会员类型列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/06/29 14:18
*/
public function lists(): array
{
return UserShip::where($this->searchWhere)
->field(['id', 'title', 'discount', 'limit', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取会员类型数量
* @return int
* @author admin
* @date 2024/06/29 14:18
*/
public function count(): int
{
return UserShip::where($this->searchWhere)->count();
}
}