12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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 = '1151';
- $time = $locomotiveModel->milliseconds();
- $time = explode(' ', microtime())[1];
- //$time = microtime();
- //echo $time."<br>";
- //$params['number'] = '0130А';
- //$params['subnumber'] = '11374006';
- //$params['diagnosticMap'] = '25c46291-9eb1-11e8-80cf-005056011052';
- //$params['date'] = $time;//'1562877877';$locomotiveModel->milliseconds();
- //$params['worker'] = 'bbd19a7f-bf7d-11e7-80cd-0050560110fa';
- //$params['source'] = 'c92e78e9-e104-11e7-80cc-005056011052';
- //$params['description'] = 'new21';
- //$params['isSCWorksNeeded'] = '';
- //$params['plant'] = '';
- //$params['sectionId'] = 'ac8959ee-f049-11e1-8e8b-001517e6ca10';
- //$result = $locomotiveModel->addRemark($params);
- //$params = array();
- //$params['placeOfRepair'] = '95d764c1-e7ee-11e4-829d-00155d6cab05'; //Братск
- //$params['placeOfRepair'] = '5f2e4eca-4b02-11e1-b72e-001517e6ca10'; //Москва
- //$params['sectionId'] = 'ac8959f0-f049-11e1-8e8b-001517e6ca10';
- //echo '123';
- //var_dump( $result);
- $params =array();
- $params['sld'] = '95d7646d-e7ee-11e4-829d-00155d6cab05';
- $start = $_REQUEST['start'];
- $end = $_REQUEST['end'];
- if (!$start)
- $start = '1';
- if (!$end)
- $end = '100';
- $params['start'] = $start;
- $params['end'] = $end;
- //{"start":1,"end":50,"SLD":"95d7646d-e7ee-11e4-829d-00155d6cab05"}
- 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/get_workers";
- $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, 600);
- 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);
- }
|