2024-01-15 17:10:07 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
use app\adminapi\logic\fence_house\FenceHouseLogic;
|
|
|
|
use app\adminapi\validate\fence_house\FenceHouseValidate;
|
2024-01-25 13:37:49 +08:00
|
|
|
use app\api\lists\FenceHouseLists;
|
2024-01-30 09:11:31 +08:00
|
|
|
use think\facade\Db;
|
2024-01-17 11:59:25 +08:00
|
|
|
use think\response\Json;
|
2024-01-15 17:10:07 +08:00
|
|
|
|
|
|
|
class FenceHouseController extends BaseApiController
|
|
|
|
{
|
2024-01-25 13:37:49 +08:00
|
|
|
public function list()
|
|
|
|
{
|
|
|
|
return $this->dataLists(new FenceHouseLists());
|
|
|
|
}
|
2024-01-15 17:10:07 +08:00
|
|
|
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);
|
|
|
|
}
|
2024-01-17 11:59:25 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Json
|
|
|
|
*/
|
|
|
|
public function datas(): Json
|
|
|
|
{
|
|
|
|
$params = ['user_id', $this->userId];
|
|
|
|
$datas = (new FenceHouseLogic())->datas($params);
|
|
|
|
return $this->data($datas);
|
|
|
|
}
|
2024-01-30 09:11:31 +08:00
|
|
|
|
|
|
|
// 离栏操作
|
|
|
|
public function leave()
|
|
|
|
{
|
|
|
|
$params = $this->request->param();
|
|
|
|
$params['create_time'] = time();
|
|
|
|
$params['update_time'] = time();
|
|
|
|
Db::name('leave_fence_house_log')->insert($params);
|
|
|
|
return $this->success('离栏成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
// 换栏操作
|
|
|
|
public function exchange()
|
|
|
|
{
|
|
|
|
$params = $this->request->param();
|
|
|
|
$params['create_time'] = time();
|
|
|
|
$params['update_time'] = time();
|
|
|
|
Db::name('change_fence_house_log')->insert($params);
|
|
|
|
return $this->success('换栏成功');
|
|
|
|
}
|
|
|
|
|
2024-01-15 17:10:07 +08:00
|
|
|
}
|