servermgrv2 init...
This commit is contained in:
parent
acc839c1e4
commit
e1411ae9de
@ -433,7 +433,8 @@ abstract class BaseController extends Controller
|
||||
$this->_viewDatas = $this->init(__FUNCTION__);
|
||||
helper(['form']);
|
||||
$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']);
|
||||
return view($this->_viewPath . '/view', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -60,4 +60,11 @@ class BoardController extends FrontController
|
||||
}
|
||||
return $this->_viewDatas['fieldDatas'];
|
||||
}
|
||||
|
||||
//View관련
|
||||
protected function view_process($entity)
|
||||
{
|
||||
$entity = parent::view_process($entity);
|
||||
return $this->_model->addViewCount($entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,4 +95,11 @@ class BoardModel extends BaseHierarchyModel
|
||||
$this->orLike($this->getTitleField(), $word, "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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user