where($where) ->field($field) ->order($order) ->paginate(['list_rows' => $pageCount, 'page' => $page]) ->toArray(); return [$data['total'], $data['data']]; } /** * 获取显示的充值配置 * @return array */ public function getShowList() { return $this ->where('is_show', 1) ->order('sort asc,id asc') ->select() ->toArray(); } /** * 获取默认充值配置 * @return array|null */ public function getDefault() { return $this ->where('is_default', 1) ->where('is_show', 1) ->find(); } /** * 根据ID获取充值配置 * @param int $id 配置ID * @return array|null */ public function getById($id) { return $this->where('id', $id)->find(); } /** * 保存充值配置 * @param array $data 数据 * @return bool|int */ public function saveData($data) { return $this->insert($data); } /** * 更新充值配置 * @param int $id 配置ID * @param array $data 数据 * @return bool */ public function updateConfig($id, $data): bool { return $this->where('id', $id)->update($data) !== false; } /** * 删除充值配置 * @param int $id 配置ID * @return bool */ public function deleteData($id) { return $this->where('id', $id)->delete(); } }