Files
nl-mall-api/app/Service/CodeGeneration/RegionService.php

88 lines
1.7 KiB
PHP
Raw Normal View History

<?php
namespace App\Service\CodeGeneration;
use App\BaseApp\BaseService;
use App\Models\RegionModel;
use Exception;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class RegionService extends BaseService
{
public function __construct()
{
parent::__construct();
$this->selectField = ["id", "name", "pid", "status", "price", "created_at", "updated_at", "deleted_at"];
$this->queryField = ['name' => '=','pid' => '=,status='];
$this->model = RegionModel::class;
}
/**
* 获取地区列表
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function list(): array
{
return $this->getPageList();
}
/**
* 获取地区详情
* @param $id
* @return mixed
* @throws Exception
*/
public function detail($id)
{
return $this->getDetail($id);
}
/**
* 地区下拉列表
* @return mixed
*/
public function option()
{
$this->optionField = ['id', 'name'];
return $this->getOption();
}
/**
* 创建地区
* @param $params
* @return mixed
* @throws Exception
*/
public function create($params): mixed
{
return $this->insert($params);
}
/**
* 编辑地区
* @param $id
* @param $params
* @return mixed
* @throws Exception
*/
public function update($id, $params): mixed
{
return $this->save($id, $params);
}
/**
* 删除地区
* @param $ids
* @return mixed|true
* @throws Exception
*/
public function delete($ids): mixed
{
return $this->del($ids);
}
}