1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- defined('YII_DEBUG') or define('YII_DEBUG', true);
- defined('YII_ENV') or define('YII_ENV', 'dev');
- require 'api/vendor/autoload.php';
- require 'api/vendor/yiisoft/yii2/Yii.php';
- $config = require 'api/config/web.php';
- (new yii\web\Application($config));
- $res = new app\models\LocomotiveModel();
- $locomotiveModel = new app\models\LocomotiveModel();
- $locomotiveModel->project_id = '4627';
- $time = $locomotiveModel->milliseconds();
- $time = explode(' ', microtime())[1];
- //$time = microtime();
- //echo $time."<br>";
- //$params['number'] = '029А';
- //$params['subnumber'] = '11360534';
- //$params['diagnosticMap'] = 'e3fc0d5d-1ee2-11ea-80d6-005056011052';
- $params['number'] = '029А';
- $params['subnumber'] = '11360534';
- $params['diagnosticMap'] = '26f77970-1fee-11ea-80d6-005056011052';
- $params['date'] = $time;//'1562877877';$locomotiveModel->milliseconds();
- $params['worker'] = 'f4a9cbc2-e472-11e2-aaad-ac162db0b20c';//f4a9cbc2-e472-11e2-aaad-ac162db0b20c - гориченко '7b8ebba7-c9a4-11e7-80cd-0050560110fa';//'bbd19a7f-bf7d-11e7-80cd-0050560110fa';
- $params['source'] = 'c92e78e9-e104-11e7-80cc-005056011052';
- $params['description'] = 'TWX and SMoPP integration testing';
- $params['isSCWorksNeeded'] = '';
- $params['plant'] = '';
- $params['sectionId'] = '56edc8c8-f04a-11e1-8e8b-001517e6ca10';
- //$result = $locomotiveModel->addRemark($params);
- //$params = array();
- //$params['section_id'] = 'ac8959ef-f049-11e1-8e8b-001517e6ca10';
- //$params['sectionId'] = 'ac8959f0-f049-11e1-8e8b-001517e6ca10';
- //echo '123';
- //var_dump( $result);
- TWXrequest($params);
- function TWXrequest($params)
- {
- //app key 6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1
- // $url = "http://62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_remarks";
- //$url = "http://62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/add_remark";
- $url = "http://qaplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/add_remark";
- // $url = "http://62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_sources_of_comments";
- $jsonEncoded = json_encode($params);
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 33cd23bb-3b03-4638-afef-7104a13e9211", "Accept:application/json"));
- // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
- curl_setopt($curl, CURLOPT_TIMEOUT, 60);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- // var_dump($jsonEncoded);
- $result = curl_exec($curl);
- $uuid = json_decode($result)->RemarkId;
- echo "uuid ".$uuid;
- curl_close($curl);
- var_dump($result);
- // var_dump($result);
- }
- ?>
- ?>
|