47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Customer\Wallet;
|
|
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
use RuntimeException;
|
|
|
|
class AccountController extends WalletController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
if ($this->service === null) {
|
|
$this->service = service('customer_wallet_accountservice');
|
|
}
|
|
$this->addActionPaths('account');
|
|
}
|
|
//기본 함수 작업
|
|
//Custom 추가 함수
|
|
final public function create_form(): string|RedirectResponse
|
|
{
|
|
try {
|
|
$uid = $this->request->getVar('clientinfo_uid');
|
|
if (!$uid) {
|
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 고객정보 번호가 정의되지 않았습니다..");
|
|
}
|
|
$clientEntity = service('customer_clientservice')->getEntity($uid);
|
|
if (!$clientEntity) {
|
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 고객정보을 찾을수 없습니다.");
|
|
}
|
|
$action = __FUNCTION__;
|
|
$formDatas = [];
|
|
$formDatas['clientinfo_uid'] = $uid;
|
|
$formDatas['alias'] = $clientEntity->getTitle();
|
|
$formDatas['issue_at'] = date('Y-m-d');
|
|
$this->action_init_process($action, $formDatas);
|
|
$this->addViewDatas('formDatas', $formDatas);
|
|
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
|
|
} catch (\Throwable $e) {
|
|
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
|
|
}
|
|
}
|
|
}
|