shoppingmallv2 init...
This commit is contained in:
parent
cd4398a4f8
commit
ed372396b6
@ -213,7 +213,14 @@ abstract class BaseController extends Controller
|
||||
//변견된 데이터 Log로 남기기
|
||||
foreach ($this->_viewDatas['fieldDatas'] as $field => $value) {
|
||||
if ($field != "passwd") { //보안위험성이 있으므로 passwd는 Log에 남기지 않는다.
|
||||
log_message("info", "{$field} 변경: ---원본--\n%s\n---변경---\n%s", $entity->$field, var_export($value, true));
|
||||
log_message(
|
||||
"info",
|
||||
sprintf(
|
||||
"{$field} 변경: ---원본--\n%s\n---변경---\n%s",
|
||||
$entity->$field,
|
||||
var_export($value, true)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ abstract class FrontController extends BaseController
|
||||
//권한체크
|
||||
final protected function isRole($action, $entity = null)
|
||||
{
|
||||
$this->_category = !is_null($entity) ? $entity->getCategory_Uid() : ($this->request->getVar('category') ?: throw new \Exception("범주를 지정하지 않으셨습니다."));
|
||||
$this->_category = !is_null($entity) ? $entity->category_uid : ($this->request->getVar('category') ?: throw new \Exception("범주를 지정하지 않으셨습니다."));
|
||||
$this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category]);
|
||||
$categorys = $this->getCategoryModel()->getSiblingEntitys($this->_viewDatas['category']);
|
||||
$this->_viewDatas['parent_category'] = array_shift($categorys);
|
||||
|
||||
@ -6,9 +6,11 @@ use CodeIgniter\Entity\Entity;
|
||||
|
||||
abstract class BaseEntity extends Entity
|
||||
{
|
||||
abstract public function getPrimaryKey();
|
||||
abstract public function getTitle(): string;
|
||||
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
$this->attributes['uid'];
|
||||
}
|
||||
//조화수관련 Field전용
|
||||
final public function getViews($field = 'view_cnt')
|
||||
{
|
||||
@ -16,22 +18,30 @@ abstract class BaseEntity extends Entity
|
||||
}
|
||||
|
||||
//파일관련 Field전용
|
||||
|
||||
final public function getFileDownload($field = "upload_file")
|
||||
{
|
||||
if (is_null($this->attributes[$field])) {
|
||||
return "";
|
||||
}
|
||||
$files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
|
||||
return anchor(
|
||||
current_url() . "/download/{$field}/{$this->getPrimaryKey()}",
|
||||
ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field])[1],
|
||||
base_url() . "/download/{$field}/{$this->getPrimaryKey()}",
|
||||
ICONS['IMAGE_FILE'] . $files[0],
|
||||
["target" => "_self"]
|
||||
);
|
||||
}
|
||||
//이미지관련 Field전용
|
||||
final public function getFileImage($field = "photo", $size = false)
|
||||
{
|
||||
if (is_null($this->attributes[$field])) {
|
||||
return "";
|
||||
}
|
||||
$files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
|
||||
return sprintf(
|
||||
"<img src=\"/upload_images/%s%s\">",
|
||||
"<img src=\"/upload_images/%s%s\" alt=\"%s\">",
|
||||
$size ? $size . '_' : '',
|
||||
explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field])[1]
|
||||
$files[1],
|
||||
$files[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,10 +9,6 @@ class BoardEntity extends BaseHierarchyEntity
|
||||
protected $casts = [];
|
||||
|
||||
//기본기능
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->attributes['title'];
|
||||
@ -23,20 +19,8 @@ class BoardEntity extends BaseHierarchyEntity
|
||||
}
|
||||
|
||||
//추가기능
|
||||
public function getCategory_Uid()
|
||||
{
|
||||
return $this->attributes['category_uid'];
|
||||
}
|
||||
public function getUser_Uid()
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
}
|
||||
public function getBoardFile()
|
||||
{
|
||||
return $this->attributes['board_file'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,10 +9,6 @@ class CategoryEntity extends BaseHierarchyEntity
|
||||
protected $casts = [];
|
||||
|
||||
//기본기능
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
@ -23,23 +19,4 @@ class CategoryEntity extends BaseHierarchyEntity
|
||||
}
|
||||
|
||||
//추가기능
|
||||
public function getHead()
|
||||
{
|
||||
return $this->attributes['head'];
|
||||
}
|
||||
public function getTail()
|
||||
{
|
||||
return $this->attributes['tail'];
|
||||
}
|
||||
public function getRole($field = 'isaccess')
|
||||
{
|
||||
return array_key_exists(
|
||||
$field,
|
||||
$this->attributes
|
||||
) ? $this->attributes[$field] : DEFAULTS['ROLE'];
|
||||
}
|
||||
public function getPhoto()
|
||||
{
|
||||
return $this->attributes['photo'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,10 +10,6 @@ class OrderEntity extends BaseEntity
|
||||
protected $casts = [];
|
||||
|
||||
//기본기능
|
||||
final public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
final public function getTitle(): string
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
@ -24,20 +20,4 @@ class OrderEntity extends BaseEntity
|
||||
}
|
||||
|
||||
//추가기능
|
||||
final public function getProduct_uid()
|
||||
{
|
||||
return $this->attributes['product_uid'];
|
||||
}
|
||||
final public function getUser_uid()
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
final public function getPrice()
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
}
|
||||
final public function getQuantity()
|
||||
{
|
||||
return $this->attributes['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,10 +9,6 @@ class ProductEntity extends BaseEntity
|
||||
protected $casts = [];
|
||||
|
||||
//기본기능
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
@ -23,36 +19,4 @@ class ProductEntity extends BaseEntity
|
||||
}
|
||||
|
||||
//추가기능
|
||||
public function getCategory_uid()
|
||||
{
|
||||
return $this->attributes['category_uid'];
|
||||
}
|
||||
public function getUer_uid()
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
public function getCost()
|
||||
{
|
||||
return $this->attributes['cost'];
|
||||
}
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->attributes['price'];
|
||||
}
|
||||
public function getSale()
|
||||
{
|
||||
return $this->attributes['sale'];
|
||||
}
|
||||
public function getPhoto()
|
||||
{
|
||||
return $this->attributes['photo'];
|
||||
}
|
||||
public function getContent()
|
||||
{
|
||||
return $this->attributes['content'];
|
||||
}
|
||||
public function getStock()
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,10 +9,6 @@ class UserEntity extends BaseEntity
|
||||
protected $casts = [];
|
||||
|
||||
//기본기능
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
@ -23,11 +19,6 @@ class UserEntity extends BaseEntity
|
||||
}
|
||||
|
||||
//추가기능
|
||||
public function getRole()
|
||||
{
|
||||
return $this->attributes['role'];
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user