溯源操作

This commit is contained in:
chenbo 2024-01-25 13:37:49 +08:00
parent d96b19e277
commit 6c4ab07217
5 changed files with 271 additions and 6 deletions

View File

@ -50,9 +50,8 @@ class FenceHouseLogic extends BaseLogic
'capacity' => $params['capacity'],
'master' => $params['master'],
'master_phone' => $params['master_phone'],
'status' => $params['status'],
'qr_code' => $params['qr_code'],
'image' => $params['image'],
'status' => 1,
'pic' => $params['pic'],
]);
Db::commit();
@ -86,8 +85,7 @@ class FenceHouseLogic extends BaseLogic
'master' => $params['master'],
'master_phone' => $params['master_phone'],
'status' => $params['status'],
'qr_code' => $params['qr_code'],
'image' => $params['image'],
'pic' => $params['pic'],
]);
Db::commit();

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\adminapi\logic\animal_info\AnimalInfoLogic;
use app\adminapi\validate\animal_info\AnimalInfoValidate;
use app\api\lists\AnimalInfoLists;
/**
* AnimalInfo控制器
* Class AnimalInfoController
* @package app\adminapi\controller\animal_info
*/
class AnimalInfoController extends BaseApiController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function lists()
{
return $this->dataLists(new AnimalInfoLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function add()
{
$params = (new AnimalInfoValidate())->post()->goCheck('add');
$result = AnimalInfoLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(AnimalInfoLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function edit()
{
$params = (new AnimalInfoValidate())->post()->goCheck('edit');
$result = AnimalInfoLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(AnimalInfoLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function delete()
{
$params = (new AnimalInfoValidate())->post()->goCheck('delete');
AnimalInfoLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function detail()
{
$params = (new AnimalInfoValidate())->goCheck('detail');
$result = AnimalInfoLogic::detail($params);
return $this->data($result);
}
}

View File

@ -2,13 +2,17 @@
namespace app\api\controller;
use app\adminapi\lists\fence_house\FenceHouseLists;
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');

View File

@ -0,0 +1,78 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\animal_info\AnimalInfo;
use app\common\lists\ListsSearchInterface;
/**
* AnimalInfo列表
* Class AnimalInfoLists
* @package app\adminapi\listsanimal_info
*/
class AnimalInfoLists extends BaseApiDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function setSearch(): array
{
return [
'=' => ['sn', 'fence_house_id'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function lists(): array
{
return AnimalInfo::where($this->searchWhere)
->field(['id', 'fence_house_id', 'sn', 'animal_type', 'brand', 'physi_stage', 'gender', 'blood_purity', 'animal_source', 'current_estimation', 'algebra', 'birth', 'entry_date', 'birth_estimation', 'health_condition'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/01/10 15:53
*/
public function count(): int
{
return AnimalInfo::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\fence_house\FenceHouse;
use app\common\lists\ListsSearchInterface;
/**
* FenceHouse列表
* Class FenceHouseLists
* @package app\adminapi\listsfence_house
*/
class FenceHouseLists extends BaseApiDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/01/10 15:15
*/
public function setSearch(): array
{
return [
'=' => ['fence_house_name'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/01/10 15:15
*/
public function lists(): array
{
return FenceHouse::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/01/10 15:15
*/
public function count(): int
{
return FenceHouse::where($this->searchWhere)->count();
}
}