vhost init...1

This commit is contained in:
최준흠 2024-05-06 15:28:22 +09:00
parent e98f4d396a
commit 513084d37c
15 changed files with 277 additions and 178 deletions

26
app/Cells/BoardCell.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace App\Cells;
use App\Models\BoardModel;
class BoardCell
{
private $_boardModel = null;
private function getBoardModel(): BoardModel
{
return $this->_boardModel = $this->_boardModel ?: new BoardModel();
}
public function information(array $viewDatas): string
{
helper('Board');
$viewDatas['cellDatas']=array();
$viewDatas['cellDatas']['entitys'] = $this->getBoardModel()->getEntitys([
'category' => __FUNCTION__
]);
return view(
'Views/front/board/cell/' . __FUNCTION__,
['viewDatas' => $viewDatas]
);
}
}

15
app/Cells/ProductCell.php Normal file
View File

@ -0,0 +1,15 @@
<?php
namespace App\Cells;
class ProductCell
{
public function virtual_calculator(array $viewDatas): string
{
$viewDatas['cellDatas']=array();
return view(
'Views/front/product/cell/' . __FUNCTION__,
['viewDatas'=>$viewDatas]
);
}
}

View File

@ -1,6 +1,7 @@
<?php
namespace Config;
use CodeIgniter\Router\RouteCollection;
// Create a new instance of our RouteCollection class.
@ -35,7 +36,7 @@ $routes->setAutoRoute(false);
//추가 RULE UUID형식
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
$routes->get('/', 'Home::index');
$routes->get('/', 'Front\Home::index');
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
});
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
@ -170,8 +171,8 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
});
$routes->group('order', ['namespace' => 'App\Controllers\Front\Order'], static function ($routes) {
$routes->get('', 'OrderController::index');
$routes->post('insert', 'OrderController::insert');
$routes->get('view/(:uuid)', 'OrderController::view/$1');
$routes->post('addCart', 'CartController::insert');
$routes->get('cancelCart/(:uuid)', 'CartController::delete/$1');
});
$routes->group('billing', ['namespace' => 'App\Controllers\Front\Billing', 'filter' => 'authFilter:user'], static function ($routes) {

View File

@ -2,43 +2,34 @@
namespace App\Controllers\Admin;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class Home extends Controller
class Home extends AdminController
{
private $_session = null;
private $_viewDatas = array();
private $_viewPath = "admin/";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewDatas['control'] = 'admin';
$this->_viewDatas['title'] = '쇼핑몰관리툴페이지';
$this->_viewDatas['layout'] = LAYOUTS['admin'];
$this->_session = \Config\Services::session();
$this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['className'] = 'MAIN';
$this->_viewDatas['class_icon'] = CLASS_ICONS['USER'];
helper("Common");
// echo var_export($this->_viewDatas['layout'], true);
// exit;
//사용자 기본 Role 지정
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false;
$this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]];
if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) {
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = true;
$this->_viewDatas['auth'] = $this->_session->get(SESSION_NAMES['AUTH']);
$currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_viewDatas['auth'][AUTH_FIELDS['ROLE']]);
$this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
}
$this->_viewDatas['className'] = 'Home';
$this->_viewDatas['title'] = '관리자페이지';
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
}
public function getFields(string $action): array
{
return [];
}
public function getFieldFilters(): array
{
return [];
}
//Index 관련
public function index()
{
helper('form');
$this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . 'welcome_message', ['viewDatas' => $this->_viewDatas]);
}
}

View File

