shoppingmallv2 init...

This commit is contained in:
최준흠 2023-07-31 17:43:31 +09:00
parent eded6d0637
commit 789d2c5cb7
9 changed files with 20 additions and 19 deletions

View File

@ -18,11 +18,4 @@ abstract class BaseHierarchyBackend extends BaseBackend
{ {
return $this->_model->reply($entity, $fieldDatas); return $this->_model->reply($entity, $fieldDatas);
} }
//View관련
public function view($entity)
{
// view_cnt에 추가하기위함
$this->_model->increaseViewCount($entity->getPrimaryKey());
return parent::view($entity);
}
} }

View File

@ -36,4 +36,12 @@ class BoardBackend extends BaseHierarchyBackend
} }
return $options; return $options;
} }
//View관련
public function view($entity)
{
//view_cnt에 추가하기위함
$this->_model->increaseViewCount($entity->getPrimaryKey());
return parent::view($entity);
}
} }

View File

@ -64,7 +64,7 @@ class Services extends BaseService
} }
return new \App\Backend\CategoryBackend(); return new \App\Backend\CategoryBackend();
} }
public static function prodcut($getShared = true) public static function product($getShared = true)
{ {
if ($getShared) { if ($getShared) {
return static::getSharedInstance('product'); return static::getSharedInstance('product');

View File

@ -515,7 +515,7 @@ abstract class BaseController extends Controller
final public function download(string $field, $uid) final public function download(string $field, $uid)
{ {
try { try {
$entity = $this->_backend->getEntity([$this->_backend->getPrimaryKey() => $uid]); $entity = $this->_backend->getEntity($uid);
if (!$entity->$field) { if (!$entity->$field) {
throw new \Exception("첨부파일이 확인되지 않습니다."); throw new \Exception("첨부파일이 확인되지 않습니다.");
} }

View File

@ -25,7 +25,7 @@ function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, ar
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break; break;
case "status": case "status":
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Categor.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes); return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
break; break;
case 'updated_at': case 'updated_at':

View File

@ -74,10 +74,10 @@ class CategoryModel extends BaseHierarchyModel
$old_title = ""; $old_title = "";
foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) { foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) {
if ($entity->getPrimaryKey() == $entity->getHierarchy_No()) { if ($entity->getPrimaryKey() == $entity->getHierarchy_No()) {
$options[$entity->getTitleField()] = []; $options[$entity->getTitle()] = [];
$old_title = $entity->getTitleField(); $old_title = $entity->getTitle();
} else { } else {
$options[$old_title][$entity->getPrimaryKey()] = $entity->getTitleField(); $options[$old_title][$entity->getPrimaryKey()] = $entity->getTitle();
} }
} }
return $options; return $options;

View File

@ -22,12 +22,12 @@ class OrderModel extends BaseModel
} }
final public function getFields(string $action = ""): array final public function getFields(string $action = ""): array
{ {
$fields = [$this->getTitle(), "quantity", "price", "status"]; $fields = [$this->getTitleField(), "quantity", "price", "status"];
switch ($action) { switch ($action) {
case "index": case "index":
case "excel": case "excel":
case "view": case "view":
return [$this->getTitle(), "user_uid", "sess_id", "quantity", "price", "status", "updated_at", "created_at"]; return [$this->getTitleField(), "user_uid", "sess_id", "quantity", "price", "status", "updated_at", "created_at"];
break; break;
default: default:
return $fields; return $fields;
@ -36,7 +36,7 @@ class OrderModel extends BaseModel
} }
final public function getFieldFilters(): array final public function getFieldFilters(): array
{ {
return [$this->getTitle(), "user_uid", "status"]; return [$this->getTitleField(), "user_uid", "status"];
} }
final public function getFieldBatchFilters(): array final public function getFieldBatchFilters(): array
{ {
@ -45,7 +45,7 @@ class OrderModel extends BaseModel
protected function getFieldRule(string $field, array $rules, string $action = ""): array protected function getFieldRule(string $field, array $rules, string $action = ""): array
{ {
switch ($field) { switch ($field) {
case $this->getTitle(): case $this->getTitleField():
case "user_uid": case "user_uid":
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
break; break;
@ -94,6 +94,6 @@ class OrderModel extends BaseModel
public function setIndexWordFilter(string $word) public function setIndexWordFilter(string $word)
{ {
parent::setIndexWordFilter($word); parent::setIndexWordFilter($word);
$this->orLike($this->getTitle(), $word, "both"); $this->orLike($this->getTitleField(), $word, "both");
} }
} }

View File

@ -21,7 +21,7 @@
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> <tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<td> <td>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> <?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"] ?> <?= $total_count - (($page - 1) * $per_page + $i) ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldIndex_Row_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>