shoppingmallv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-01 22:55:18 +09:00
parent de896074a3
commit 9746aa3a96
14 changed files with 51 additions and 24 deletions

View File

@ -125,6 +125,24 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
}); });
}); });
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) { $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
$routes->group('user', ['namespace' => 'App\Controllers\Front', 'filter' => 'authFilter:master,director,cloudflare,manager,gold,silver,brone,vip,user'], static function ($routes) {
$routes->get('update', 'UserController::update_form');
$routes->post('update', 'UserController::update');
$routes->get('view', 'UserController::view');
});
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
$routes->get('excel', 'BoardController::excel/$1');
$routes->get('insert', 'BoardController::insert_form');
$routes->post('insert', 'BoardController::insert');
$routes->get('update/(:num)', 'BoardController::update_form/$1');
$routes->post('update/(:num)', 'BoardController::update/$1');
$routes->get('view/(:num)', 'BoardController::view/$1');
$routes->get('reply/(:num)', 'BoardController::reply_form/$1');
$routes->post('reply/(:num)', 'BoardController::reply/$1');
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
$routes->group('product', static function ($routes) { $routes->group('product', static function ($routes) {
$routes->get('', 'ProductController::index'); $routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel/$1'); $routes->get('excel', 'ProductController::excel/$1');

View File

@ -35,14 +35,14 @@ class UserController extends AdminController
public function getFields(string $action = ""): array public function getFields(string $action = ""): array
{ {
$fields = ["id", "passwd", $this->_model->getTitleField(), "email", "role", "status"]; $fields = ["id", "passwd", 'name', "email", "role", "status"];
switch ($action) { switch ($action) {
case "index": case "index":
case "excel": case "excel":
return ["id", $this->_model->getTitleField(), "email", "role", "status", 'created_at']; return ["id", 'name', "email", "role", "status", 'created_at'];
break; break;
case "view": case "view":
return ["id", $this->_model->getTitleField(), "email", "role", "status", 'updated_at', 'created_at']; return ["id", 'name', "email", "role", "status", 'updated_at', 'created_at'];
break; break;
default: default:
return $fields; return $fields;

View File

@ -11,7 +11,7 @@ class UserSNSController extends AdminController
{ {
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
$this->_model = new UserSNSModel(); $this->_model = new UserSNSModel($this->getFields());
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
$this->_viewPath .= strtolower($this->_model->getClassName()); $this->_viewPath .= strtolower($this->_model->getClassName());
@ -19,11 +19,11 @@ class UserSNSController extends AdminController
} }
public function getFields(string $action = ""): array public function getFields(string $action = ""): array
{ {
$fields = ["site", "id", $this->_model->getTitleField(), "email", "detail", "status"]; $fields = ["site", "id", 'name', "email", "detail", "status"];
switch ($action) { switch ($action) {
case "index": case "index":
case "excel": case "excel":
return ["user_uid", "site", "id", $this->_model->getTitleField(), "email", "status", "created_at"]; return ["user_uid", "site", "id", 'name', "email", "status", "created_at"];
break; break;
case "view": case "view":
return [...$fields, "updated_at", "created_at"]; return [...$fields, "updated_at", "created_at"];

View File

@ -21,14 +21,14 @@ class BoardController extends FrontController
public function getFields(string $action = ""): array public function getFields(string $action = ""): array
{ {
$fields = ["board_config_uid", 'title', "board_file", "passwd", "status", "content"]; $fields = ["board_config_uid", 'title', "board_file", "passwd", "content"];
switch ($action) { switch ($action) {
case "index": case "index":
case "excel": case "excel":
return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"]; return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"];
break; break;
case "view": case "view":
return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"]; return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"];
break; break;
default: default:
return $fields; return $fields;
@ -37,7 +37,7 @@ class BoardController extends FrontController
} }
public function getFieldFilters(): array public function getFieldFilters(): array
{ {
return ["board_config_uid", "user_uid", "status"]; return ["board_config_uid", "user_uid"];
} }
public function getFieldBatchFilters(): array public function getFieldBatchFilters(): array
{ {

View File

@ -32,7 +32,7 @@ class OrderController extends FrontController
case "index": case "index":
case "excel": case "excel":
case "view": case "view":
return ['product_uid', "user_uid", "quantity", "price", "status", "updated_at", "created_at"]; return ['product_uid', "quantity", "price", "status", "updated_at", "created_at"];
break; break;
default: default:
return $fields; return $fields;
@ -41,7 +41,7 @@ class OrderController extends FrontController
} }
final public function getFieldFilters(): array final public function getFieldFilters(): array
{ {
return ['product_uid', "user_uid", "status"]; return ['product_uid', "status"];
} }
final public function getFieldBatchFilters(): array final public function getFieldBatchFilters(): array
{ {
@ -105,7 +105,7 @@ class OrderController extends FrontController
{ {
$msg = ""; $msg = "";
try { try {
$this->_viewDatas['fields'] = $this->_model->getFields(__FUNCTION__); $this->_viewDatas['fields'] = $this->getFields(__FUNCTION__);
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], __FUNCTION__); $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], __FUNCTION__);
$this->insert_process(); $this->insert_process();
//Transaction 시작 //Transaction 시작

View File

@ -31,4 +31,8 @@ class BoardEntity extends BaseHierarchyEntity
{ {
return $this->attributes['view_cnt']; return $this->attributes['view_cnt'];
} }
public function getUser_Uid()
{
return $this->attributes['user_uid'];
}
} }

View File

@ -184,10 +184,12 @@ abstract class BaseModel extends Model
$entity->$pk = $this->getUUID(); $entity->$pk = $this->getUUID();
} }
break; break;
case "user_uid": //입력데이터로 있을시 추가, 없을시는 입력의 경우에만 자동으로 추가 case "user_uid": //입력데이터로 있을시 관리툴에서 (사용자,등)추가, 없을시는 입력의 경우에만 자동(장바구니,등)으로 추가
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) { if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
//관리툴 USERSNS에서 사용자 연동 시 추가기능등에 사용
$entity->$field = $formDatas[$field]; $entity->$field = $formDatas[$field];
} elseif ($action == 'create' && $this->_session->get(SESSION_NAMES["ISLOGIN"])) { } elseif ($action == 'create' && $this->_session->get(SESSION_NAMES["ISLOGIN"])) {
//Front에서 장바구니,게시판등에 추가시 로그온한경우 자동 추가기능등에 사용
$auth = $this->_session->get(SESSION_NAMES["AUTH"]); $auth = $this->_session->get(SESSION_NAMES["AUTH"]);
$entity->$field = $auth[AUTH_FIELDS["ID"]]; $entity->$field = $auth[AUTH_FIELDS["ID"]];
} }

View File

@ -25,9 +25,9 @@ class OrderModel extends BaseModel
{ {
switch ($field) { switch ($field) {
case $this->getTitleField(): case $this->getTitleField():
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;
break;
case 'quantity': case 'quantity':
case 'price': case 'price':
$rules[$field] = "required|numeric"; $rules[$field] = "required|numeric";

View File

@ -8,7 +8,7 @@ class UserSNSModel extends BaseModel
{ {
protected $table = "tw_user_sns"; protected $table = "tw_user_sns";
protected $returnType = UserSNSEntity::class; protected $returnType = UserSNSEntity::class;
public function __construct($fields) public function __construct(array $fields = array())
{ {
parent::__construct('UserSNS'); parent::__construct('UserSNS');
$this->allowedFields = [...$this->allowedFields, "user_uid", ...$fields]; $this->allowedFields = [...$this->allowedFields, "user_uid", ...$fields];

View File

@ -18,10 +18,14 @@
<?php foreach ($entitys as $entity) : ?> <?php foreach ($entitys as $entity) : ?>
<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>
<?= $total_count - (($page - 1) * $per_page + $i) ?> <?php if ($session->get(SESSION_NAMES['ISLOGIN']) && $entity->getUser_Uid() == $session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
<?php else : ?>
<?= $total_count - (($page - 1) * $per_page + $i) ?>
<?php endif; ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>

View File

@ -18,11 +18,10 @@
<?php foreach ($entitys as $entity) : ?> <?php foreach ($entitys as $entity) : ?>
<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"]); ?>
<?= $total_count - (($page - 1) * $per_page + $i) ?> <?= $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><?= getFieldView_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>

View File

@ -18,10 +18,10 @@
<?php foreach ($entitys as $entity) : ?> <?php foreach ($entitys as $entity) : ?>
<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>
<? $total_count - (($page - 1) * $per_page + $i) ?> <?= $total_count - (($page - 1) * $per_page + $i) ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldView_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>

View File

@ -2,5 +2,5 @@
<h2><a href=" /front"><i class="fa fa-home"></i>Main</a></h2> <h2><a href=" /front"><i class="fa fa-home"></i>Main</a></h2>
</div> </div>
<div class="accordion-item"> <div class="accordion-item">
<h2><a href="/front/user"><?= CLASS_ICONS['USER'] ?></i>계정 관리</a></h2> <h2><a href="/front/user/view"><?= CLASS_ICONS['USER'] ?></i>계정 관리</a></h2>
</div> </div>

View File

@ -1,3 +1,3 @@
<div class="accordion-item"> <div class="accordion-item">
<h2><a href="/admin/board"><?= CLASS_ICONS['BOARD'] ?>게시글 관리</a></h2> <h2><a href="/front/board"><?= CLASS_ICONS['BOARD'] ?>게시글 관리</a></h2>
</div> </div>