Files
zzp-server/app/adminapi/lists/setting/RechargeMethodLists.php
2026-01-19 14:19:22 +08:00

87 lines
2.2 KiB
PHP

<?php
namespace app\adminapi\lists\setting;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\setting\RechargeMethod;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsSortInterface;
/**
* 充值方式列表
* Class RechargeMethodLists
* @package app\adminapi\listssetting
*/
class RechargeMethodLists extends BaseAdminDataLists implements ListsSearchInterface,ListsSortInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2023/11/30 15:22
*/
public function setSearch(): array
{
return [
'=' => ['lang_id', 'type', 'name', 'is_show'],
];
}
/**
* @notes 设置支持排序字段
* @return array
* @author BD
* @date 2022/2/9 15:11
*/
public function setSortFields(): array
{
return ['create_time' => 'create_time', 'id' => 'id'];
}
/**
* @notes 设置默认排序
* @return array
* @author BD
* @date 2022/2/9 15:08
*/
public function setDefaultOrder(): array
{
return ['sort' => 'desc', 'id' => 'desc'];
}
/**
* @notes 获取充值方式列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2023/11/30 15:22
*/
public function lists(): array
{
return RechargeMethod::where($this->searchWhere)
->append(['lang_name','vip_name'])
->field(['id', 'lang_id', 'type', 'name', 'logo', 'account', 'img', 'bank_name', 'bank_username', 'main_coin_type', 'coin_type', 'protocol', 'address', 'member_id', 'avail_num', 'rate', 'symbol_rate','precision', 'symbol' ,'is_show' ,'is_voucher', 'sort'])
->limit($this->limitOffset, $this->limitLength)
->order($this->sortOrder)
->select()
->toArray();
}
/**
* @notes 获取充值方式数量
* @return int
* @author BD
* @date 2023/11/30 15:22
*/
public function count(): int
{
return RechargeMethod::where($this->searchWhere)->count();
}
}