diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 3e95d76..c4e1583 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', 'serverdevice', 'service', 'support'], + 'topmenus' => ['aboutus', 'hosting', 'serverdevice', 'service', 'support'], 'stylesheets' => [ '', '', @@ -271,6 +271,7 @@ define('CLASS_ICONS', [ define('TOP_BANNER', [ 'default' => '', 'aboutus' => '', + 'member' => '', 'hosting' => '', 'serverdevice' => '', 'service' => '', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 24f9789..4bc1331 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -169,11 +169,15 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou $routes->get('', 'ProductController::index'); $routes->get('view/(:uuid)', 'ProductController::view/$1'); }); - $routes->group('order', ['namespace' => 'App\Controllers\Front\Order'], static function ($routes) { + $routes->group('order', static function ($routes) { $routes->get('', 'OrderController::index'); - $routes->post('insert', 'OrderController::insert'); + $routes->get('excel', 'OrderController::excel'); + $routes->get('update/(:uuid)', 'OrderController::update_form/$1'); + $routes->post('update/(:uuid)', 'OrderController::update/$1'); $routes->get('view/(:uuid)', 'OrderController::view/$1'); - $routes->get('cancelCart/(:uuid)', 'CartController::delete/$1'); + $routes->get('delete/(:uuid)', 'OrderController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:uuid)/(:hash)', 'OrderController::toggle/$1/$2'); + $routes->post('batchjob', 'OrderController::batchjob`'); }); $routes->group('billing', ['namespace' => 'App\Controllers\Front\Billing', 'filter' => 'authFilter:user'], static function ($routes) { $routes->get('', 'BillingController::index'); diff --git a/app/Controllers/Front/BoardController.php b/app/Controllers/Front/BoardController.php index d66545f..84174e3 100644 --- a/app/Controllers/Front/BoardController.php +++ b/app/Controllers/Front/BoardController.php @@ -48,7 +48,7 @@ class BoardController extends FrontController protected function insert_form_process() { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('isaccess'); parent::insert_form_process(); @@ -63,7 +63,7 @@ class BoardController extends FrontController protected function update_form_process($entity) { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용 if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid != $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) { throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다."); @@ -82,7 +82,7 @@ class BoardController extends FrontController protected function reply_form_process($entity) { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('isreply'); return parent::reply_form_process($entity); @@ -100,7 +100,7 @@ class BoardController extends FrontController protected function view_process($entity) { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('view'); //조회수 올리기 @@ -111,7 +111,7 @@ class BoardController extends FrontController protected function index_process() { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('index'); parent::index_process(); diff --git a/app/Controllers/Front/FrontController.php b/app/Controllers/Front/FrontController.php index 68f0d28..1068f82 100644 --- a/app/Controllers/Front/FrontController.php +++ b/app/Controllers/Front/FrontController.php @@ -66,13 +66,12 @@ abstract class FrontController extends BaseController } } - final protected function checkCategory() + final protected function setCategory($category = false) { - //Category 확인 - $this->_viewDatas['category'] = $this->request->getVar('category'); - if (!$this->_viewDatas['category']) { + if (!$category) { throw new \Exception("분류코드가 지정되지 않았습니다."); } + $this->_viewDatas['category'] = $category; $this->_viewDatas['currentCategory'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_viewDatas['category']]); } } diff --git a/app/Controllers/Front/Order/CartController.php b/app/Controllers/Front/Order/CartController.php deleted file mode 100644 index 36fe86d..0000000 --- a/app/Controllers/Front/Order/CartController.php +++ /dev/null @@ -1,171 +0,0 @@ -_viewDatas['className'] = 'Cart'; - $this->_viewPath .= '/' . strtolower($this->_viewDatas['className']); - $this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title'); - $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; - helper($this->_viewDatas['className']); - } - - public function getFields(string $action = ""): array - { - switch ($action) { - case 'insert': - return ["product_uid", "quantity", "price", 'paymentday']; - break; - default: - return []; - break; - } - } - protected function getFieldRule(string $field, array $rules, string $action = ""): array - { - switch ($field) { - case 'product_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}/]"; - break; - case 'quantity': - case 'price': - $rules[$field] = "required|numeric"; - break; - case 'paymentday': - $rules[$field] = "if_exist|numeric"; - break; - default: - $rules = parent::getFieldRule($field, $rules, $action); - break; - } - return $rules; - } - public function getFieldFilters(): array - { - return []; - } - public function getFieldBatchFilters(): array - { - return parent::getFieldBatchFilters(); - } - - //insert관련 - public function insert() - { - $msg = ""; - try { - $this->_viewDatas = $this->init(__FUNCTION__); - //장바구니정보 검증 - $this->insert_validate(); - //상품정보가져오기 - $product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $this->_viewDatas['fieldDatas']['product_uid']]); - //상품갯수확인 - if (!$this->_viewDatas['fieldDatas']['quantity']) { - throw new \Exception("상품갯수가 지정되지 않았습니다."); - } - //구매금액확인 - if (!$this->_viewDatas['fieldDatas']['price']) { - throw new \Exception("구매금액이 지정되지 않았습니다."); - } - //결제방식이 월이용권이면 결제일 확인 - $paymentDay = null; - $type = $product->type; - if ($type == 'rental') { - $paymentDay = $this->request->getVar('paymentday') ?: throw new \Exception("월이용권 상품의 경우는 매월 결제일을 지정해주셔야합니다."); - } - //재고수 비교 - if ($product->stock < $this->_viewDatas['fieldDatas']['quantity']) { - throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->stock}개"); - } - //구매 금액 비교 - $price = $product->price * $this->_viewDatas['fieldDatas']['quantity']; - if ($price != $this->_viewDatas['fieldDatas']['price']) { - throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다."); - } - //Transaction 시작 - $this->_model->transStart(); - //주문추가 - $entity = $this->_model->addCart($product, $this->_viewDatas['fieldDatas']['quantity'], $type, $paymentDay); - //상품재고감소 - $product = $this->getProductModel()->addCart($product, $this->_viewDatas['fieldDatas']['quantity']); - //주문정보 세션에 넣기 - $order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array(); - $this->_session->set(SESSION_NAMES['CART'], [...$order_uids, $entity->getPrimaryKey()]); - //Transaction Commit - $this->_model->transComplete(); - $msg = sprintf( - "%s\n 상품명:%s\n 상품갯수:%s개, 구매금액:%s원\n 장바구니에 담았습니다.", - $this->_viewDatas['title'], - $entity->getTitle(), - $entity->quantity, - number_format($entity->price) - ); - //Return URL clear -> 장바구니로 바로 이동 - $this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']); - return redirect()->to(URLS['Order']); - } catch (\Exception $e) { - //Transaction Rollback - $this->_model->transRollback(); - log_message("error", $e->getMessage()); - $msg = sprintf( - "%s에서 다음 오류로 인해 장바구니에 담기를 실패하였습니다.\n%s", - $this->_viewDatas['title'], - $e->getMessage() - ); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); - } finally { - $this->_session->setFlashdata("return_message", $msg); - } - } - - //주문취소(uid -> order_uid) - public function delete($uid) - { - $msg = ""; - try { - //주문정보 가져오기 - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); - //상품정보 가져오기 - $product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->product_uid]); - //Transaction 시작 - $this->_model->transStart(); - //주문취소 - $entity = $this->delete_process($entity); - //상품반환 - $product = $this->getProductModel()->cancelCart($product, $entity->quantity); - //주문정보 세션에서 빼기 - $order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array(); - $temps = array(); - foreach ($order_uids as $order_uid) { - if ($order_uid != $entity->getPrimaryKey()) { - array_push($temps, $order_uid); - } - } - $this->_session->set(SESSION_NAMES['CART'], $temps); - //Transaction Commit - $this->_model->transComplete(); - $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()} {$entity->quantity}개의 주문을 취소하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); - } catch (\Exception $e) { - //Transaction Rollback - $this->_model->transRollback(); - $msg = sprintf( - "%s에서 다음 오류로 인해 주문취소를 실패하였습니다.\n%s", - $this->_viewDatas['title'], - $e->getMessage() - ); - log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); - } finally { - $this->_session->setFlashdata("return_message", $msg); - } - } -} diff --git a/app/Controllers/Front/Order/OrderController.php b/app/Controllers/Front/Order/OrderController.php deleted file mode 100644 index e254470..0000000 --- a/app/Controllers/Front/Order/OrderController.php +++ /dev/null @@ -1,89 +0,0 @@ -_model = new OrderModel(); - $this->_viewDatas['className'] = 'Order'; - $this->_viewPath .= strtolower($this->_viewDatas['className']); - $this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title'); - $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; - helper($this->_viewDatas['className']); - - //Default 회원정보 Category - $this->_category = DEFAULTS['CATEGORY_ORDER']; - $this->isRole('index'); - } - - final protected function getProductModel(): ProductModel - { - return $this->_productModel = $this->_productModel ?: new ProductModel(); - } - - public function getFields(string $action = ""): array - { - switch ($action) { - case "index": - case "excel": - return ["type", 'name', "cost", "sale", "quantity", "price", "status"]; - break; - case "view": - return ["type", 'name', "cost", "sale", "quantity", "price", "status", "updated_at", "created_at"]; - break; - default: - return []; - break; - } - } - public function getFieldFilters(): array - { - return ['product_uid', "type", "status"]; - } - public function getFieldBatchFilters(): array - { - return ["status"]; - } - - //View관련 - protected function view_process($entity) - { - //권한체크 - $this->isRole('view', $entity); - return parent::view_process($entity); - } - - //Index관련 - protected function index_process() - { - //권한체크 - $this->isRole('index'); - return parent::index_process(); - } - protected function index_setCondition() - { - //세션에 Cart정보(order_uids)가 있으면 - $uids = $this->_session->get(SESSION_NAMES['CART']) ?: array('NONE'); - //또는 Login했으면 사용자정보(user_uid)에 맞는 Order정보 가져오기 - if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) { - $this->_model->where('user_uid', $this->_session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]); - if (count($uids)) { - $this->_model->orWhereIn('uid', $uids); - } - } elseif (count($uids)) { - $this->_model->whereIn('uid', $uids); - } - parent::index_setCondition(); - } -} diff --git a/app/Controllers/Front/OrderController.php b/app/Controllers/Front/OrderController.php new file mode 100644 index 0000000..5f55986 --- /dev/null +++ b/app/Controllers/Front/OrderController.php @@ -0,0 +1,196 @@ +_model = new OrderModel(); + $this->_viewDatas['className'] = 'Order'; + $this->_viewPath .= strtolower($this->_viewDatas['className']); + $this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title'); + $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; + helper($this->_viewDatas['className']); + } + + final protected function getProductModel(): ProductModel + { + return $this->_productModel = $this->_productModel ?: new ProductModel(); + } + + public function getFields(string $action = ""): array + { + switch ($action) { + case 'beremetal': + return ["category", "product_uid", "quantity", "price", 'paymentday']; + case 'virtual': + return ["category", "cpu", "memory", "disk", "price", 'paymentday']; + break; + case "index": + case "excel": + return ["type", 'name', "cost", "sale", "quantity", "price", "status"]; + break; + case "view": + return ["type", 'name', "cost", "sale", "quantity", "price", "status", "updated_at", "created_at"]; + break; + default: + return []; + break; + } + } + protected function getFieldRule(string $field, array $rules, string $action = ""): array + { + switch ($field) { + case 'category': + $rules[$field] = "required|min_length[3]"; + break; + case 'product_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}/]"; + break; + case 'quantity': + case 'price': + case 'cpu': + case 'memory': + case 'disk': + $rules[$field] = "required|numeric"; + break; + case 'paymentday': + $rules[$field] = "if_exist|numeric"; + break; + default: + $rules = parent::getFieldRule($field, $rules, $action); + break; + } + return $rules; + } + + public function getFieldFilters(): array + { + return ['product_uid', "type", "status"]; + } + public function getFieldBatchFilters(): array + { + return ["status"]; + } + + //가상서버 + protected function virtual_process() + { + //가상서버정보 + $protudctDatas = array( + 'category' => 'virtual', + 'name' => '', + 'content' => '', + 'cost' => $this->_viewDatas['fieldDatas']['price'], + 'price' => $this->_viewDatas['fieldDatas']['price'], + 'sale' => 0, + 'stock' => 1, + 'view_cnt' => 1, + 'status' => 'use', + ); + //서버부품정보검증 + $titles = array('가상서버'); + //foreach (Product['parts']['virtual']['category'] as $category => $attrs) { + foreach ([] as $category => $attrs) { + if (!$this->_viewDatas['fieldDatas'][$category]) { + throw new \Exception($category . "의 값이 지정되지 않았습니다."); + } else { + $protudctDatas[$category . "_model"] = $attrs['label']; + $protudctDatas[$category . "_cnt"] = $this->_viewDatas['fieldDatas'][$category]; + array_push( + $titles, + sprintf( + "%s * %s%s,", + $protudctDatas[$category . "_model"], + $protudctDatas[$category . "_cnt"], + $attrs['unit'], + ), + ); + } + } + $protudctDatas['name'] = implode(" ", $titles); + $protudctDatas['content'] = implode("\n", $titles); + $product = $this->getProductModel()->create($protudctDatas); + return $this->add_procedure($product, 1, $this->_viewDatas['fieldDatas']['paymentday']); + } + //실서버 + protected function beremetal_process() + { + //상품정보가져오기 + $product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $this->_viewDatas['fieldDatas']['product_uid']]); + //재고수 비교 + if ($product->stock < $this->_viewDatas['fieldDatas']['quantity']) { + throw new \Exception("구매수량이 너무 많습니다.\n구매수량:{$this->_viewDatas['fieldDatas']['quantity']}개, 남은 재고수량:{$product->stock}개"); + } + //구매 금액 비교 + $price = $product->price * $this->_viewDatas['fieldDatas']['quantity']; + if ($price != $this->_viewDatas['fieldDatas']['price']) { + throw new \Exception("실 상품금액{$price} 와 구매금액{$this->_viewDatas['fieldDatas']['price']}이 서로 다릅니다."); + } + //결제방식이 월이용권이면 결제일 확인 + $paymentDay = null; + if ($product->type == 'rental') { + $paymentDay = $this->request->getVar('paymentday') ?: throw new \Exception("월이용권 상품의 경우는 매월 결제일을 지정해주셔야합니다."); + } + return $this->add_procedure($product, $this->_viewDatas['fieldDatas']['quantity'], $paymentDay); + } + + //주문처리 + protected function insert_process() + { + switch ($this->_viewDatas['fieldDatas']['category']) { + case 'virtual': + throw new \Exception('가상화서버처리'); + return $this->virtual_process(); + break; + case 'beremetal': + throw new \Exception('실서버처리'); + return $this->beremetal_process(); + break; + default: + throw new \Exception($this->_viewDatas['fieldDatas']['category'] . "는 알수없는 상품 구분입니다. 다시 확인 부탁드립니다."); + break; + } + } + + //주문취소처리 + public function delete_process($order_uid) + { + return $this->cancel_procedure($order_uid); + } + + //Index관련 + protected function index_process() + { + //Category 확인 + $this->setCategory($this->request->getVar('category') ?: self::DEFAULT_CATEGORY); + parent::index_process(); + } + protected function index_setCondition() + { + //세션에 Cart정보(order_uids)가 있으면 + $uids = $this->_session->get(SESSION_NAMES['CART']) ?: array('NONE'); + //또는 Login했으면 사용자정보(user_uid)에 맞는 Order정보 가져오기 + if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) { + $this->_model->where('user_uid', $this->_session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]); + if (count($uids)) { + $this->_model->orWhereIn('uid', $uids); + } + } elseif (count($uids)) { + $this->_model->whereIn('uid', $uids); + } + parent::index_setCondition(); + } +} diff --git a/app/Controllers/Front/ProductController.php b/app/Controllers/Front/ProductController.php index befce17..e2f7eb8 100644 --- a/app/Controllers/Front/ProductController.php +++ b/app/Controllers/Front/ProductController.php @@ -48,6 +48,8 @@ class ProductController extends FrontController //View관련 protected function view_process($entity) { + //Category 확인 + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('view'); //조회수 올리기 @@ -57,6 +59,8 @@ class ProductController extends FrontController //Index관련 protected function index_process() { + //Category 확인 + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('index'); return parent::index_process(); @@ -64,7 +68,7 @@ class ProductController extends FrontController //Category 및 Status 조건추가 protected function index_setCondition() { - $this->_model->where("category_uid", $this->getCurrentCategory()->getPrimaryKey()); + $this->_model->where("category_uid", $this->_viewDatas['currentCategory']->getPrimaryKey()); $this->_model->where("status", DEFAULTS['STATUS']); parent::index_setCondition(); } diff --git a/app/Controllers/Front/SitepageController.php b/app/Controllers/Front/SitepageController.php index 806e762..214559e 100644 --- a/app/Controllers/Front/SitepageController.php +++ b/app/Controllers/Front/SitepageController.php @@ -48,7 +48,7 @@ class SitepageController extends FrontController protected function index_process() { //Category 확인 - $this->checkCategory(); + $this->setCategory($this->request->getVar('category')); //권한체크 $this->isRole('index'); return parent::index_process(); diff --git a/app/Controllers/Front/UserController.php b/app/Controllers/Front/UserController.php index 4a7e328..b5a6074 100644 --- a/app/Controllers/Front/UserController.php +++ b/app/Controllers/Front/UserController.php @@ -10,6 +10,7 @@ use Psr\Log\LoggerInterface; class UserController extends FrontController { + const DEFAULT_CATEGORY = "userinfo"; private $_adapters = array(); public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -20,7 +21,6 @@ class UserController extends FrontController $this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title'); $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; helper($this->_viewDatas['className']); - $this->initAdapters(); } @@ -86,6 +86,12 @@ class UserController extends FrontController } //Insert관련 + protected function insert_form_process() + { + //Category 확인 + $this->setCategory($this->request->getVar('category') ?: self::DEFAULT_CATEGORY); + parent::insert_form_process(); + } protected function insert_process() { //Role이 반드시 있어야 하기때문에 @@ -93,6 +99,14 @@ class UserController extends FrontController return parent::insert_process(); } + //Update관련 + protected function update_form_process($entity) + { + //Category 확인 + $this->setCategory($this->request->getVar('category') ?: self::DEFAULT_CATEGORY); + return parent::update_form_process($entity); + } + //Index관련 //사용자 UID 조건추가 protected function index_setCondition() diff --git a/app/Database/base.sql b/app/Database/base.sql index 7d60cf4..8aed919 100644 --- a/app/Database/base.sql +++ b/app/Database/base.sql @@ -112,7 +112,7 @@ CREATE TABLE vhost.tw_sitepage ( CONSTRAINT tw_sitepage_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) ) ENGINE = InnoDB COMMENT '사이트페이지'; -DROP TABLE IF EXISTS tw_product; +DROP TABLE IF EXISTS vhost.tw_product; CREATE TABLE vhost.tw_product ( uid varchar(36) NOT NULL, @@ -136,4 +136,101 @@ CREATE TABLE vhost.tw_product ( 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 +) ENGINE = InnoDB COMMENT = '상품 정보'; + +DROP TABLE IF EXISTS vhost.tw_order; + +CREATE TABLE vhost.tw_order ( + uid varchar(36) NOT NULL, + product_uid varchar(36) DEFAULT NULL COMMENT '상품 정보', + user_uid varchar(36) DEFAULT NULL COMMENT '사용자 정보', + name varchar(255) NOT NULL COMMENT '상품명', + cost int(10) unsigned NOT NULL COMMENT '구매원가', + sale int(10) unsigned NOT NULL DEFAULT 0 COMMENT '할인가', + price int(10) unsigned NOT NULL COMMENT '결제액', + quantity varchar(255) NOT NULL COMMENT '수량', + type varchar(10) NOT NULL DEFAULT 'rental' COMMENT 'rental: 월임대, + onetime:판매,일회성', + paymentday int(2) unsigned DEFAULT NULL COMMENT '결제일', + status varchar(10) NOT NULL DEFAULT 'unuse' COMMENT 'use: 주문요청/장바구니, + unuse: 주문완료/서비스', + updated_at timestamp NULL DEFAULT NULL, + created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, + PRIMARY KEY (uid), + KEY product_uid (product_uid), + KEY user_uid (user_uid), + CONSTRAINT tw_order_ibfk_1 FOREIGN KEY (product_uid) REFERENCES tw_product (uid), + CONSTRAINT tw_order_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) +) ENGINE = InnoDB COMMENT 'Order 정보'; + +DROP TABLE IF EXISTS vhost.tw_service; + +CREATE TABLE vhost.tw_service ( + uid varchar(36) NOT NULL, + user_uid varchar(36) DEFAULT NULL COMMENT '구매자 정보', + type varchar(10) NOT NULL DEFAULT 'rental' COMMENT 'rental: 월임대, + onetime:판매,일회성', + price int(10) unsigned NOT NULL COMMENT '결제액', + paymentday int(2) unsigned DEFAULT NULL COMMENT '결제일', + status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, + unuse: 해지', + updated_at timestamp NULL DEFAULT NULL, + created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, + PRIMARY KEY (uid), + KEY user_uid (user_uid), + CONSTRAINT tw_service_ibfk_1 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) +) ENGINE = InnoDB COMMENT '서비스정보'; + +DROP TABLE IF EXISTS vhost.tw_service_product; + +CREATE TABLE vhost.tw_service_product ( + uid int(10) unsigned NOT NULL, + service_uid varchar(36) DEFAULT NULL COMMENT '서비스상품 정보', + product_uid varchar(36) DEFAULT NULL COMMENT '상품 정보', + created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, + PRIMARY KEY (uid), + KEY product_uid (product_uid), + KEY service_uid (service_uid), + CONSTRAINT tw_service_product_ibfk_1 FOREIGN KEY (service_uid) REFERENCES tw_service (uid), + CONSTRAINT tw_service_product_ibfk_2 FOREIGN KEY (product_uid) REFERENCES tw_product (uid) +) ENGINE = InnoDB COMMENT '주문-서비스정보'; + +DROP TABLE IF EXISTS vhost.tw_billing; + +CREATE TABLE vhost.tw_billing ( + uid int(10) unsigned NOT NULL, + user_uid varchar(36) NOT NULL COMMENT '사용자 정보', + type varchar(10) DEFAULT NULL COMMENT 'Card: 카드결제, + Deposit:무통장입금', + email varchar(50) NOT NULL, + phone varchar(20) DEFAULT NULL COMMENT '연락처', + title varchar(255) NOT NULL COMMENT '청구서제목', + price int(10) unsigned NOT NULL COMMENT '청구금액', + response text DEFAULT NULL COMMENT '결제처리결과', + status varchar(10) NOT NULL DEFAULT 'unuse' COMMENT 'use: 납부완료, + unuse: 미납 등등', + updated_at timestamp NULL DEFAULT NULL, + created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, + PRIMARY KEY (uid), + KEY user_uid (user_uid), + CONSTRAINT tw_billing_ibfk_1 FOREIGN KEY (user_uid) REFERENCES tw_user (uid) +) ENGINE = InnoDB COMMENT '청구서정보'; + +DROP TABLE IF EXISTS vhost.tw_service_billing; + +CREATE TABLE vhost.tw_service_billing ( + uid int(10) unsigned NOT NULL, + service_uid varchar(36) NOT NULL COMMENT '서비스 정보', + billing_uid int(10) unsigned NOT NULL COMMENT '청구서 정보', + updated_at timestamp NULL DEFAULT NULL, + created_at timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (uid), + KEY service_uid (service_uid), + KEY billing_uid (billing_uid), + CONSTRAINT tw_service_billing_ibfk_1 FOREIGN KEY (service_uid) REFERENCES tw_service (uid), + CONSTRAINT tw_service_billing_ibfk_2 FOREIGN KEY (billing_uid) REFERENCES tw_billing (uid) +) ENGINE = InnoDB COMMENT '서비스-청구서정보'; \ No newline at end of file diff --git a/app/Views/front/order/index.php b/app/Views/front/order/index.php index 1955463..5d4dbde 100644 --- a/app/Views/front/order/index.php +++ b/app/Views/front/order/index.php @@ -51,7 +51,7 @@ getPrimaryKey()) ?> - +
결제정보
상품수 diff --git a/app/Views/front/user/insert.php b/app/Views/front/user/insert.php index a659e28..db7c9b9 100644 --- a/app/Views/front/user/insert.php +++ b/app/Views/front/user/insert.php @@ -15,7 +15,7 @@ - "btn btn-outline btn-primary")); ?> + "btn btn-outline btn-primary")); ?> diff --git a/app/Views/front/user/login.php b/app/Views/front/user/login.php index a879e7f..f8cf366 100644 --- a/app/Views/front/user/login.php +++ b/app/Views/front/user/login.php @@ -1,37 +1,35 @@ -extend('layouts/main') ?> +extend('layouts/front_simple') ?> section('content') ?>
\ No newline at end of file diff --git a/app/Views/layouts/front/left_menu.php b/app/Views/layouts/front/left_menu.php index f6a712f..344a00b 100644 --- a/app/Views/layouts/front/left_menu.php +++ b/app/Views/layouts/front/left_menu.php @@ -1,16 +1,14 @@ - - - -
-
-
-
-
parent]['entity']->getTitle() ?>
-
- parent]['childs'] as $child) : ?> - - + + +
+
+
-
+
parent]['entity']->getTitle() ?>
- - \ No newline at end of file + parent]['childs'] as $child) : ?> + + +
+ \ No newline at end of file diff --git a/app/Views/layouts/front/top_menu.php b/app/Views/layouts/front/top_menu.php index 192a2bd..017d96a 100644 --- a/app/Views/layouts/front/top_menu.php +++ b/app/Views/layouts/front/top_menu.php @@ -9,16 +9,16 @@