dbmsv4 init...2
This commit is contained in:
parent
2868dd5d2a
commit
ca85c5a21d
@ -2,19 +2,22 @@
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Services\Auth\GoogleService;
|
||||
use App\Services\Auth\LocalService;
|
||||
use App\Services\BoardService;
|
||||
use App\Services\Customer\AccountService;
|
||||
use App\Services\MylogService;
|
||||
use App\Services\PaymentService;
|
||||
use App\Services\UserService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\CouponService;
|
||||
use App\Services\Customer\PointService;
|
||||
use App\Services\Customer\Wallet\CouponService;
|
||||
use App\Services\Customer\Wallet\PointService;
|
||||
use App\Services\Customer\Wallet\AccountService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\CHASSISService;
|
||||
use App\Services\MylogService;
|
||||
use App\Services\Part\CPUService;
|
||||
use App\Services\Part\CSService;
|
||||
use App\Services\Part\DISKService;
|
||||
@ -22,9 +25,6 @@ use App\Services\Part\IPService;
|
||||
use App\Services\Part\RAMService;
|
||||
use App\Services\Part\SOFTWAREService;
|
||||
use App\Services\Part\SWITCHService;
|
||||
use App\Services\PaymentService;
|
||||
use App\Services\UserService;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
@ -130,31 +130,31 @@ class Services extends BaseService
|
||||
new \App\Models\Customer\ClientModel(),
|
||||
);
|
||||
}
|
||||
public static function customer_accountservice($getShared = true): AccountService
|
||||
public static function customer_wallet_accountservice($getShared = true): AccountService
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance(__FUNCTION__);
|
||||
}
|
||||
return new AccountService(
|
||||
new \App\Models\Customer\AccountModel(),
|
||||
new \App\Models\Customer\Wallet\AccountModel(),
|
||||
);
|
||||
}
|
||||
public static function customer_couponservice($getShared = true): CouponService
|
||||
public static function customer_wallet_couponservice($getShared = true): CouponService
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance(__FUNCTION__);
|
||||
}
|
||||
return new CouponService(
|
||||
new \App\Models\Customer\CouponModel(),
|
||||
new \App\Models\Customer\Wallet\CouponModel(),
|
||||
);
|
||||
}
|
||||
public static function customer_pointservice($getShared = true): PointService
|
||||
public static function customer_wallet_pointservice($getShared = true): PointService
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance(__FUNCTION__);
|
||||
}
|
||||
return new PointService(
|
||||
new \App\Models\Customer\PointModel(),
|
||||
new \App\Models\Customer\Wallet\PointModel(),
|
||||
);
|
||||
}
|
||||
public static function customer_serviceservice($getShared = true): ServiceService
|
||||
|
||||
@ -28,7 +28,7 @@ abstract class AdminController extends CommonController
|
||||
$this->addViewDatas('formRules', $this->service->getFormService()->getFormRules());
|
||||
$this->addViewDatas('formFilters', $this->service->getFormService()->getFormFilters());
|
||||
$this->addViewDatas('formOptions', $this->service->getFormService()->getFormOptions());
|
||||
$this->addViewDatas('index_actionButtons', $this->service->getFormService()->getactionButtons());
|
||||
$this->addViewDatas('index_actionButtons', $this->service->getFormService()->getActionButtons());
|
||||
$this->addViewDatas('index_batchjobFields', $this->service->getFormService()->getBatchjobFilters());
|
||||
$this->addViewDatas('index_batchjobButtons', $this->service->getFormService()->getBatchjobButtons());
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
namespace App\Controllers\Admin\Customer\Wallet;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AccountController extends CustomerController
|
||||
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_accountservice');
|
||||
$this->service = service('customer_wallet_accountservice');
|
||||
}
|
||||
$this->addActionPaths('account');
|
||||
}
|
||||
@ -1,19 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
namespace App\Controllers\Admin\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CouponController extends CustomerController
|
||||
class CouponController extends WalletController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
if ($this->service === null) {
|
||||
$this->service = service('customer_couponservice');
|
||||
$this->service = service('customer_wallet_couponservice');
|
||||
}
|
||||
$this->addActionPaths('coupon');
|
||||
}
|
||||
@ -1,19 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
namespace App\Controllers\Admin\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PointController extends CustomerController
|
||||
class PointController extends WalletController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
if ($this->service === null) {
|
||||
$this->service = service('customer_pointservice');
|
||||
$this->service = service('customer_wallet_pointservice');
|
||||
}
|
||||
$this->addActionPaths('point');
|
||||
}
|
||||
18
app/Controllers/Admin/Customer/Wallet/WalletController.php
Normal file
18
app/Controllers/Admin/Customer/Wallet/WalletController.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer\Wallet;
|
||||
|
||||
use App\Controllers\Admin\Customer\CustomerController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class WalletController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->addActionPaths('wallet');
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\DTOs\Customer;
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\DTOs\Customer;
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\DTOs\Customer;
|
||||
namespace App\DTOs\Customer\Wallet;
|
||||
|
||||
use App\DTOs\CommonDTO;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
namespace App\Entities\Customer\Wallet;
|
||||
|
||||
use App\Models\Customer\AccountModel;
|
||||
use App\Models\Customer\Wallet\AccountModel;
|
||||
|
||||
class AccountEntity extends CustomerEntity
|
||||
class AccountEntity extends WalletEntity
|
||||
{
|
||||
const PK = AccountModel::PK;
|
||||
const TITLE = AccountModel::TITLE;
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
namespace App\Entities\Customer\Wallet;
|
||||
|
||||
use App\Models\Customer\CouponModel;
|
||||
use App\Models\Customer\Wallet\CouponModel;
|
||||
|
||||
class CouponEntity extends CustomerEntity
|
||||
class CouponEntity extends WalletEntity
|
||||
{
|
||||
const PK = CouponModel::PK;
|
||||
const TITLE = CouponModel::TITLE;
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
namespace App\Entities\Customer\Wallet;
|
||||
|
||||
use App\Models\Customer\PointModel;
|
||||
use App\Models\Customer\Wallet\PointModel;
|
||||
|
||||
class PointEntity extends CustomerEntity
|
||||
class PointEntity extends WalletEntity
|
||||
{
|
||||
const PK = PointModel::PK;
|
||||
const TITLE = PointModel::TITLE;
|
||||
14
app/Entities/Customer/Wallet/WalletEntity.php
Normal file
14
app/Entities/Customer/Wallet/WalletEntity.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\CustomerEntity;
|
||||
|
||||
|
||||
abstract class WalletEntity extends CustomerEntity
|
||||
{
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ abstract class CommonForm
|
||||
{
|
||||
return $this->_actionButtons = $buttons;
|
||||
}
|
||||
final public function getactionButtons(): array
|
||||
final public function getActionButtons(): array
|
||||
{
|
||||
return $this->_actionButtons;
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Customer;
|
||||
|
||||
class CouponForm extends CustomerForm
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Customer;
|
||||
namespace App\Forms\Customer\Wallet;
|
||||
|
||||
class AccountForm extends CustomerForm
|
||||
class AccountForm extends WalletForm
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
31
app/Forms/Customer/Wallet/CouponForm.php
Normal file
31
app/Forms/Customer/Wallet/CouponForm.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Customer\Wallet;
|
||||
|
||||
class CouponForm extends WalletForm
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFormRule(string $action, string $field): string
|
||||
{
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "cnt":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "title":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "content":
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFormRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Customer;
|
||||
namespace App\Forms\Customer\Wallet;
|
||||
|
||||
class PointForm extends CustomerForm
|
||||
class PointForm extends WalletForm
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
13
app/Forms/Customer/Wallet/WalletForm.php
Normal file
13
app/Forms/Customer/Wallet/WalletForm.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Forms\Customer\Wallet;
|
||||
|
||||
use App\Forms\Customer\CustomerForm;
|
||||
|
||||
abstract class WalletForm extends CustomerForm
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
namespace App\Helpers\Customer\Wallet;
|
||||
|
||||
class AccountHelper extends CustomerHelper
|
||||
class AccountHelper extends WalletHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
namespace App\Helpers\Customer\Wallet;
|
||||
|
||||
class CouponHelper extends CustomerHelper
|
||||
class CouponHelper extends WalletHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
namespace App\Helpers\Customer\Wallet;
|
||||
|
||||
class PointHelper extends CustomerHelper
|
||||
class PointHelper extends WalletHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
14
app/Helpers/Customer/Wallet/WalletHelper.php
Normal file
14
app/Helpers/Customer/Wallet/WalletHelper.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer\Wallet;
|
||||
|
||||
use App\Helpers\Customer\CustomerHelper;
|
||||
|
||||
|
||||
abstract class WalletHelper extends CustomerHelper
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@ -65,17 +65,11 @@ class PaymentHelper extends CommonHelper
|
||||
case 'invoice':
|
||||
$action = form_submit($action . "_submit", $label ? $label : '청구서 발행', [
|
||||
"formaction" => current_url() . '/' . $action,
|
||||
"class" => "btn btn-outline btn-primary",
|
||||
"class" => "btn btn-sm btn-outline btn-primary",
|
||||
]);
|
||||
break;
|
||||
case 'paid':
|
||||
$action = form_submit($action . "_submit", $label ? $label : '결제 처리', [
|
||||
"formaction" => current_url() . '/' . $action,
|
||||
"class" => "btn btn-outline btn-warning",
|
||||
]);
|
||||
break;
|
||||
case 'onetime_paid':
|
||||
$action = "<a href=\"/admin/payment/paid/{$viewDatas['entity']->getPK()}\">{$label}</a>";
|
||||
$action = sprintf("<a href=\"/admin/payment/paid/%s\" class=\"btn btn-sm btn-warning\">%s</a>", $viewDatas['entity']->getPK(), $label ? $label : '결제');
|
||||
break;
|
||||
default:
|
||||
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
namespace App\Models\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\AccountEntity;
|
||||
use App\Entities\Customer\Wallet\AccountEntity;
|
||||
|
||||
class AccountModel extends CustomerModel
|
||||
class AccountModel extends WalletModel
|
||||
{
|
||||
const TABLE = "accountinfo";
|
||||
const PK = "uid";
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
namespace App\Models\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use App\Entities\Customer\Wallet\CouponEntity;
|
||||
|
||||
class CouponModel extends CustomerModel
|
||||
class CouponModel extends WalletModel
|
||||
{
|
||||
const TABLE = "couponinfo";
|
||||
const PK = "uid";
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
namespace App\Models\Customer\Wallet;
|
||||
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use App\Entities\Customer\Wallet\PointEntity;
|
||||
|
||||
class PointModel extends CustomerModel
|
||||
class PointModel extends WalletModel
|
||||
{
|
||||
const TABLE = "pointinfo";
|
||||
const PK = "uid";
|
||||
14
app/Models/Customer/Wallet/WalletModel.php
Normal file
14
app/Models/Customer/Wallet/WalletModel.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer\Wallet;
|
||||
|
||||
use App\Models\Customer\CustomerModel;
|
||||
|
||||
|
||||
abstract class WalletModel extends CustomerModel
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use RuntimeException;
|
||||
use App\Models\Customer\ClientModel;
|
||||
use App\Helpers\Customer\ClientHelper;
|
||||
use App\Forms\Customer\ClientForm;
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\DTOs\Customer\ClientDTO;
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Forms\Customer\ClientForm;
|
||||
use App\Helpers\Customer\ClientHelper;
|
||||
use App\Models\Customer\ClientModel;
|
||||
use RuntimeException;
|
||||
|
||||
class ClientService extends CustomerService
|
||||
{
|
||||
@ -123,6 +123,7 @@ class ClientService extends CustomerService
|
||||
switch ($key) {
|
||||
case PAYMENT['PAY']['ACCOUNT']:
|
||||
$balance = $entity->getAccountBalance();
|
||||
$title = "예치금";
|
||||
break;
|
||||
case PAYMENT['PAY']['COUPON']:
|
||||
$balance = $entity->getCouponBalance();
|
||||
@ -135,14 +136,15 @@ class ClientService extends CustomerService
|
||||
}
|
||||
//입금,추가 처리
|
||||
if ($status === STATUS['DEPOSIT']) {
|
||||
$calculatedValue = $balance - $value;
|
||||
$calculatedValue = $balance + $value;
|
||||
}
|
||||
//출금,사용 처리
|
||||
if ($status === STATUS['WITHDRAWAL']) {
|
||||
if ($balance < $value) {
|
||||
throw new RuntimeException(sprintf(
|
||||
"%s 에서 오류발생: 고객 %s[%s]이/가 사용한 %s 금액/수[%s] 보다 작습니다.",
|
||||
"%s 에서 오류발생: %s 고객의 %s[%s]이/가 사용한 %s 금액/수[%s] 보다 작습니다.",
|
||||
__METHOD__,
|
||||
$entity->getTitle(),
|
||||
$title,
|
||||
number_format($balance),
|
||||
$title,
|
||||
@ -152,7 +154,7 @@ class ClientService extends CustomerService
|
||||
$calculatedValue = $balance - $value;
|
||||
}
|
||||
if (!is_int($calculatedValue) || $calculatedValue < 0) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$title}의 계산결과 값이 NULL이거나 0보다 작은 값입니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$entity->getTitle()} 고객 {$title}의 계산결과 값이 NULL이거나 0보다 작은 값입니다.");
|
||||
}
|
||||
//balance 수정
|
||||
$formDatas = ["{$key}_balance" => $calculatedValue, 'status' => $status];
|
||||
@ -161,6 +163,38 @@ class ClientService extends CustomerService
|
||||
$this->getFormService()->setFormRules('modify', $fields);
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
//pay방식에따른 결제처리
|
||||
final public function updateWalletByPayment(PaymentEntity $entity): void
|
||||
{
|
||||
$service = null;
|
||||
switch ($entity->getPay()) {
|
||||
case PAYMENT['PAY']['ACCOUNT']:
|
||||
$service = service('customer_wallet_accountservice');
|
||||
break;
|
||||
case PAYMENT['PAY']['COUPON']:
|
||||
$service = service('customer_wallet_couponservice');
|
||||
break;
|
||||
case PAYMENT['PAY']['POINT']:
|
||||
$service = service('customer_wallet_pointservice');
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getPay()}는 지정되지 않은 지불방식입니다.");
|
||||
// break;
|
||||
}
|
||||
$formDatas = [
|
||||
'clientinfo_uid' => $entity->getClientInfoUID(),
|
||||
'bank' => '결제차감',
|
||||
'title' => $entity->getTitle(),
|
||||
'alias' => '결제차감',
|
||||
'issue_at' => date('Y-m-d'),
|
||||
'amount' => $entity->getAmount(),
|
||||
'status' => STATUS['WITHDRAWAL'],
|
||||
];
|
||||
$fields = array_keys($formDatas);
|
||||
$service->getFormService()->setFormFields($fields);
|
||||
$service->getFormService()->setFormRules('create', $fields);
|
||||
$service->create_process($formDatas);
|
||||
}
|
||||
//기본 기능부분
|
||||
protected function getEntity_process(mixed $entity): ClientEntity
|
||||
{
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
namespace App\Services\Customer\Wallet;
|
||||
|
||||
use App\DTOs\Customer\AccountDTO;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\Customer\AccountEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Forms\Customer\AccountForm;
|
||||
use App\Helpers\Customer\AccountHelper;
|
||||
use App\Models\Customer\AccountModel;
|
||||
use App\DTOs\Customer\Wallet\AccountDTO;
|
||||
use App\Entities\Customer\Wallet\AccountEntity;
|
||||
use App\Forms\Customer\Wallet\AccountForm;
|
||||
use App\Helpers\Customer\Wallet\AccountHelper;
|
||||
use App\Models\Customer\Wallet\AccountModel;
|
||||
use RuntimeException;
|
||||
|
||||
class AccountService extends CustomerService
|
||||
class AccountService extends WalletService
|
||||
{
|
||||
private $_form = null;
|
||||
private $_helper = null;
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
namespace App\Services\Customer\Wallet;
|
||||
|
||||
use RuntimeException;
|
||||
use App\Models\Customer\CouponModel;
|
||||
use App\Helpers\Customer\CouponHelper;
|
||||
use App\Forms\Customer\CouponForm;
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use App\DTOs\Customer\CouponDTO;
|
||||
use App\Models\Customer\Wallet\CouponModel;
|
||||
use App\Helpers\Customer\Wallet\CouponHelper;
|
||||
use App\Forms\Customer\Wallet\CouponForm;
|
||||
use App\Entities\Customer\Wallet\CouponEntity;
|
||||
use App\DTOs\Customer\Wallet\CouponDTO;
|
||||
|
||||
class CouponService extends CustomerService
|
||||
class CouponService extends WalletService
|
||||
{
|
||||
private $_form = null;
|
||||
private $_helper = null;
|
||||
@ -1,16 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
namespace App\Services\Customer\Wallet;
|
||||
|
||||
use RuntimeException;
|
||||
use App\Models\Customer\PointModel;
|
||||
use App\Helpers\Customer\PointHelper;
|
||||
use App\Forms\Customer\PointForm;
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\DTOs\Customer\PointDTO;
|
||||
use App\Models\Customer\Wallet\PointModel;
|
||||
use App\Helpers\Customer\Wallet\PointHelper;
|
||||
use App\Forms\Customer\Wallet\PointForm;
|
||||
use App\Entities\Customer\Wallet\PointEntity;
|
||||
use App\DTOs\Customer\Wallet\PointDTO;
|
||||
|
||||
class PointService extends CustomerService
|
||||
class PointService extends WalletService
|
||||
{
|
||||
private $_form = null;
|
||||
private $_helper = null;
|
||||
15
app/Services/Customer/Wallet/WalletService.php
Normal file
15
app/Services/Customer/Wallet/WalletService.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\Wallet;
|
||||
|
||||
use App\Models\CommonModel;
|
||||
use App\Services\Customer\CustomerService;
|
||||
|
||||
abstract class WalletService extends CustomerService
|
||||
{
|
||||
protected function __construct(CommonModel $model)
|
||||
{
|
||||
parent::__construct($model);
|
||||
$this->addClassPaths('Wallet');
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\DTOs\PaymentDTO;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
@ -13,7 +12,6 @@ use App\Forms\PaymentForm;
|
||||
use App\Helpers\PaymentHelper;
|
||||
use App\Models\PaymentModel;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use DateTime;
|
||||
use RuntimeException;
|
||||
|
||||
@ -79,8 +77,9 @@ class PaymentService extends CommonService
|
||||
"content",
|
||||
];
|
||||
$filters = ['user_uid', 'clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay'];
|
||||
$indexFilter = ['clientinfo_uid', 'serviceinfo_uid', 'status', 'billing'];
|
||||
$indexFilter = ['clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay'];
|
||||
$batchjobFilters = ['status'];
|
||||
$actionButtons = ['view' => ICONS['SEARCH'], 'paid' => '결제'];
|
||||
$batchjobButtons = ['batchjob' => '일괄결제', 'invoice' => '청구서발행'];
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
@ -129,6 +128,7 @@ class PaymentService extends CommonService
|
||||
$this->getFormService()->setFormFilters($filters);
|
||||
$this->getFormService()->setFormOptions($action, $filters, $formDatas);
|
||||
$this->getFormService()->setIndexFilters($indexFilter);
|
||||
$this->getFormService()->setActionButtons($actionButtons);
|
||||
$this->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||
$this->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||
}
|
||||
@ -147,7 +147,6 @@ class PaymentService extends CommonService
|
||||
}
|
||||
return $unPaids;
|
||||
}
|
||||
|
||||
//기본 기능부분
|
||||
protected function getEntity_process(mixed $entity): PaymentEntity
|
||||
{
|
||||
@ -242,34 +241,6 @@ class PaymentService extends CommonService
|
||||
}
|
||||
|
||||
//지불 관련
|
||||
private function paid_process(PaymentEntity $entity): PaymentEntity
|
||||
{
|
||||
//pay방식에따른 고객 정보 처리
|
||||
$formDatas = [
|
||||
'clientinfo_uid' => $entity->getClientInfoUID(),
|
||||
'bank' => '결제차감',
|
||||
'title' => $entity->getTitle(),
|
||||
'alias' => '결제차감',
|
||||
'issue_at' => date('Y-m-d'),
|
||||
'amount' => $entity->getAmount(),
|
||||
'status' => STATUS['WITHDRAWAL'],
|
||||
];
|
||||
switch ($entity->getPay()) {
|
||||
case PAYMENT['PAY']['ACCOUNT']:
|
||||
service('customer_accountservice')->create_process($formDatas);
|
||||
break;
|
||||
case PAYMENT['PAY']['COUPON']:
|
||||
service('customer_couponservice')->create_process($formDatas);
|
||||
break;
|
||||
case PAYMENT['PAY']['POINT']:
|
||||
service('customer_pointservice')->create_process($formDatas);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getPay()}는 지정되지 않은 지불방식입니다.");
|
||||
// break;
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function paid($uid): PaymentEntity
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
@ -286,7 +257,8 @@ class PaymentService extends CommonService
|
||||
$this->getFormService()->setFormFields($fields);
|
||||
$this->getFormService()->setFormRules('modify', $fields);
|
||||
$entity = parent::modify_process($entity, $formDatas);
|
||||
$entity = $this->paid_process($entity);
|
||||
//지불방식에 따른 고객 예치금,쿠폰,포인트 처리
|
||||
$entity = service('customer_clientservice')->updateWalletByPayment($entity);
|
||||
$db->transComplete();
|
||||
return $entity;
|
||||
} catch (DatabaseException $e) {
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
<th style="width: 120px">결제금액</th>
|
||||
<th style="width: 100px">청구방식</th>
|
||||
<th style="width: 100px">지불방법</th>
|
||||
<th style="width: 100px">결제처리</th>
|
||||
<th style="width: 170px">등록일</th>
|
||||
<th style="width: 100px">관리자</th>
|
||||
<th style="width: 100px">결제처리</th>
|
||||
</tr>
|
||||
<?php $cnt = count(value: $paymentCellDatas['entities']) ?>
|
||||
<?php foreach ($paymentCellDatas['entities'] as $entity): ?>
|
||||
@ -25,13 +25,9 @@
|
||||
<td class="text-end"><?= $paymentCellDatas['helper']->getFieldView('amount', $entity->getAmount(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('billing', $entity->getBilling(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('pay', $entity->getPay(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getListButton(
|
||||
'onetime_paid',
|
||||
$serverCellDatas['helper']->getFieldView('status', $entity->getStatus(), $paymentCellDatas),
|
||||
$paymentCellDatas
|
||||
) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('create_at', $entity->getCreatedAt(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getFieldView('user_uid', $entity->getUserUID(), $paymentCellDatas) ?></td>
|
||||
<td class="text-center"><?= $paymentCellDatas['helper']->getListButton('paid', "", $paymentCellDatas) ?></td>
|
||||
</tr>
|
||||
<?php $cnt-- ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user