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