shoppingmallv2 init...
This commit is contained in:
parent
3dec0ab564
commit
0a968d2815
@ -175,8 +175,9 @@ define('URLS', [
|
|||||||
'Order' => '/front/order',
|
'Order' => '/front/order',
|
||||||
'addCart' => '/front/order/addCart',
|
'addCart' => '/front/order/addCart',
|
||||||
'cancelCart' => '/front/order/cancelCart',
|
'cancelCart' => '/front/order/cancelCart',
|
||||||
'cardPayment' => '/front/order/payment/card',
|
'Billing' => '/front/billing',
|
||||||
'depositPayment' => '/front/order/payment/deposit',
|
'cardPayment' => '/front/billing/payment/card',
|
||||||
|
'depositPayment' => '/front/billing/payment/deposit',
|
||||||
]);
|
]);
|
||||||
//SESSION 관련
|
//SESSION 관련
|
||||||
define('SESSION_NAMES', [
|
define('SESSION_NAMES', [
|
||||||
|
|||||||
@ -172,16 +172,16 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
|
|||||||
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
||||||
$routes->post('addCart', 'CartController::insert');
|
$routes->post('addCart', 'CartController::insert');
|
||||||
$routes->get('cancelCart/(:uuid)', 'CartController::delete/$1');
|
$routes->get('cancelCart/(:uuid)', 'CartController::delete/$1');
|
||||||
$routes->group('payment', ['namespace' => 'App\Controllers\Front\Order\Payment', 'filter' => 'authFilter:user'], static function ($routes) {
|
|
||||||
$routes->get('card/(:uuid)', 'CardController::update_form/$1');
|
|
||||||
$routes->post('card/(:uuid)', 'CardController::update/$1');
|
|
||||||
$routes->get('deposit/(:uuid)', 'DepositController::update_form/$1');
|
|
||||||
$routes->post('deposit/(:uuid)', 'DepositController::update/$1');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$routes->group('billing', static function ($routes) {
|
$routes->group('billing', ['namespace' => 'App\Controllers\Front\Billing', 'filter' => 'authFilter:user'], static function ($routes) {
|
||||||
$routes->get('', 'BillingController::index', ['filter' => 'authFilter:user']);
|
$routes->get('', 'BillingController::index', ['filter' => 'authFilter:user']);
|
||||||
$routes->get('download/(:any)/(:num)', 'BillingController::download/$1/$2');
|
$routes->get('download/(:any)/(:num)', 'BillingController::download/$1/$2');
|
||||||
|
$routes->group('payment', ['namespace' => 'App\Controllers\Front\Billing\Payment'], static function ($routes) {
|
||||||
|
$routes->get('card/(:num)', 'CardController::update_form/$1');
|
||||||
|
$routes->post('card/(:num)', 'CardController::update/$1');
|
||||||
|
$routes->get('deposit/(:num)', 'DepositController::update_form/$1');
|
||||||
|
$routes->post('deposit/(:num)', 'DepositController::update/$1');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Controllers\Front;
|
namespace App\Controllers\Front\Billing;
|
||||||
|
|
||||||
use App\Models\BillingModel;
|
use App\Models\BillingModel;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use App\Controllers\Front\FrontController;
|
||||||
|
use App\Models\UserModel;
|
||||||
|
|
||||||
class BillingController extends FrontController
|
class BillingController extends FrontController
|
||||||
{
|
{
|
||||||
|
private $_userModel = null;
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -24,18 +27,23 @@ class BillingController extends FrontController
|
|||||||
$this->isRole('index');
|
$this->isRole('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function getUserModel(): UserModel
|
||||||
|
{
|
||||||
|
return $this->_userModel = $this->_userModel ?: new UserModel();
|
||||||
|
}
|
||||||
|
|
||||||
final public function getFields(string $action = ""): array
|
final public function getFields(string $action = ""): array
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'update':
|
case 'update':
|
||||||
return ['order_uid', "email", "phone", "title", "upload_file", "status"];
|
return ['order_uid', "title", "upload_file", "status"];
|
||||||
break;
|
break;
|
||||||
case "index":
|
case "index":
|
||||||
case "excel":
|
case "excel":
|
||||||
return ["order_uid", "email", "phone", "title", "upload_file", "status", "updated_at", "created_at"];
|
return ["order_uid", "title", "upload_file", "status", "updated_at", "created_at"];
|
||||||
break;
|
break;
|
||||||
case "view":
|
case "view":
|
||||||
return ['order_uid', "email", "phone", "title", "upload_file", "status", "updated_at", "created_at", 'response'];
|
return ['order_uid', "title", "upload_file", "status", "updated_at", "created_at", 'response'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
@ -1,28 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Controllers\Front\Order\Payment;
|
namespace App\Controllers\Front\Billing\Payment;
|
||||||
|
|
||||||
use App\Controllers\Front\Order\OrderController;
|
|
||||||
use App\Entities\BillingEntity;
|
use App\Entities\BillingEntity;
|
||||||
use App\Entities\OrderEntity;
|
use App\Entities\OrderEntity;
|
||||||
use App\Models\BillingModel;
|
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use App\Controllers\Front\Billing\BillingController;
|
||||||
|
|
||||||
class PaymentController extends OrderController
|
class PaymentController extends BillingController
|
||||||
{
|
{
|
||||||
protected $_billingModel = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function getBillingModel(): BillingModel
|
|
||||||
{
|
|
||||||
return $this->_billingModel = $this->_billingModel ?: new BillingModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update관련 (결제처리용)
|
//Update관련 (결제처리용)
|
||||||
protected function update_form_process($entity)
|
protected function update_form_process($entity)
|
||||||
{
|
{
|
||||||
@ -34,7 +27,6 @@ class PaymentController extends OrderController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
|
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
|
||||||
$this->_product = $this->getProductModel()->getEntity([$this->_model->getPrimaryKey() => $entity->product_uid]);
|
|
||||||
$this->_viewDatas = $this->init(__FUNCTION__);
|
$this->_viewDatas = $this->init(__FUNCTION__);
|
||||||
$this->_viewDatas['entity'] = $this->update_form_process($entity);
|
$this->_viewDatas['entity'] = $this->update_form_process($entity);
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
@ -50,7 +42,6 @@ class PaymentController extends OrderController
|
|||||||
$msg = "";
|
$msg = "";
|
||||||
try {
|
try {
|
||||||
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
|
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
|
||||||
$this->_product = $this->getProductModel()->getEntity([$this->_model->getPrimaryKey() => $entity->product_uid]);
|
|
||||||
$this->_viewDatas = $this->init(__FUNCTION__);
|
$this->_viewDatas = $this->init(__FUNCTION__);
|
||||||
$this->update_validate($entity);
|
$this->update_validate($entity);
|
||||||
//Transaction 시작
|
//Transaction 시작
|
||||||
@ -92,7 +83,7 @@ class PaymentController extends OrderController
|
|||||||
'response' => $response,
|
'response' => $response,
|
||||||
'status' => DEFAULTS['STATUS']
|
'status' => DEFAULTS['STATUS']
|
||||||
];
|
];
|
||||||
return $this->getBillingModel()->create($fieldDatas);
|
return $this->_model->create($fieldDatas);
|
||||||
}
|
}
|
||||||
final protected function sendBilling($email, string $subject, string $html): bool
|
final protected function sendBilling($email, string $subject, string $html): bool
|
||||||
{
|
{
|
||||||
@ -5,16 +5,13 @@ namespace App\Controllers\Front\Order;
|
|||||||
use App\Controllers\Front\FrontController;
|
use App\Controllers\Front\FrontController;
|
||||||
use App\Models\OrderModel;
|
use App\Models\OrderModel;
|
||||||
use App\Models\ProductModel;
|
use App\Models\ProductModel;
|
||||||
use App\Models\UserModel;
|
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class OrderController extends FrontController
|
class OrderController extends FrontController
|
||||||
{
|
{
|
||||||
private $_userModel = null;
|
|
||||||
private $_productModel = null;
|
private $_productModel = null;
|
||||||
protected $_product = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -30,10 +27,6 @@ class OrderController extends FrontController
|
|||||||
$this->isRole('index');
|
$this->isRole('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function getUserModel(): UserModel
|
|
||||||
{
|
|
||||||
return $this->_userModel = $this->_userModel ?: new UserModel();
|
|
||||||
}
|
|
||||||
final protected function getProductModel(): ProductModel
|
final protected function getProductModel(): ProductModel
|
||||||
{
|
{
|
||||||
return $this->_productModel = $this->_productModel ?: new ProductModel();
|
return $this->_productModel = $this->_productModel ?: new ProductModel();
|
||||||
|
|||||||
@ -169,6 +169,5 @@ CREATE TABLE shoppingmall.tw_billing (
|
|||||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
deleted_at timestamp NULL DEFAULT NULL,
|
deleted_at timestamp NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (uid),
|
PRIMARY KEY (uid),
|
||||||
CONSTRAINT FOREIGN KEY (order_uid) REFERENCES tw_order (uid),
|
|
||||||
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
|
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='청구서 정보';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='청구서 정보';
|
||||||
@ -157,6 +157,24 @@ function getFieldIndex_Row_BillingHelper($field, $entity, array $viewDatas): str
|
|||||||
$field
|
$field
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'status':
|
||||||
|
//미납인경우
|
||||||
|
if ($value == DEFAULTS['STATUS']) {
|
||||||
|
$card = anchor(
|
||||||
|
URLS['cardPayment'] . '/' . $entity->getPrimaryKey(),
|
||||||
|
ICONS['CARD'] . lang("{$viewDatas['className']}.PAYMENT.CARD"),
|
||||||
|
["class" => "btn btn-sm btn-primary btn-circle", "style" => "color:white", "target" => "_self"]
|
||||||
|
);
|
||||||
|
$deposit = anchor(
|
||||||
|
URLS['depositPayment'] . '/' . $entity->getPrimaryKey(),
|
||||||
|
ICONS['DEPOSIT'] . lang("{$viewDatas['className']}.PAYMENT.DEPOSIT"),
|
||||||
|
["class" => "btn btn-sm btn-info btn-circle", "style" => "color:white", "target" => "_self"]
|
||||||
|
);
|
||||||
|
return sprintf("%s<BR>%s", $card, $deposit);
|
||||||
|
} else {
|
||||||
|
return getFieldView_OrderHelper($field, $entity, $viewDatas);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return getFieldView_BillingHelper($field, $entity, $viewDatas);
|
return getFieldView_BillingHelper($field, $entity, $viewDatas);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -142,22 +142,16 @@ function getFieldIndex_Row_OrderHelper($field, $entity, array $viewDatas): strin
|
|||||||
return sprintf("%s<BR>%s", $uid, $title);
|
return sprintf("%s<BR>%s", $uid, $title);
|
||||||
break;
|
break;
|
||||||
case 'status':
|
case 'status':
|
||||||
|
//장바구니인경우
|
||||||
if ($value == DEFAULTS['STATUS']) {
|
if ($value == DEFAULTS['STATUS']) {
|
||||||
$card = anchor(
|
return anchor(
|
||||||
URLS['cardPayment'] . '/' . $entity->getPrimaryKey(),
|
URLS['Billing'] . '/' . $entity->getPrimaryKey(),
|
||||||
ICONS['CARD'] . lang("{$viewDatas['className']}.PAYMENT.CARD"),
|
CLASS_ICONS['BILLING'] . '결제하기',
|
||||||
["class" => "btn btn-sm btn-primary btn-circle", "style" => "color:white", "target" => "_self"]
|
["class" => "btn btn-sm btn-primary btn-circle", "style" => "color:white", "target" => "_self"]
|
||||||
);
|
);
|
||||||
$deposit = anchor(
|
|
||||||
URLS['depositPayment'] . '/' . $entity->getPrimaryKey(),
|
|
||||||
ICONS['DEPOSIT'] . lang("{$viewDatas['className']}.PAYMENT.DEPOSIT"),
|
|
||||||
["class" => "btn btn-sm btn-info btn-circle", "style" => "color:white", "target" => "_self"]
|
|
||||||
);
|
|
||||||
return sprintf("%s<BR>%s", $card, $deposit);
|
|
||||||
} else {
|
} else {
|
||||||
return getFieldView_OrderHelper($field, $entity, $viewDatas);
|
return getFieldView_OrderHelper($field, $entity, $viewDatas);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return getFieldView_OrderHelper($field, $entity, $viewDatas);
|
return getFieldView_OrderHelper($field, $entity, $viewDatas);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user