vhost init...4
This commit is contained in:
parent
47f1a7c648
commit
f9bb28c62c
@ -27,7 +27,7 @@ class ProductCell extends BaseCell
|
||||
foreach ($this->getProductDeviceModel()->getEntitys(
|
||||
['product_uid' => $cellDatas['entity']->getPrimaryKey()]
|
||||
) as $productDevieceEntity) {
|
||||
$cellDatas['defaults'][$productDevieceEntity->device_uid] = $productDevieceEntity;
|
||||
$cellDatas['defaults'][] = $productDevieceEntity->device_uid;
|
||||
}
|
||||
}
|
||||
$cellDatas['device'] = [];
|
||||
|
||||
@ -92,7 +92,7 @@ class ProductController extends AdminController
|
||||
}
|
||||
|
||||
//가상서버
|
||||
protected function virtual_process(ProductEntity $entity): array
|
||||
protected function virtual_process(ProductEntity $entity)
|
||||
{
|
||||
//가상서버정보
|
||||
$protudctDatas = array(
|
||||
@ -129,11 +129,10 @@ class ProductController extends AdminController
|
||||
$protudctDatas['name'] = implode(" ", $titles);
|
||||
$protudctDatas['content'] = implode("\n", $titles);
|
||||
$product = $this->getModel()->create($protudctDatas);
|
||||
return array();
|
||||
//return $this->add_procedure($product, 1, $this->_viewDatas['fieldDatas']['paymentday']);
|
||||
}
|
||||
//주문처리
|
||||
protected function device_process(ProductEntity $entity): array
|
||||
protected function device_process(ProductEntity $entity)
|
||||
{
|
||||
switch ($this->_viewDatas['fieldDatas']['category']) {
|
||||
case 'virtual':
|
||||
@ -141,23 +140,23 @@ class ProductController extends AdminController
|
||||
break;
|
||||
case 'beremetal':
|
||||
//상품관련 tw_product_device 기존정보 삭제처리
|
||||
foreach ($this->getProductDeviceModel()->getEntitys(
|
||||
['product_uid' => $entity->getPrimaryKey()]
|
||||
) as $productDeviceEntity) {
|
||||
$this->getProductDeviceModel()->delete($productDeviceEntity);
|
||||
$productDeviceEntitys = $this->getProductDeviceModel()->getEntitys(['product_uid' => $entity->getPrimaryKey()]);
|
||||
foreach ($productDeviceEntitys as $productDeviceEntity) {
|
||||
$this->getProductDeviceModel()->delete($productDeviceEntity->getPrimaryKey());
|
||||
}
|
||||
//상품관련 tw_product_device 기존정보 생성처리
|
||||
$devices = [];
|
||||
foreach (['server', 'cpu', 'memory', 'disk', 'nic', 'publicip', 'os'] as $field) {
|
||||
$formDatas = ['product_uid' => $entity->getPrimaryKey()];
|
||||
$formDatas['device_uid'] = $this->request->getPost($field);
|
||||
$formDatas['device_cnt'] = $this->request->getPost($field . "_cnt") ?: 1;
|
||||
if ($formDatas['product_uid'] && $formDatas['device_uid']) {
|
||||
$devices[$field] = $this->getProductDeviceModel()->create($formDatas);
|
||||
$device_uids = $this->request->getPost($field) ?: [];
|
||||
// dd($device_uids);
|
||||
foreach ($device_uids as $device_uid) {
|
||||
$formDatas = ['product_uid' => $entity->getPrimaryKey()];
|
||||
$formDatas['device_uid'] = $device_uid;
|
||||
$formDatas['device_cnt'] = $this->request->getPost($field . "_cnt") ?: 1;
|
||||
if ($formDatas['product_uid'] && $formDatas['device_uid']) {
|
||||
$this->getProductDeviceModel()->create($formDatas);
|
||||
}
|
||||
}
|
||||
}
|
||||
// dd($devices);
|
||||
return $devices;
|
||||
break;
|
||||
default:
|
||||
throw new \Exception($this->_viewDatas['fieldDatas']['category'] . "는 알수없는 상품 구분입니다. 다시 확인 부탁드립니다.");
|
||||
@ -170,7 +169,7 @@ class ProductController extends AdminController
|
||||
{
|
||||
$this->_viewDatas['fieldDatas']['price'] = $this->calculate_price();
|
||||
$entity = parent::insert_process();
|
||||
$entity->setDevices($this->device_process($entity));
|
||||
$this->device_process($entity);
|
||||
return $entity;
|
||||
}
|
||||
//Update관련
|
||||
@ -178,7 +177,7 @@ class ProductController extends AdminController
|
||||
{
|
||||
$this->_viewDatas['fieldDatas']['price'] = $this->calculate_price();
|
||||
$entity = parent::update_process($entity);
|
||||
$entity->setDevices($this->device_process($entity));
|
||||
$this->device_process($entity);
|
||||
// dd($entity);
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -42,12 +42,4 @@ class ProductEntity extends BaseEntity
|
||||
}
|
||||
return $price;
|
||||
}
|
||||
public function getDevices(): array
|
||||
{
|
||||
return $this->_devices;
|
||||
}
|
||||
public function setDevices(array $devices)
|
||||
{
|
||||
$this->_devices = $devices;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<?php foreach ($cellDatas['device']['categorys'] as $category) : ?>
|
||||
<td>
|
||||
<?= form_dropdown(
|
||||
$category,
|
||||
$category . '[]',
|
||||
$cellDatas['device']['options'][$category],
|
||||
$cellDatas['defaults'],
|
||||
[
|
||||
|
||||
Loading…
Reference in New Issue
Block a user