91 lines
2.3 KiB
PHP
91 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Service\CodeGeneration;
|
||
|
|
|
||
|
|
use App\BaseApp\BaseService;
|
||
|
|
use App\Models\StoreModel;
|
||
|
|
use Exception;
|
||
|
|
use Psr\Container\ContainerExceptionInterface;
|
||
|
|
use Psr\Container\NotFoundExceptionInterface;
|
||
|
|
|
||
|
|
class StoreService extends BaseService
|
||
|
|
{
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
parent::__construct();
|
||
|
|
$this->selectField = ["id", "name", "level", "avatar", "introduction", "classification_id", "description", "phone", "person", "id_card", "qr_code", "is_featured", "business_license", "id_card_portrait_side", "id_card_national_emblem_side", "chain", "business_suspended", "status", "created_at", "updated_at", "deleted_at"];
|
||
|
|
$this->queryField = ['name' => '=','level' => '=','phone' => 'like','person' => '=','classification_id' => '=','is_featured' => '=','chain' => '=','business_suspended' => '=,status='];
|
||
|
|
$this->model = StoreModel::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
|
||
|
|
{
|
||
|
|
$this->utils->checkPhone($params['phone']);
|
||
|
|
$this->utils->checkIdCard($params['id_card']);
|
||
|
|
return $this->insert($params);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 编辑店铺管理
|
||
|
|
* @param $id
|
||
|
|
* @param $params
|
||
|
|
* @return mixed
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public function update($id, $params): mixed
|
||
|
|
{
|
||
|
|
$this->utils->checkPhone($params['phone']);
|
||
|
|
return $this->save($id, $params);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除店铺管理
|
||
|
|
* @param $ids
|
||
|
|
* @return mixed|true
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public function delete($ids): mixed
|
||
|
|
{
|
||
|
|
return $this->del($ids);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|