add
This commit is contained in:
parent
10a04f15f0
commit
51e80acad3
|
@ -5,6 +5,7 @@ namespace app\api\controller;
|
|||
use app\adminapi\logic\fence_house\FenceHouseLogic;
|
||||
use app\adminapi\validate\fence_house\FenceHouseValidate;
|
||||
use app\api\lists\FenceHouseLists;
|
||||
use app\common\model\fence_house\FenceHouse;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
|
@ -68,6 +69,25 @@ class FenceHouseController extends BaseApiController
|
|||
return $this->success('离栏成功');
|
||||
}
|
||||
|
||||
// 离栏列表
|
||||
public function leaveList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$pageNo = $params['page_no'] ?? 1;
|
||||
$params['create_time'] = time();
|
||||
$params['update_time'] = time();
|
||||
$lists = Db::name('leave_fence_house_log')->where('user_id', $this->userId)->append(['fence_house_name'])->withAttr('fence_house_name',function ($value, $data){
|
||||
return FenceHouse::where('id', $data['fence_house_id'])->value('fence_house_name');
|
||||
})->page($pageNo, $params['page_size'])->select();
|
||||
$data = [
|
||||
'lists' => $lists,
|
||||
'count' => Db::name('leave_fence_house_log')->where('user_id', $this->userId)->count(),
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $params['page_size'],
|
||||
];
|
||||
return $this->success('成功', $data);
|
||||
}
|
||||
|
||||
// 换栏操作
|
||||
public function exchange()
|
||||
{
|
||||
|
@ -78,4 +98,28 @@ class FenceHouseController extends BaseApiController
|
|||
return $this->success('换栏成功');
|
||||
}
|
||||
|
||||
public function exchangeList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$pageNo = $params['page_no'] ?? 1;
|
||||
$params['create_time'] = time();
|
||||
$params['update_time'] = time();
|
||||
$lists = Db::name('change_fence_house_log')->where('user_id', $this->userId)->append(['old_fence_house_name', 'new_fence_house_name'])
|
||||
->withAttr('old_fence_house_name',function ($value, $data){
|
||||
return FenceHouse::where('id', $data['old_fence_house_id'])->value('fence_house_name');
|
||||
})
|
||||
->withAttr('new_fence_house_name',function ($value, $data){
|
||||
return FenceHouse::where('id', $data['new_fence_house_id'])->value('fence_house_name');
|
||||
})
|
||||
->page($pageNo, $params['page_size'])
|
||||
->select();
|
||||
$data = [
|
||||
'lists' => $lists,
|
||||
'count' => Db::name('change_fence_house_log')->where('user_id', $this->userId)->count(),
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $params['page_size'],
|
||||
];
|
||||
return $this->success('成功', $data);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue