88 lines
1.8 KiB
PHP
88 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Service\CodeGeneration;
|
|
|
|
use App\BaseApp\BaseService;
|
|
use App\Models\ProductImageModel;
|
|
use Exception;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
class ProductImageService extends BaseService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->selectField = ["id", "url", "product_id", "status", "created_at", "updated_at", "deleted_at"];
|
|
$this->queryField = ['url' => 'like','product_id' => '=,status='];
|
|
$this->model = ProductImageModel::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);
|
|
}
|
|
|
|
}
|