This commit is contained in:
chenbo 2024-01-30 14:27:53 +08:00
parent 9b67276a3e
commit 1956f2b25c
1 changed files with 6 additions and 8 deletions

View File

@ -63,8 +63,8 @@ class FenceHouseController extends BaseApiController
public function leave() public function leave()
{ {
$params = $this->request->param(); $params = $this->request->param();
$params['create_time'] = time(); $params['create_time'] = date('Y-m-d H:i:s', time());
$params['update_time'] = time(); $params['update_time'] = date('Y-m-d H:i:s', time());
Db::name('leave_fence_house_log')->insert($params); Db::name('leave_fence_house_log')->insert($params);
return $this->success('离栏成功'); return $this->success('离栏成功');
} }
@ -74,8 +74,6 @@ class FenceHouseController extends BaseApiController
{ {
$params = $this->request->param(); $params = $this->request->param();
$pageNo = $params['page_no'] ?? 1; $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){ $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'); return FenceHouse::where('id', $data['fence_house_id'])->value('fence_house_name');
})->page($pageNo, $params['page_size'])->select(); })->page($pageNo, $params['page_size'])->select();
@ -92,8 +90,8 @@ class FenceHouseController extends BaseApiController
public function exchange() public function exchange()
{ {
$params = $this->request->param(); $params = $this->request->param();
$params['create_time'] = time(); $params['create_time'] = date('Y-m-d H:i:s', time());
$params['update_time'] = time(); $params['update_time'] = date('Y-m-d H:i:s', time());
Db::name('change_fence_house_log')->insert($params); Db::name('change_fence_house_log')->insert($params);
return $this->success('换栏成功'); return $this->success('换栏成功');
} }
@ -102,8 +100,8 @@ class FenceHouseController extends BaseApiController
{ {
$params = $this->request->param(); $params = $this->request->param();
$pageNo = $params['page_no'] ?? 1; $pageNo = $params['page_no'] ?? 1;
$params['create_time'] = time(); $params['create_time'] = date('Y-m-d H:i:s', time());
$params['update_time'] = time(); $params['update_time'] = date('Y-m-d H:i:s', time());
$lists = Db::name('change_fence_house_log')->where('user_id', $this->userId)->append(['old_fence_house_name', 'new_fence_house_name']) $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){ ->withAttr('old_fence_house_name',function ($value, $data){
return FenceHouse::where('id', $data['old_fence_house_id'])->value('fence_house_name'); return FenceHouse::where('id', $data['old_fence_house_id'])->value('fence_house_name');