@ -136,20 +136,23 @@ abstract class BaseController extends Controller
}
//초기화
final public function init(string $action, $fields = null)
final public function action_init(array $viewDatas)
{
switch ($action) {
switch ($viewDatas['action']) {
case 'insert_form':
$action = 'insert';
break;
case 'update_form':
$action = 'update';
break;
default:
$action = $viewDatas['action'];
break;
}
$this->_viewDatas['fields'] = $fields ?: $this->getFields($action);
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFilters'] = $this->getFieldFilters();
$this->_viewDatas['batchjobFilters'] = $this->getFieldBatchFilters();
$this->_viewDatas['fields'] = array_key_exists('fields', $viewDatas) ? $viewDatas['fields'] : $this->getFields($action);
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFilters'] = $this->getFieldFilters();
$this->_viewDatas['batchjobFilters'] = $this->getFieldBatchFilters();
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
return $this->_viewDatas;
}
@ -162,7 +165,7 @@ abstract class BaseController extends Controller
public function insert_form()
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$this->insert_form_process();
helper(['form']);
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
@ -190,22 +193,25 @@ abstract class BaseController extends Controller
{
return $this->_model->create($this->_viewDatas['fieldDatas']);
}
public function insert()
final public function insert()
{
$msg = "";
//Transaction 시작
$this->_model->transStart();
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$this->insert_validate();
$entity = $this->insert_process();
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.";
//Transaction Commit
$this->_model->transComplete();
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.");
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
//Transaction Rollback
$this->_model->transRollback();
log_message("error", $e->getMessage());
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return redirect()->back()->withInput();
} finally {
$this->_session->setFlashdata("return_message", $msg);
}
}
@ -218,7 +224,7 @@ abstract class BaseController extends Controller
public function update_form($uid)
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['entity'] = $this->update_form_process($entity);
helper(['form']);
@ -261,23 +267,26 @@ abstract class BaseController extends Controller
{
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
}
public function update($uid)
final public function update($uid)
{
$msg = "";
//Transaction 시작
$this->_model->transStart();
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->update_validate($entity);
$entity = $this->update_process($entity);
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.";
//Transaction Commit
$this->_model->transComplete();
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.");
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
//Transaction Rollback
$this->_model->transRollback();
log_message("error", $e->getMessage());
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return redirect()->back()->withInput();
} finally {
$this->_session->setFlashdata("return_message", $msg);
}
}
@ -292,7 +301,7 @@ abstract class BaseController extends Controller
public function reply_form($uid)
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['entity'] = $this->reply_form_process($entity);
helper(['form']);
@ -321,23 +330,26 @@ abstract class BaseController extends Controller
{
return $this->_model->reply($entity, $this->_viewDatas['fieldDatas']);
}
public function reply($uid)
final public function reply($uid)
{
$msg = "";
//Transaction 시작
$this->_model->transStart();
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->reply_validate($entity);
$entity = $this->reply_process($entity);
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.";
//Transaction Commit
$this->_model->transComplete();
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.");
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
//Transaction Rollback
$this->_model->transRollback();
log_message("error", $e->getMessage());
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return redirect()->back()->withInput();
} finally {
$this->_session->setFlashdata("return_message", $msg);
}
}
@ -360,22 +372,25 @@ abstract class BaseController extends Controller
{
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
}
public function toggle($uid, string $field)
final public function toggle($uid, string $field)
{
$msg = "";
//Transaction 시작
$this->_model->transStart();
try {
$this->_viewDatas = $this->init(__FUNCTION__, [$field]);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__, 'fields' => [$field]]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->toggle_validate($entity);
$entity = $this->toggle_process($entity);
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.";
//Transaction Commit
$this->_model->transComplete();
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.");
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
//Transaction Rollback
$this->_model->transRollback();
log_message("error", $e->getMessage());
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} finally {
$this->_session->setFlashdata("return_message", $msg);
}
}
//Batchjob 관련
@ -397,12 +412,13 @@ abstract class BaseController extends Controller
{
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
}
public function batchjob()
final public function batchjob()
{
$msg = "";
$uids = array();
$entitys = array();
$uids = array();
$entitys = array();
$batchjobs = array();
//Transaction 시작
$this->_model->transStart();
try {
//fields 해당하는 field중 선택된 값이 있는경우만 fields로 정의
$fields = array();
@ -414,11 +430,9 @@ abstract class BaseController extends Controller
if (!is_array($fields) || count($fields) === 0) {
throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(field)이 선택되지 않았습니다.');
}
$this->_viewDatas = $this->init(__FUNCTION__, $fields);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__, 'fields' => $fields]);
$uids = $this->request->getVar('batchjob_uids') ?: throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(uid)이 선택되지 않았습니다.');
$cnt = 1;
//Transaction 시작
$this->_model->transStart();
foreach ($uids as $uid) {
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
@ -433,29 +447,29 @@ abstract class BaseController extends Controller
}
//Transaction Commit
$this->_model->transComplete();
$msg = sprintf(
"%s에서 총:%s개의 %s 완료하였습니다.",
$this->_viewDatas['title'],
count($entitys),
__FUNCTION__
$this->_session->setFlashdata(
"return_message",
sprintf("%s에서 총:%s개의 %s 완료하였습니다.", $this->_viewDatas['title'], count($entitys), __FUNCTION__,),
);
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback
$this->_model->transRollback();
log_message('error', sprintf("---------batchjob 작업결과--------\n%s\n", implode("\n", $batchjobs)));
return sprintf(
"총:%s개의 작업중 %s개는 성공하였지만 , %s개가 실패하여 %s 취소되었습니다.\n%s",
count($uids),
count($entitys),
count($uids) - count($entitys),
__FUNCTION__,
$e->getMessage()
);
log_message("error", $e->getMessage());
$this->_session->setFlashdata(
"return_message",
sprintf(
"총:%s개의 작업중 %s개는 성공하였지만 , %s개가 실패하여 %s 취소되었습니다.\n%s",
count($uids),
count($entitys),
count($uids) - count($entitys),
__FUNCTION__,
$e->getMessage(),
),
);
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} finally {
$this->_session->setFlashdata("return_message", $msg);
log_message('error', sprintf("---------batchjob 작업결과--------\n%s\n", implode("\n", $batchjobs)));
}
}
@ -469,20 +483,23 @@ abstract class BaseController extends Controller
}
return $entity;
}
public function delete($uid)
final public function delete($uid)
{
$msg = "";
//Transaction 시작
$this->_model->transStart();
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->delete_process($entity);
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.";
//Transaction Commit
$this->_model->transComplete();
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()}" . __FUNCTION__ . " 완료하였습니다.");
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
//Transaction Rollback
$this->_model->transRollback();
log_message("error", $e->getMessage());
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} finally {
$this->_session->setFlashdata("return_message", $msg);
}
}
@ -495,7 +512,7 @@ abstract class BaseController extends Controller
public function view($uid)
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['entity'] = $this->view_process($entity);
helper(['form']);
@ -567,7 +584,7 @@ abstract class BaseController extends Controller
public function index()
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
foreach ($this->_viewDatas['fieldFilters'] as $field) {
$this->_viewDatas[$field] = $this->request->getVar($field) ?: DEFAULTS['EMPTY'];
}
@ -599,6 +616,7 @@ abstract class BaseController extends Controller
$this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . '/index' . $this->request->getVar('v') ?: '', ['viewDatas' => $this->_viewDatas]);
} catch (\Exception $e) {
log_message("error", $e->getMessage());
return alert_CommonHelper($e->getMessage(), "back");
// return redirect()->back()->with('return_message', $e->getMessage());
}
@ -625,10 +643,10 @@ abstract class BaseController extends Controller
// $writer->save($fileName . '.pdf');
return $writer;
}
public function excel()
final public function excel()
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas = $this->action_init(['action' => __FUNCTION__]);
$this->_viewDatas['Entitys'] = $this->index_getEntitys();
$html = view(
$this->_viewPath . '/excel',

View File

@ -0,0 +1,35 @@
<?php
namespace App\Controllers\Front;
use App\Entities\CategoryEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class Home extends FrontController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
}
public function getFields(string $action): array
{
return [];
}
public function getFieldFilters(): array
{
return [];
}
//Index 관련
public function index()
{
helper('form');
//$this->_viewDatas['parts'] = Product['parts'];
// dd($this->_viewDatas);
$this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . 'welcome_message', ['viewDatas' => $this->_viewDatas]);
}
}

