shoppingmallv2 init...

This commit is contained in:
최준흠 2023-08-16 19:08:51 +09:00
parent 58b02cbdbb
commit 1064eefa1b
23 changed files with 226 additions and 160 deletions

View File

@ -62,7 +62,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('category', static function ($routes) {
$routes->get('', 'CategoryController::index');
$routes->get('excel', 'CategoryController::excel/$1');
$routes->get('excel', 'CategoryController::excel');
$routes->get('insert', 'CategoryController::insert_form');
$routes->post('insert', 'CategoryController::insert');
$routes->get('update/(:num)', 'CategoryController::update_form/$1');
@ -76,7 +76,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
$routes->get('excel', 'BoardController::excel/$1');
$routes->get('excel', 'BoardController::excel');
$routes->get('insert', 'BoardController::insert_form');
$routes->post('insert', 'BoardController::insert');
$routes->get('update/(:num)', 'BoardController::update_form/$1');
@ -91,7 +91,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('sitepage', static function ($routes) {
$routes->get('', 'SitepageController::index');
$routes->get('excel', 'SitepageController::excel/$1');
$routes->get('excel', 'SitepageController::excel');
$routes->get('insert', 'SitepageController::insert_form');
$routes->post('insert', 'SitepageController::insert');
$routes->get('update/(:num)', 'SitepageController::update_form/$1');
@ -103,7 +103,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('product', static function ($routes) {
$routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel/$1');
$routes->get('excel', 'ProductController::excel');
$routes->get('insert', 'ProductController::insert_form');
$routes->post('insert', 'ProductController::insert');
$routes->get('update/(:uuid)', 'ProductController::update_form/$1');
@ -116,6 +116,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('order', static function ($routes) {
$routes->get('', 'OrderController::index');
$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');
@ -125,13 +126,14 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('billing', static function ($routes) {
$routes->get('', 'BillingController::index');
$routes->get('update/(:uuid)', 'BillingController::update_form/$1');
$routes->post('update/(:uuid)', 'BillingController::update/$1');
$routes->get('view/(:uuid)', 'BillingController::view/$1');
$routes->get('delete/(:uuid)', 'BillingController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:uuid)/(:hash)', 'BillingController::toggle/$1/$2');
$routes->get('excel', 'BillingController::excel');
$routes->get('update/(:num)', 'BillingController::update_form/$1');
$routes->post('update/(:num)', 'BillingController::update/$1');
$routes->get('view/(:num)', 'BillingController::view/$1');
$routes->get('delete/(:num)', 'BillingController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:num)/(:hash)', 'BillingController::toggle/$1/$2');
$routes->post('batchjob', 'BillingController::batchjob`');
$routes->get('download/(:any)/(:uuid)', 'BillingController::download/$1/$2');
$routes->get('download/(:any)/(:num)', 'BillingController::download/$1/$2');
});
});
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
@ -148,7 +150,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
});
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
$routes->get('excel', 'BoardController::excel/$1');
$routes->get('insert', 'BoardController::insert_form');
$routes->post('insert', 'BoardController::insert');
$routes->get('update/(:num)', 'BoardController::update_form/$1');
@ -164,7 +165,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
});
$routes->group('product', static function ($routes) {
$routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel/$1');
$routes->get('view/(:uuid)', 'ProductController::view/$1');
});
$routes->group('order', ['namespace' => 'App\Controllers\Front\Order'], static function ($routes) {
@ -180,7 +180,8 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
});
});
$routes->group('billing', static function ($routes) {
$routes->get('', 'BillingController::index');
$routes->get('', 'BillingController::index', ['filter' => 'authFilter:user']);
$routes->get('download/(:any)/(:num)', 'BillingController::download/$1/$2');
});
});
/*

View File

@ -24,14 +24,14 @@ class BillingController extends AdminController
{
switch ($action) {
case 'update':
return ["user_uid", 'order_uid', "title", "upload_file", "status"];
return ["user_uid", 'order_uid', "email", "phone", "title", "upload_file", "status"];
break;
case "index":
case "excel":
return ["user_uid", "order_uid", "title", "upload_file", "status", "updated_at", "created_at"];
return ["user_uid", "order_uid", "email", "phone", "title", "upload_file", "status", "updated_at", "created_at"];
break;
case "view":
return ["user_uid", 'order_uid', "title", "upload_file", "status", "updated_at", "created_at", 'response'];
return ["user_uid", 'order_uid', "email", "phone", "title", "upload_file", "status", "updated_at", "created_at", 'response'];
break;
default:
return [];

View File

@ -550,10 +550,13 @@ abstract class BaseController extends Controller
private function index_getEntitys(): array
{
$this->index_setCondition();
return $this->_viewDatas['page'] ? $this->_model->findAll(
$this->_viewDatas['per_page'],
$this->_viewDatas['page'] * $this->_viewDatas['per_page'] - $this->_viewDatas['per_page']
) : $this->_model->findAll();
if (array_key_exists('page', $this->_viewDatas)) {
return $this->_model->findAll(
$this->_viewDatas['per_page'],
$this->_viewDatas['page'] * $this->_viewDatas['per_page'] - $this->_viewDatas['per_page']
);
}
return $this->_model->findAll();
}
public function index()
{
@ -596,37 +599,44 @@ abstract class BaseController extends Controller
}
//Excel 관련
private function excel_spreadSheet(array $viewDatas)
final protected function spreadSheet(string $html)
{
//Excepl 초기화
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
//Header용
$column = 'A';
foreach ($viewDatas['fields'] as $field) {
$sheet->setCellValue($column++ . '1', lang($this->_viewDatas['className'] . '.label.' . $field));
}
//본문용
$line = 2;
foreach ($this->index_getEntitys() as $entity) {
$column = 'A';
foreach ($viewDatas['fields'] as $field) {
$value = in_array($field, $viewDatas['fieldFilters']) ? $viewDatas['fieldFormOptions'][$field][$entity->$field] : $entity->$field;
$sheet->setCellValue($column . $line, $value);
$column++;
}
$line++;
}
return $spreadsheet;
// //HTML저장
// file_put_contents($fileName . '.html', $html);
//HTML Read
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html();
$spreadsheet = $reader->loadFromString($html);
// from File의 경우
// $spreadsheet = $reader->load($fileName . '.html');
//Excel저장
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
// $writer->save($fileName . '.xlsx');
// //PDF저장
// $writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
// $writer->save($fileName . '.pdf');
return $writer;
}
public function excel()
{
try {
$this->_viewDatas = $this->init(__FUNCTION__);
$fileName = date('Y-m-d_Hm') . '.xlsx';
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->excel_spreadSheet($this->_viewDatas), 'Xlsx');
$this->_viewDatas['Entitys'] = $this->index_getEntitys();
$html = view(
$this->_viewPath . '/excel',
['viewDatas' => $this->_viewDatas]
);
//결과파일저장
$writer->save(PATHS['EXCEL'] . '/' . $fileName);
$fileName = sprintf(
"%s/%s_%s",
PATHS['EXCEL'],
$this->_viewDatas['className'],
date('Y-m-d_Hm')
);
$writer = $this->spreadSheet($html);
$writer->save($fileName . '.xlsx');
//Download시
header("Content-Type: application/vnd.ms-excel");
header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($fileName)));
@ -642,25 +652,19 @@ abstract class BaseController extends Controller
}
}
//File Download관련
public function download_process($entity)
public function download_process($field, $entity)
{
return $entity;
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (!is_file(PATHS['UPLOAD'] . "/" . $uploaded_filename)) {
throw new \Exception("첨부파일이 확인되지 않습니다.\n");
}
return $this->response->download(PATHS['UPLOAD'] . "/" . $uploaded_filename, null)->setFileName(date("Ymd") . '_' . $filename);
}
public function download(string $field, $uid)
{
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
if (!$entity->$field) {
throw new \Exception("첨부파일이 확인되지 않습니다.");
}
$entity = $this->download_process($entity);
echo "TEST";
exit;
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (!is_file(PATHS['UPLOAD'] . "/" . $uploaded_filename)) {
throw new \Exception("파일이 확인되지 않습니다.\n" . PATHS['UPLOAD'] . "/" . $uploaded_filename);
}
return $this->response->download(PATHS['UPLOAD'] . "/" . $uploaded_filename, null)->setFileName(date("Ymd") . '_' . $filename);
return $this->download_process($field, $entity);
} catch (\Exception $e) {
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
}

View File

@ -28,14 +28,14 @@ class BillingController extends FrontController
{
switch ($action) {
case 'update':
return ['order_uid', "title", "upload_file", "status"];
return ['order_uid', "email", "phone", "title", "upload_file", "status"];
break;
case "index":
case "excel":
return ["order_uid", "title", "upload_file", "status", "updated_at", "created_at"];
return ["order_uid", "email", "phone", "title", "upload_file", "status", "updated_at", "created_at"];
break;
case "view":
return ['order_uid', "title", "upload_file", "status", "updated_at", "created_at", 'response'];
return ['order_uid', "email", "phone", "title", "upload_file", "status", "updated_at", "created_at", 'response'];
break;
default:
return [];
@ -50,4 +50,23 @@ class BillingController extends FrontController
{
return ["status"];
}
//Index관련
protected function index_setCondition()
{
//사용자정보(user_uid)에 맞는 Biiling정보 가져오기
$this->_model->where('user_uid', $this->_session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]);
$this->_model->where("status", DEFAULTS['STATUS']);
parent::index_setCondition();
}
//Download관련
public function download_process($field, $entity)
{
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (!is_file(PATHS['BILLING'] . "/" . $uploaded_filename)) {
throw new \Exception("첨부파일이 확인되지 않습니다.\n");
}
return $this->response->download(PATHS['BILLING'] . "/" . $uploaded_filename, null)->setFileName(date("Ymd") . '_' . $filename);
}
}

View File

@ -145,10 +145,16 @@ class BoardController extends FrontController
parent::index_setCondition();
}
//Download관련
public function download_process($entity)
public function download_process($field, $entity): array
{
$entity = parent::download_process($field, $entity);
//권한체크
$this->isRole('download', $entity);
return parent::download_process($entity);
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (!is_file(PATHS['UPLOAD'] . "/" . $uploaded_filename)) {
throw new \Exception("파일이 확인되지 않습니다.\n" . PATHS['UPLOAD'] . "/" . $uploaded_filename);
}
return array($filename, $uploaded_filename);
return parent::download_process($field, $entity);
}
}

View File

@ -30,11 +30,11 @@ class OrderController extends FrontController
$this->isRole('index');
}
final protected function getUserModel()
final protected function getUserModel(): UserModel
{
return $this->_userModel = $this->_userModel ?: new UserModel();
}
final protected function getProductModel()
final protected function getProductModel(): ProductModel
{
return $this->_productModel = $this->_productModel ?: new ProductModel();
}

View File

@ -23,7 +23,7 @@ class CardController extends PaymentController
{
switch ($action) {
case 'update':
return ["card_quota", "card_number", "card_expiration", "email", "mobile"];
return ["card_quota", "card_number", "card_expiration", "email", "phone"];
break;
default:
return [];
@ -48,7 +48,7 @@ class CardController extends PaymentController
case "email":
$rules[$field] = 'required|valid_email';
break;
case "mobile":
case "phone":
$rules[$field] = 'required|regex_match[/^[0-9]{3}-[0-9]{4}-[0-9]{4}/]';
break;
default:
@ -98,19 +98,18 @@ class CardController extends PaymentController
}
protected function update_process($entity)
{
//결제처리
$this->_viewDatas['fieldDatas'] = array("status" => $this->_viewDatas['className']);
$entity = parent::update_process($entity);
//카드결제
$response = $this->pg_process();
//청구서 발행정보
$this->_viewDatas['entity'] = $entity;
$subject = sprintf("%s %s 청구서입니다.", $entity->getTitle(), date("Y년 m월"));
$html = view(
$this->_viewPath . 'billing',
['viewDatas' => $this->_viewDatas['fieldDatas']]
$this->_viewPath . '/billing',
['viewDatas' => $this->_viewDatas]
);
//청구서 발행
$this->billing($entity, $subject, $html);
return $entity;
//결과파일저장
$this->createBilling($entity, $subject, $html, $response);
//결제처리
return $this->_model->modify($entity, ["status" => $this->_viewDatas['className']]);
}
}

View File

@ -16,13 +16,18 @@ class DepositController extends PaymentController
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
$this->_viewDatas['bank'] = [
"name" => getenv("payment.deposit.bank.name") ?: "은행명",
"account" => getenv("payment.deposit.bank.account") ?: "계좌번호",
"holder" => getenv("payment.deposit.bank.holder") ?: "예금주"
];
}
public function getFields(string $action = ""): array
{
switch ($action) {
case 'update':
return ["email", "mobile"];
return ["email", "phone"];
break;
default:
return [];
@ -38,7 +43,7 @@ class DepositController extends PaymentController
case "email":
$rules[$field] = 'required|valid_email';
break;
case "mobile":
case "phone":
$rules[$field] = 'required|regex_match[/^[0-9]{3}-[0-9]{4}-[0-9]{4}/]';
break;
default:
@ -57,32 +62,19 @@ class DepositController extends PaymentController
}
//Insert관련
//무통장입금결제Form
protected function update_form_process($entity)
{
$entity = parent::update_form_process($entity);
$this->_viewDatas['bank'] = [
"name" => getenv("payment.deposit.bank.name") ?: "은행명",
"account" => getenv("payment.deposit.bank.account") ?: "계좌번호",
"holder" => getenv("payment.deposit.bank.holder") ?: "예금주"
];
return $entity;
}
//무통장입금결제처리
protected function update_process($entity)
{
//겔제처리
$this->_viewDatas['fieldDatas'] = array("status" => $this->_viewDatas['className']);
$entity = parent::update_process($entity);
//청구서 발행정보
$this->_viewDatas['entity'] = $entity;
$subject = sprintf("%s %s 청구서입니다.", $entity->getTitle(), date("Y년 m월"));
$html = view(
$this->_viewPath . 'billing',
['viewDatas' => $this->_viewDatas['fieldDatas']]
$this->_viewPath . '/billing',
['viewDatas' => $this->_viewDatas]
);
//청구서 발행
$this->billing($entity, $subject, $html);
return $entity;
//결과파일저장
$this->createBilling($entity, $subject, $html);
//결제처리
return $this->_model->modify($entity, ["status" => $this->_viewDatas['className']]);
}
}

View File

@ -3,19 +3,26 @@
namespace App\Controllers\Front\Order\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 Dompdf\Dompdf;
use Psr\Log\LoggerInterface;
class PaymentController extends OrderController
{
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)
{
@ -46,10 +53,16 @@ class PaymentController extends OrderController
$this->_product = $this->getProductModel()->getEntity([$this->_model->getPrimaryKey() => $entity->product_uid]);
$this->_viewDatas = $this->init(__FUNCTION__);
$this->update_validate($entity);
//Transaction 시작
$this->_model->transStart();
$entity = $this->update_process($entity);
//Transaction Commit
$this->_model->transComplete();
$msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 결제가 완료하였습니다.";
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback
$this->_model->transRollback();
$msg = "{$this->_viewDatas['title']}에서 결제를 실패하였습니다.\n" . $e->getMessage();
log_message("error", $e->getMessage());
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
@ -60,30 +73,35 @@ class PaymentController extends OrderController
}
//청구서관련
final protected function billing(OrderEntity $entity, string $subject, string $html)
final protected function createBilling(OrderEntity $entity, string $subject, string $html, $response = ''): BillingEntity
{
//Email 발송
$email = \Config\Services::email();
$email->setFrom(MALLS['support'], MALLS['title'], MALLS['master']);
$email->setTo($entity->email);
$email->setCC(MALLS['master']);
$email->setSubject($subject);
$email->setMessage($html);
$email->send();
//PDF저장
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
//Output the generated PDF to Browser
// $dompdf->stream();
$filename = sprintf(
"%s/%s_%s.pdf",
PATHS['BILLING'],
$entity->getPrimaryKey(),
date("Y-m")
);
file_put_contents($filename, $dompdf->output());
//청구서파일 생성
$fileName = sprintf("%s_%s", $entity->getPrimaryKey(), date('Y-m-d_Hm') . '.xlsx');
$writer = $this->spreadSheet($html);
$writer->save(PATHS['BILLING'] . '/' . $fileName);
//메일발송
$this->sendBilling($this->_viewDatas['fieldDatas']['email'], $subject, $html);
$fieldDatas = [
'order_uid' => $entity->getPrimaryKey(),
'user_uid' => $this->_viewDatas['auth'][AUTH_FIELDS['ID']],
'email' => $this->_viewDatas['fieldDatas']['email'],
'phone' => $this->_viewDatas['fieldDatas']['phone'],
'title' => $subject,
'content' => $html,
'upload_file' => sprintf("%s%s%s", $this->_viewDatas['className'] . '.xlsx', DEFAULTS['DELIMITER_FILE'], $fileName),
'response' => $response,
'status' => DEFAULTS['STATUS']
];
return $this->getBillingModel()->create($fieldDatas);
}
final protected function sendBilling($email, string $subject, string $html): bool
{
$mail = \Config\Services::email();
$mail->setFrom(MALLS['support'], MALLS['title'], MALLS['master']);
$mail->setTo($email);
$mail->setCC(MALLS['master']);
$mail->setSubject($subject);
$mail->setMessage($html);
return $mail->send();
}
}

View File

@ -158,10 +158,13 @@ CREATE TABLE shoppingmall.tw_order (
DROP TABLE IF EXISTS shoppingmall.tw_billing;
CREATE TABLE shoppingmall.tw_billing (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
order_uid varchar(36) NULL COMMENT '주문 정보',
user_uid varchar(36) NULL COMMENT '사용자 정보',
order_uid varchar(36) NOT NULL COMMENT '주문 정보',
user_uid varchar(36) NOT NULL COMMENT '사용자 정보',
email varchar(50) NOT NULL,
phone varchar(20) NULL COMMENT '연락처',
title varchar(255) NOT NULL COMMENT '청구서제목',
upload_file varchar(255) NULL COMMENT 'PDF 파일명',
content text NOT NULL COMMENT '정구서내용',
upload_file varchar(255) NULL COMMENT '파일명',
response text NULL COMMENT '결제처리결과',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등',
updated_at timestamp NULL DEFAULT NULL,

View File

@ -12,7 +12,7 @@ class BillingEntity extends BaseEntity
//기본기능
final public function getTitle(): string
{
return $this->attributes['name'];
return $this->attributes['title'];
}
//추가기능
//파일관련 Field전용
@ -21,9 +21,10 @@ class BillingEntity extends BaseEntity
if (is_null($this->attributes[$field])) {
return "";
}
$files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
return anchor(
$url,
ICONS['IMAGE_FILE'] . $this->attributes[$field],
ICONS['IMAGE_FILE'] . $files[0],
["target" => "_self"]
);
}

View File

@ -136,17 +136,26 @@ function getFieldIndex_Row_BillingHelper($field, $entity, array $viewDatas): str
switch ($field) {
case 'title':
case 'name':
$uid = lang("{$viewDatas['className']}.label.uid") . ' : ' . str_split($entity->getPrimaryKey(), 4)[0] . '-xx-' . str_split($entity->getPrimaryKey(), 4)[1];
$title = anchor(
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf("%s<BR>%s", $uid, $title);
break;
case 'order_uid':
case 'user_uid':
return getFieldView_BillingHelper($field, $entity, $viewDatas);
break;
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(base_url() . $viewDatas['control'] . '/billing', $field);
// echo var_export($entity, true);
// exit;
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/billing/download/{$field}/{$entity->getPrimaryKey()}",
$field
);
break;
default:
return getFieldView_BillingHelper($field, $entity, $viewDatas);
@ -160,16 +169,20 @@ function getFieldIndex_Row_BillingHelper_Admin($field, $entity, array $viewDatas
switch ($field) {
case 'title':
case 'name':
$uid = lang("{$viewDatas['className']}.label.uid") . ' : ' . str_split($entity->getPrimaryKey(), 4)[0] . '-xx-' . str_split($entity->getPrimaryKey(), 4)[1];
$title = anchor(
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf("%s<BR>%s", $uid, $title);
break;
case 'user_uid':
return getFieldView_BillingHelper($field, $entity, $viewDatas);
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/billing/download/{$field}/{$entity->getPrimaryKey()}",
$field
);
break;
default:
if (in_array($field, $viewDatas['fieldFilters'])) {

View File

@ -73,16 +73,6 @@ function getFieldView_BoardHelper($field, $entity, array $viewDatas)
}
return $value;
break;
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/board/download/{$field}/{$entity->getPrimaryKey()}" .
'?category=' . $viewDatas['category']->getPrimaryKey(),
$field
);
break;
case 'photo':
return $entity->getFileImage('middle', $field);
break;
@ -151,6 +141,16 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin
);
return sprintf("%s%s %s", $depth, $reply, $view);
break;
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/board/download/{$field}/{$entity->getPrimaryKey()}" .
'?category=' . $viewDatas['category']->getPrimaryKey(),
$field
);
break;
default:
return getFieldView_BoardHelper($field, $entity, $viewDatas);
break;
@ -182,7 +182,12 @@ function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas):
break;
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(base_url() . $viewDatas['control'] . '/board', $field);
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/board/download/{$field}/{$entity->getPrimaryKey()}",
$field
);
break;
default:
if (in_array($field, $viewDatas['fieldFilters'])) {

View File

@ -49,8 +49,8 @@ function getFieldForm_CardHelper($field, $value, array $viewDatas, array $attrib
case 'email':
return form_input($field, $viewDatas['user']->email);
break;
case 'mobile':
return form_input($field, $viewDatas['user']->mobile);
case 'phone':
return form_input($field, $viewDatas['user']->phone);
break;
default:
return form_input($field, $value);

View File

@ -20,8 +20,8 @@ function getFieldForm_DepositHelper($field, $value, array $viewDatas, array $att
case 'email':
return form_input($field, $viewDatas['user']->email);
break;
case 'mobile':
return form_input($field, $viewDatas['user']->mobile);
case 'phone':
return form_input($field, $viewDatas['user']->phone);
break;
default:
return form_input($field, $value);

View File

@ -5,6 +5,8 @@ return [
'uid' => "청구서번호",
'order_uid' => "주문정보",
'user_uid' => "사용자정보",
'email' => '이메일',
'phone' => '연락처',
'title' => "청구서명",
'upload_file' => "청구서파일",
'response' => "결제처리결과",

View File

@ -7,7 +7,7 @@ return [
'card_number' => '카드번호',
'card_expiration' => '유효기간',
'email' => '이메일',
'mobile' => '인증휴대폰',
'phone' => '연락처',
],
"CARD_QUOTA" => [
"00" => "일시불",

View File

@ -4,6 +4,6 @@ return [
'label' => [
'order_uid' => '주문번호',
'email' => '이메일',
'mobile' => '인증휴대폰',
'phone' => '연락처',
],
];

View File

@ -8,15 +8,14 @@ use App\Entities\ProductEntity;
class BillingModel extends BaseModel
{
private $_order_options = null;
protected $table = "tw_order";
protected $useAutoIncrement = false;
protected $table = "tw_billing";
protected $returnType = BillingEntity::class;
protected $useSoftDeletes = true;
public function __construct()
{
parent::__construct('Billing');
$this->allowedFields = [
...$this->allowedFields, 'order_uid', "user_uid",
...$this->allowedFields, 'order_uid', "user_uid", "email", "phone",
"title", "upload_file", "response", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
@ -31,6 +30,12 @@ class BillingModel extends BaseModel
case 'order_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 "email":
$rules[$field] = "required|trim|valid_email";
break;
case "phone":
$rules[$field] = "if_exist|string";
break;
case $this->getTitleField():
$rules[$field] = "required|trim|string";
break;
@ -38,7 +43,7 @@ class BillingModel extends BaseModel
$rules[$field] = "if_exist|string";
break;
case "response":
$rules[$field] = "required|string";
$rules[$field] = "if_exist|string";
break;
default:
$rules = parent::getFieldRule($field, $rules, $action);

View File

@ -16,7 +16,6 @@
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<!-- 사용자가 자신의 작성한것인지 확인되면 update 가능-->
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>

View File

@ -1,4 +1,4 @@
<link href="/css/front/billing.css" media="screen" rel="stylesheet" type="text/css" />
<link href="<?= base_url("css/front/billing.css") ?>" media=" screen" rel="stylesheet" type="text/css" />
<table id="billing">
<tr>
<td class="label">상품명</td>

View File

@ -12,8 +12,7 @@
"twbs/bootstrap": "5.2.3",
"guzzlehttp/guzzle": "^7.7",
"google/apiclient": "2.12.1",
"tinymce/tinymce": "^6.6",
"dompdf/dompdf": "^2.0"
"tinymce/tinymce": "^6.6"
},
"require-dev": {
"fakerphp/faker": "^1.9",