shoppingmallv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-03 20:12:45 +09:00
parent b31992a0fe
commit 70ba4dc67b
4 changed files with 28 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -53,4 +53,11 @@ class ProductController extends FrontController
}
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("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);
}
}

View File

@ -115,6 +115,13 @@ class ProductModel extends BaseModel
$this->orLike("content", $word, "both"); //befor , after , both
}
//조회수 올리기
final public function addViewCount(ProductEntity $entity, int $view_cnt = 1): ProductEntity
{
$entity->view_cnt += $view_cnt;
return $this->save_process($entity);
}
//장바구니에 넣기
final public function addCart(ProductEntity $entity, int $quantity): ProductEntity
{