View File

@ -1,45 +0,0 @@
<?php
namespace App\Controllers;
use App\Entities\CategoryEntity;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class Home extends Controller
{
private $_session = null;
private $_viewDatas = array();
private $_viewPath = "";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewDatas['control'] = 'main';
$this->_viewDatas['title'] = '쇼핑몰페이지';
$this->_viewDatas['layout'] = LAYOUTS['main'];
$this->_session = \Config\Services::session();
$this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['className'] = 'MAIN';
// echo var_export($this->_viewDatas['layout'], true);
// exit;
//사용자 기본 Role 지정
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false;
$this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]];
if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) {
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = true;
$this->_viewDatas['auth'] = $this->_session->get(SESSION_NAMES['AUTH']);
$currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_viewDatas['auth'][AUTH_FIELDS['ROLE']]);
$this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
}
//Default 회원정보 Category
$this->_viewDatas['category'] = new CategoryEntity(['uid' => 1]);
}
public function index()
{
return view($this->_viewPath . 'welcome_message', ['viewDatas' => $this->_viewDatas]);
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Controllers\Trait;
use App\Entities\OrderEntity;
use App\Entities\ProductEntity;
use App\Models\OrderModel;
use App\Models\ProductModel;
trait CartTrait
{
private $_serverModel = null;
private $_orderModel = null;
private function getOrderModel(): OrderModel
{
return $this->_orderModel = $this->_orderModel ?: new OrderModel();
}
private function getProductModel(): ProductModel
{
return $this->_serverModel = $this->_serverModel ?: new ProductModel();
}
public function add_procedure(ProductEntity $product, int $quantity, int $paymentDay = null): OrderEntity
{
//상품재고감소
$product = $this->getProductModel()->addCart($product, $quantity);
//주문추가
$entity = $this->getOrderModel()->addCart($product, $quantity, $product->type, $paymentDay);
//주문정보 세션에 넣기
$order_uids = $this->_session->get(SESSION_NAMES['CART']) ?: array();
$this->_session->set(SESSION_NAMES['CART'], [...$order_uids, $entity->getPrimaryKey()]);
$this->_session->setFlashdata(
"return_message",
sprintf(
"%s\n 상품명:%s\n 상품갯수:%s개, 구매금액:%s원\n 장바구니에 담았습니다.",
$this->_viewDatas['title'],
$entity->getTitle(),
$entity->quantity,
number_format($entity->price),
),
);
return $entity;
}
public function cancel_procedure($uid)
{
//주문정보 가져오기
$entity = $this->getOrderModel()->getEntity([$this->getOrderModel()->getPrimaryKey() => $uid]);
//상품정보 가져오기
$product = $this->getProductModel()->getEntity([$this->getProductModel()->getPrimaryKey() => $entity->product_uid]);
//주문취소
$entity = $this->getOrderModel()->cancelCart($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);
$this->_session->setFlashdata("return_message", "{$this->_viewDatas['title']}에서 {$entity->getTitle()} {$entity->quantity}개의 주문을 취소하였습니다.");
}
}

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS baseproject.tw_user;
DROP TABLE IF EXISTS vhost.tw_user;
CREATE TABLE baseproject.tw_user (
CREATE TABLE vhost.tw_user (
uid varchar(36) NOT NULL COMMENT "사용자 UUID",
id varchar(30) NOT NULL,
passwd varchar(100) NOT NULL,
@ -19,11 +19,11 @@ CREATE TABLE baseproject.tw_user (
UNIQUE KEY (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사용자 정보';
-- insert into tw_user (uid,id,passwd,name,email,role,status) select uuid(),id,passwd,name,email,role,status from cfmgr.user;
DROP TABLE IF EXISTS baseproject.tw_user_profile;
DROP TABLE IF EXISTS vhost.tw_user_profile;
DROP TABLE IF EXISTS baseproject.tw_user_sns;
DROP TABLE IF EXISTS vhost.tw_user_sns;
CREATE TABLE baseproject.tw_user_sns (
CREATE TABLE vhost.tw_user_sns (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_uid varchar(36) NULL COMMENT '사용자 정보',
site varchar(20) NOT NULL COMMENT 'Site: GOOGLE,FACEBOOK 등등',
@ -40,14 +40,14 @@ CREATE TABLE baseproject.tw_user_sns (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='SNS 로그인 후 정보';
DROP TABLE IF EXISTS baseproject.tw_category;
DROP TABLE IF EXISTS vhost.tw_category;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
-- update tw_category set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
-- 2. 게시물 추가시 작업
-- insert tw_category grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1
-- 3. 게시물 조회시 작업
-- select * from tw_category order by grpno desc,grporder asc
CREATE TABLE baseproject.tw_category (
CREATE TABLE vhost.tw_category (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
@ -70,14 +70,14 @@ CREATE TABLE baseproject.tw_category (
PRIMARY KEY (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='분류';
DROP TABLE IF EXISTS baseproject.tw_board;
DROP TABLE IF EXISTS vhost.tw_board;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
-- update tw_board set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
-- 2. 게시물 추가시 작업
-- insert tw_board grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1
-- 3. 게시물 조회시 작업
-- select * from tw_board order by grpno desc,grporder asc
CREATE TABLE baseproject.tw_board (
CREATE TABLE vhost.tw_board (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',

View File

@ -234,7 +234,7 @@
<div class="info">
<dl>
<dt>공지사항</dt>
<?= $this->include($viewDatas['layout']['path'] . '/board'); ?>
<dd><?= view_cell('BoardCell::information', $viewDatas) ?></dd>
</dl>
</div>
</li>

View File

@ -5,36 +5,28 @@
<nav class="nav justify-content-center">
<nav id="top_menu" class="navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="nav"><a class="navbar-brand" href="/">TOP Menu</a></nav>
<nav class="nav"><a class="navbar-brand" href="/">HOME</a></nav>
<nav class="nav justify-content-center"></nav>
<ul class="nav justify-content-end">
<?php foreach ($viewDatas['layout']['top_menus'] as $top_menu): ?>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_aboutus'); ?>
</li>
<li class="nav-item">|</li>
<li class=" nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_hosting'); ?>
</li>
<li class="nav-item">|</li>
<li class=" nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_server'); ?>
</li>
<li class="nav-item">|</li>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_network'); ?>
</li>
<li class="nav-item">|</li>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_peripheral'); ?>
</li>
<li class="nav-item">|</li>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_service'); ?>
</li>
<li class="nav-item">|</li>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_menu/top_menu_support'); ?>
<div class="dropdown-center">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $viewDatas['categorys'][$top_menu]['parent']->getTitle() ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDarkDropdownMenuLink">
<?php foreach($viewDatas['categorys'][$top_menu]['childs'] as $child): ?>
<li><a class="dropdown-item <?= $child->getPrimaryKey() == $viewDatas['category'] ? "active" : "" ?>" href="/front/sitepage?category=<?= $child->getPrimaryKey() ?>"><?=$child->getTitle()?></a></li>
<?php endforeach ?>
</ul>
</li>
</ul>
</div>
</li>
<li class="nav-item" style="padding-top:10px;">|</li>
<?php endforeach ?>
</ul>
</div>
</nav>

View File

@ -6,7 +6,7 @@
</nav>
<ul class="nav justify-content-center">
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_navigator/top_center'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator/top_center'); ?>
</li>
</ul>
<ul class="nav justify-content-end">
@ -14,7 +14,7 @@
<?= anchor('/front/order', ICONS['CART'], ["target" => "_self"]); ?>
</li>
<li class="nav-item">
<?= $this->include($viewDatas['layout']['path'] . '/../common/top_navigator/member_link'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator/member_link'); ?>
</li>
</ul>
</div>