servermgrv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-03 20:23:25 +09:00
parent acc839c1e4
commit e1411ae9de
3 changed files with 16 additions and 1 deletions

View File

@ -433,7 +433,8 @@ abstract class BaseController extends Controller
$this->_viewDatas = $this->init(__FUNCTION__); $this->_viewDatas = $this->init(__FUNCTION__);
helper(['form']); helper(['form']);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
$this->_viewDatas['entity'] = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['entity'] = $this->view_process($entity);
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return view($this->_viewPath . '/view', $this->_viewDatas); return view($this->_viewPath . '/view', $this->_viewDatas);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -60,4 +60,11 @@ class BoardController extends FrontController
} }
return $this->_viewDatas['fieldDatas']; return $this->_viewDatas['fieldDatas'];
} }
//View관련
protected function view_process($entity)
{
$entity = parent::view_process($entity);
return $this->_model->addViewCount($entity);
}
} }

View File

@ -95,4 +95,11 @@ class BoardModel extends BaseHierarchyModel
$this->orLike($this->getTitleField(), $word, "both"); $this->orLike($this->getTitleField(), $word, "both");
$this->orLike("content", $word, "both"); //befor , after , both $this->orLike("content", $word, "both"); //befor , after , both
} }
//조회수 올리기
final public function addViewCount(BoardEntity $entity, int $view_cnt = 1): BoardEntity
{
$entity->view_cnt += $view_cnt;
return $this->save_process($entity);
}
} }