trafficmonitor init...1
This commit is contained in:
parent
2eba508f74
commit
a026bdff6f
@ -127,6 +127,48 @@ abstract class AdminController extends CommonController
|
|||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final public function batchjob(): string|RedirectResponse
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$this->action_init_process($action);
|
||||||
|
$selectedFields = [];
|
||||||
|
$formDatas = [];
|
||||||
|
foreach ($this->service->getFormService->getBatchjobFilters() as $field) {
|
||||||
|
$value = $this->request->getPost($field);
|
||||||
|
if ($value) {
|
||||||
|
$selectedFields[] = $field;
|
||||||
|
$formDatas[$field] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!count($selectedFields)) {
|
||||||
|
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
|
||||||
|
}
|
||||||
|
//변경할 UIDS 정의
|
||||||
|
$uids = $this->request->getPost('batchjob_uids[]');
|
||||||
|
if (!is_array($uids) || !count($uids)) {
|
||||||
|
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||||
|
}
|
||||||
|
$this->service->getFormService()->setFormFields($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $selectedFields);
|
||||||
|
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||||
|
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||||
|
$entities = [];
|
||||||
|
$errors = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
try {
|
||||||
|
$entities[] = $this->modify_process($uid);
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
$errors[] = "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errors[] = "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->action_modal_process("{$this->getTitle()}에서 " . count($entities) . "개, 총:" . count($uids) . " 수정이 완료되었습니다.");
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
protected function delete_process($uid): CommonEntity
|
protected function delete_process($uid): CommonEntity
|
||||||
{
|
{
|
||||||
return $this->service->delete($uid);
|
return $this->service->delete($uid);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class TrafficController extends AdminController
|
|||||||
}
|
}
|
||||||
protected function action_init_process(string $action): void
|
protected function action_init_process(string $action): void
|
||||||
{
|
{
|
||||||
$fields = ['client', 'switch', 'ip', 'interface', 'status'];
|
$fields = ['client', 'server', 'server_ip',, 'switch', 'ip', 'interface', 'status'];
|
||||||
$filters = ['status'];
|
$filters = ['status'];
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'create':
|
case 'create':
|
||||||
|
|||||||
@ -6,6 +6,8 @@ class TrafficDTO extends CommonDTO
|
|||||||
{
|
{
|
||||||
public ?int $uid = null;
|
public ?int $uid = null;
|
||||||
public ?string $client = null;
|
public ?string $client = null;
|
||||||
|
public ?string $server = null;
|
||||||
|
public ?string $server_ip = null;
|
||||||
public ?string $switch = null;
|
public ?string $switch = null;
|
||||||
public ?string $ip = null;
|
public ?string $ip = null;
|
||||||
public ?string $interface = null;
|
public ?string $interface = null;
|
||||||
@ -26,6 +28,8 @@ class TrafficDTO extends CommonDTO
|
|||||||
return [
|
return [
|
||||||
'uid' => $this->uid,
|
'uid' => $this->uid,
|
||||||
'client' => $this->client,
|
'client' => $this->client,
|
||||||
|
'server' => $this->server,
|
||||||
|
'server_ip' => $this->server_ip,
|
||||||
'switch' => $this->switch,
|
'switch' => $this->switch,
|
||||||
'ip' => $this->ip,
|
'ip' => $this->ip,
|
||||||
'interface' => $this->interface,
|
'interface' => $this->interface,
|
||||||
|
|||||||
@ -18,10 +18,14 @@ class TrafficForm extends CommonForm
|
|||||||
case "status":
|
case "status":
|
||||||
$rule = "required|trim|string";
|
$rule = "required|trim|string";
|
||||||
break;
|
break;
|
||||||
|
case "server":
|
||||||
case "switch":
|
case "switch":
|
||||||
$rule = "required|trim|string";
|
$rule = "required|trim|string";
|
||||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
||||||
break;
|
break;
|
||||||
|
case "server_ip":
|
||||||
|
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||||
|
break;
|
||||||
case "ip":
|
case "ip":
|
||||||
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -3,8 +3,10 @@ return [
|
|||||||
'title' => "트래픽정보",
|
'title' => "트래픽정보",
|
||||||
'label' => [
|
'label' => [
|
||||||
'client' => "고객명",
|
'client' => "고객명",
|
||||||
'switch' => "스위치",
|
'server' => "서버번호",
|
||||||
'ip' => "IP",
|
'server_ip' => "서버IP",
|
||||||
|
'switch' => "스위치번호",
|
||||||
|
'ip' => "스위치IP",
|
||||||
'interface' => "인텍스",
|
'interface' => "인텍스",
|
||||||
'status' => "상태",
|
'status' => "상태",
|
||||||
'updated_at' => "수정일",
|
'updated_at' => "수정일",
|
||||||
|
|||||||
@ -16,6 +16,8 @@ class TrafficModel extends CommonModel
|
|||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"client",
|
"client",
|
||||||
|
"server",
|
||||||
|
"server_ip",
|
||||||
"switch",
|
"switch",
|
||||||
"ip",
|
"ip",
|
||||||
"interface",
|
"interface",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user