59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\adminapi\logic\fence_house\FenceHouseLogic;
|
|
use app\adminapi\validate\fence_house\FenceHouseValidate;
|
|
use app\api\lists\FenceHouseLists;
|
|
use think\response\Json;
|
|
|
|
class FenceHouseController extends BaseApiController
|
|
{
|
|
public function list()
|
|
{
|
|
return $this->dataLists(new FenceHouseLists());
|
|
}
|
|
public function add()
|
|
{
|
|
$params = (new FenceHouseValidate())->post()->goCheck('add');
|
|
$result = FenceHouseLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(FenceHouseLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/01/10 15:15
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new FenceHouseValidate())->post()->goCheck('edit');
|
|
$result = FenceHouseLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(FenceHouseLogic::getError());
|
|
}
|
|
|
|
public function detail()
|
|
{
|
|
$params = (new FenceHouseValidate())->goCheck('detail');
|
|
$result = FenceHouseLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @return Json
|
|
*/
|
|
public function datas(): Json
|
|
{
|
|
$params = ['user_id', $this->userId];
|
|
$datas = (new FenceHouseLogic())->datas($params);
|
|
return $this->data($datas);
|
|
}
|
|
} |