123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- class ImportController
- {
-
- private $returnJson = array('type' => 'import');
-
- public function __construct()
- {
-
- $server = new GuestModule;
- if (!$server->checkLogin()) {
- $this->returnJson['statusCode'] = '120005';
- exitOutput($this->returnJson);
- }
- }
-
- public function importEoapi()
- {
- $json = quickInput('data');
- $data = json_decode($json, TRUE);
- if (!$data) {
- $this->returnJson['statusCode'] = '310004';
- exitOutput($this->returnJson);
- }
- $server = new ImportModule;
- $result = $server->eoapiImport($data);
- if ($result) {
- $this->returnJson['statusCode'] = '000000';
- } else {
- $this->returnJson['statusCode'] = '310005';
- }
- exitOutput($this->returnJson);
- }
-
- public function importDHC()
- {
- $json = quickInput('data');
- $data = json_decode($json, TRUE);
- if (!$data) {
- $this->returnJson['statusCode'] = '310004';
- exitOutput($this->returnJson);
- }
- $server = new ImportModule;
- $result = $server->importDHC($data);
- if ($result) {
- $this->returnJson['statusCode'] = '000000';
- } else {
- $this->returnJson['statusCode'] = '310001';
- }
- exitOutput($this->returnJson);
- }
-
- public function importPostman()
- {
- $json = quickInput('data');
- $data = json_decode($json, TRUE);
- $version = securelyInput('version');
- if (!$data) {
- $this->returnJson['statusCode'] = '310004';
- exitOutput($this->returnJson);
- } elseif ($version != 1 and $version != 2) {
- $this->returnJson['statusCode'] = '310002';
- exitOutput($this->returnJson);
- }
- $server = new ImportModule;
- if ($version == 1) {
- $result = $server->importPostmanV1($data);
- } else {
- $result = $server->importPostmanV2($data);
- }
- if ($result) {
- $this->returnJson['statusCode'] = '000000';
- } else {
- $this->returnJson['statusCode'] = '310003';
- }
- exitOutput($this->returnJson);
- }
-
- public function importSwagger()
- {
- $data = quickInput('data');
- $json = json_decode($data, TRUE);
- if (empty($json)) {
- $this->returnJson['statusCode'] = '310004';
- exitOutput($this->returnJson);
- }
- $server = new ImportModule;
- $result = $server->importSwagger($data);
- if ($result) {
- $this->returnJson['statusCode'] = '000000';
- } else {
- $this->returnJson['statusCode'] = '310001';
- }
- exitOutput($this->returnJson);
- }
-
- public function importRAP()
- {
- $json = quickInput('data');
- $data = json_decode($json, TRUE);
-
- if (empty($data['modelJSON'])) {
- $this->returnJson['statusCode'] = '310001';
- exitOutput($this->returnJson);
- }
- $model_json = json_decode(str_replace("\'", "'", $data['modelJSON']), TRUE);
-
- if (empty($model_json)) {
- $this->returnJson['statusCode'] = '310003';
- exitOutput($this->returnJson);
- }
- $server = new ImportModule();
- $result = $server->importRAP($model_json);
-
- if ($result) {
- $this->returnJson['statusCode'] = '000000';
- } else {
- $this->returnJson['statusCode'] = '310000';
- }
- exitOutput($this->returnJson);
- }
- }
- ?>
|