From 0784951c551c31b6e9fb8620f0b4fe15c6aa885a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 7 May 2024 14:52:34 +0900 Subject: [PATCH] vhost init...2 --- app/Config/Constants.php | 21 +++++++------- app/Controllers/Admin/AdminController.php | 2 ++ app/Controllers/Admin/Home.php | 3 -- app/Controllers/Front/FrontController.php | 3 +- app/Controllers/Front/ProductController.php | 12 ++------ app/Database/base.sql | 28 ++++++++++++++++++- app/Helpers/Billing_helper.php | 2 +- app/Helpers/Category_helper.php | 2 +- app/Helpers/Order_helper.php | 2 +- app/Helpers/Product_helper.php | 2 +- app/Helpers/Sitepage_helper.php | 2 +- app/Helpers/User_helper.php | 2 +- app/Views/front/product/index.php | 8 +++++- app/Views/front/user/login.php | 2 +- app/Views/front/user/login_v1.php | 2 +- app/Views/layouts/front.php | 2 +- .../templates/front/index_head_product.php | 17 ----------- 17 files changed, 60 insertions(+), 52 deletions(-) delete mode 100644 app/Views/templates/front/index_head_product.php diff --git a/app/Config/Constants.php b/app/Config/Constants.php index f9d6a3e..3e95d76 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -108,7 +108,7 @@ define('LAYOUTS', [ 'front' => [ 'title' => '사용자화면', 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front', - 'menus' => ['aboutus', 'hosting', 'service', 'support'], + 'menus' => ['aboutus', 'hosting', 'serverdevice', 'service', 'support'], 'stylesheets' => [ '', '', @@ -267,17 +267,16 @@ define('CLASS_ICONS', [ 'CARD' => '', 'DEPOSIT' => '', ]); -define('CLASS_TOP_BANNER', [ - 'USER' => '', - 'USERSNS' => '', - 'ORDER' => '', - 'BILLING' => '', - 'CARD' => '', - 'DEPOSIT' => '', - 'PRODUCT' => '', - 'SITEPAGE' => '', - 'BOARD' => '', + +define('TOP_BANNER', [ + 'default' => '', + 'aboutus' => '', + 'hosting' => '', + 'serverdevice' => '', + 'service' => '', + 'support' => '', ]); + define('AUDIOS', [ 'Alram_GetEmail' => '', ]); diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index bbe1e75..a1d2a78 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -15,5 +15,7 @@ abstract class AdminController extends BaseController $this->_viewPath = 'admin/'; $this->_viewDatas['control'] = 'admin'; $this->_viewDatas['layout'] = LAYOUTS['admin']; + $this->_viewDatas['title'] = '관리자페이지'; + $this->_viewDatas['class_icon'] = ''; } } diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index 62cdbb7..4b88d61 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -11,9 +11,6 @@ class Home extends AdminController public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); - $this->_viewDatas['className'] = 'Home'; - $this->_viewDatas['title'] = '관리자페이지'; - $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; } public function getFields(string $action): array diff --git a/app/Controllers/Front/FrontController.php b/app/Controllers/Front/FrontController.php index c1cc263..24c5cdf 100644 --- a/app/Controllers/Front/FrontController.php +++ b/app/Controllers/Front/FrontController.php @@ -19,7 +19,8 @@ abstract class FrontController extends BaseController $this->_viewPath = 'front/'; $this->_viewDatas['control'] = 'front'; $this->_viewDatas['layout'] = LAYOUTS['front']; - $this->_viewDatas['title'] = LAYOUTS['front']['title']; + $this->_viewDatas['title'] = '사용자화면'; + $this->_viewDatas['class_icon'] = ''; $this->_viewDatas['menus'] = $this->getCategoryModel()->getMenus(); $this->_viewDatas['category'] = false; } diff --git a/app/Controllers/Front/ProductController.php b/app/Controllers/Front/ProductController.php index dc7844e..befce17 100644 --- a/app/Controllers/Front/ProductController.php +++ b/app/Controllers/Front/ProductController.php @@ -45,17 +45,11 @@ class ProductController extends FrontController return parent::getFieldBatchFilters(); } - //권한체크 - protected function isRole($action) - { - $this->_category = $this->request->getVar('category') ?: throw new \Exception("분류를 지정하지 않으셨습니다."); - parent::isRole($action); - } //View관련 protected function view_process($entity) { //권한체크 - $this->isRole('view', $entity); + $this->isRole('view'); //조회수 올리기 $entity = $this->_model->addViewCount($entity); return parent::view_process($entity); @@ -70,8 +64,8 @@ class ProductController extends FrontController //Category 및 Status 조건추가 protected function index_setCondition() { - $this->_model->where("category_uid", $this->_viewDatas['category']->getPrimaryKey()); - // $this->_model->where("status", DEFAULTS['STATUS']); + $this->_model->where("category_uid", $this->getCurrentCategory()->getPrimaryKey()); + $this->_model->where("status", DEFAULTS['STATUS']); parent::index_setCondition(); } } diff --git a/app/Database/base.sql b/app/Database/base.sql index 86fe936..cf416c1 100644 --- a/app/Database/base.sql +++ b/app/Database/base.sql @@ -110,4 +110,30 @@ CREATE TABLE vhost.tw_sitepage ( KEY user_uid (user_uid), CONSTRAINT tw_sitepage_ibfk_1 FOREIGN KEY (category_uid) REFERENCES tw_category (uid), CONSTRAINT tw_sitepage_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) -) ENGINE = InnoDB COMMENT '사이트페이지'; \ No newline at end of file +) ENGINE = InnoDB COMMENT '사이트페이지'; + +DROP TABLE IF EXISTS tw_product; + +CREATE TABLE vhost.tw_product ( + uid varchar(36) NOT NULL, + category_uid varchar(50) NOT NULL COMMENT '범주_UID', + user_uid varchar(36) DEFAULT NULL COMMENT '생산자 정보', + type varchar(10) NOT NULL DEFAULT 'rental' COMMENT 'rental: 월임대, onetime:판매,일회성', + name varchar(255) NOT NULL COMMENT '상품명', + photo varchar(255) DEFAULT NULL COMMENT '상품이미지', + cost int(10) unsigned NOT NULL COMMENT '원가', + price int(10) unsigned NOT NULL COMMENT '판매가', + sale int(10) unsigned NOT NULL DEFAULT 0 COMMENT '할인가', + stock int(5) unsigned DEFAULT 1 COMMENT '재고수량', + view_cnt int(4) unsigned NOT NULL DEFAULT 0 COMMENT '조회수', + content text NOT NULL COMMENT '상품정보', + status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매, unuse: 판매않함, standby: 판매준비, hold: 판매중지 soldout: 상품부족 등등', + updated_at timestamp NULL DEFAULT NULL, + created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, + PRIMARY KEY (uid), + KEY category_uid (category_uid), + KEY user_uid (user_uid), + CONSTRAINT tw_product_ibfk_1 FOREIGN KEY (category_uid) REFERENCES tw_category (uid), + CONSTRAINT tw_product_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) +) ENGINE = InnoDB COMMENT = '상품 정보'; \ No newline at end of file diff --git a/app/Helpers/Billing_helper.php b/app/Helpers/Billing_helper.php index 6bed1b8..0cb3003 100644 --- a/app/Helpers/Billing_helper.php +++ b/app/Helpers/Billing_helper.php @@ -106,7 +106,7 @@ function getFieldIndex_Column_BillingHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Helpers/Category_helper.php b/app/Helpers/Category_helper.php index efca5ac..618d9eb 100644 --- a/app/Helpers/Category_helper.php +++ b/app/Helpers/Category_helper.php @@ -103,7 +103,7 @@ function getFieldIndex_Column_CategoryHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Helpers/Order_helper.php b/app/Helpers/Order_helper.php index 16d66e4..60214e3 100644 --- a/app/Helpers/Order_helper.php +++ b/app/Helpers/Order_helper.php @@ -116,7 +116,7 @@ function getFieldIndex_Column_OrderHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Helpers/Product_helper.php b/app/Helpers/Product_helper.php index 791404f..405bbb6 100644 --- a/app/Helpers/Product_helper.php +++ b/app/Helpers/Product_helper.php @@ -120,7 +120,7 @@ function getFieldIndex_Column_ProductHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Helpers/Sitepage_helper.php b/app/Helpers/Sitepage_helper.php index c4af69c..5d5aaa6 100644 --- a/app/Helpers/Sitepage_helper.php +++ b/app/Helpers/Sitepage_helper.php @@ -104,7 +104,7 @@ function getFieldIndex_Column_SitepageHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Helpers/User_helper.php b/app/Helpers/User_helper.php index 9469838..0861cff 100644 --- a/app/Helpers/User_helper.php +++ b/app/Helpers/User_helper.php @@ -108,7 +108,7 @@ function getFieldIndex_Column_UserHelper($field, array $viewDatas) $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $value); - $columnData = anchor($viewDatas['uri'], $label); + $columnData = anchor((string)$viewDatas['uri'], $label); switch ($field) { case 'title': case 'name': diff --git a/app/Views/front/product/index.php b/app/Views/front/product/index.php index e7c178c..a539627 100644 --- a/app/Views/front/product/index.php +++ b/app/Views/front/product/index.php @@ -4,7 +4,13 @@
head) ?>
- include('templates/front/index_head_product') ?> + include('templates/front/index_head') ?> + + +
diff --git a/app/Views/front/user/login.php b/app/Views/front/user/login.php index 870cc8b..a879e7f 100644 --- a/app/Views/front/user/login.php +++ b/app/Views/front/user/login.php @@ -1,4 +1,4 @@ -extend('layouts/front') ?> +extend('layouts/main') ?> section('content') ?> diff --git a/app/Views/front/user/login_v1.php b/app/Views/front/user/login_v1.php index 49a5bf4..0124bd9 100644 --- a/app/Views/front/user/login_v1.php +++ b/app/Views/front/user/login_v1.php @@ -1,4 +1,4 @@ -extend('layouts/front') ?> +extend('layouts/main') ?> section('content') ?> diff --git a/app/Views/layouts/front.php b/app/Views/layouts/front.php index 531e190..c9b5dde 100644 --- a/app/Views/layouts/front.php +++ b/app/Views/layouts/front.php @@ -33,7 +33,7 @@
diff --git a/app/Views/templates/front/index_head_product.php b/app/Views/templates/front/index_head_product.php deleted file mode 100644 index c209662..0000000 --- a/app/Views/templates/front/index_head_product.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file