api_getsources.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. //string(3287) "{"array":[{"Kod":"000000028","ID":"9d028e6b-ce35-11e7-80cc-005056011052","Name":"Сбой АСУТ-Т"},{"Kod":"000000030","ID":"c92e78e9-e104-11e7-80cc-005056011052","Name":"Приемщик ОТК (во время СО)"},{"Kod":"000000029","ID":"c92e78ea-e104-11e7-80cc-005056011052","Name":"Приемщик ОТК (после СО)"},{"Kod":"000000031","ID":"f10965ad-053c-11e8-80cf-005056011052","Name":"ТО-2Д"},{"Kod":"000000032","ID":"218de29f-20a5-11e8-80cf-005056011052","Name":"Предотказное состояние"},{"Kod":"000000024","ID":"bf0bff60-b47e-4f73-814f-411d7aa69bd8","Name":"Умный локомотив"},{"Kod":"000000014","ID":"98093523-c6a0-48f9-88a5-a7ea1867b319","Name":"Техник по замерам"},{"Kod":"000000013","ID":"f767d64e-60b6-4ded-8b49-92fc48349a06","Name":"Приемка перед СО"},{"Kod":"000000021","ID":"755ebc96-d393-49f0-8f26-75377644ca92","Name":"МСУ- ТП"},{"Kod":"000000025","ID":"9fc09716-7b2e-4f38-90c3-475192df9e7a","Name":"Осмотр мастером (перед СО)"},{"Kod":"000000022","ID":"464cf073-a904-4210-9145-683a669a94fd","Name":"МСУД"},{"Kod":"000000001","ID":"25885987-28db-440a-9427-005414cf0a88","Name":"Осмотр мастером (во время СО)"},{"Kod":"000000026","ID":"cf892c1a-5def-4511-94ae-ce366d126c4b","Name":"Оздоровление"},{"Kod":"000000017","ID":"6f713b5a-2ccd-4cc5-97f1-74369a8c483e","Name":"ЕСМТ (НРЭ)"},{"Kod":"000000015","ID":"dabb7857-5c6c-4c21-981c-8e30cf26cfc9","Name":"Осмотр мастером КИП"},{"Kod":"000000007","ID":"6c1dd7c7-3a44-4661-98a7-8d73b93170b6","Name":"Хим. лаборатория"},{"Kod":"000000005","ID":"33e85dc1-5585-4be7-9b1b-b552873b1473","Name":"Параметры локомотива"},{"Kod":"000000009","ID":"3ffcf774-063b-4425-9ce8-b6f0efb600ea","Name":"Приёмщик ОТК (перед СО)"},{"Kod":"000000033","ID":"5ff5344a-3928-11e7-a0f4-00155d6cab05","Name":"Группа приемки (во время СО)"},{"Kod":"000000002","ID":"10fe04ea-4f63-490c-a251-0599806f1959","Name":"ЕСМТ (предотказное состояние)"},{"Kod":"000000010","ID":"53366182-1a12-4995-a439-cc8b34427a2c","Name":"Данные бортовых систем"},{"Kod":"000000011","ID":"9811580a-2212-471e-a7f9-d4b1a1086b12","Name":"Приемщик РЖД"},{"Kod":"000000012","ID":"1af88571-4bac-4a40-a7ff-0eb32ba0e90a","Name":"Касант/АСРБ"},{"Kod":"000000027","ID":"e88e74e3-0a81-48bc-a93c-08a216762ca7","Name":"Инженер по рекламациям"},{"Kod":"000000023","ID":"89d1c388-3e22-4db4-aa76-4e2b7462b943","Name":"МПСУ"},{"Kod":"000000018","ID":"a585cf12-ceba-4c65-ac5e-6a76915216e0","Name":"МСУ"},{"Kod":"000000019","ID":"594b9554-39f1-4abe-ac90-2c700c2c644c","Name":"МСУ- Т"},{"Kod":"000000020","ID":"6f9d0c5f-a1c2-4eb2-ad75-3cc37e3be755","Name":"МСУ- ТЭ"},{"Kod":"000000008","ID":"cc4d2e59-c1a1-46fb-af74-4aa1d46e904d","Name":"АСТД"},{"Kod":"000000003","ID":"d1738391-a82c-47f3-b21e-0c5af3979a3f","Name":"Мероприятия"},{"Kod":"000000006","ID":"a776b2e8-0f35-441a-b507-b1ad71c87749","Name":"ТУ-152"},{"Kod":"000000004","ID":"0fe0bd32-56ad-4bfe-ba30-3348b72c33f8","Name":"Комплектность локомотива"}]}"
  3. defined('YII_DEBUG') or define('YII_DEBUG', true);
  4. defined('YII_ENV') or define('YII_ENV', 'dev');
  5. require 'api/vendor/autoload.php';
  6. require 'api/vendor/yiisoft/yii2/Yii.php';
  7. $config = require 'api/config/web.php';
  8. (new yii\web\Application($config));
  9. $res = new app\models\LocomotiveModel();
  10. $locomotiveModel = new app\models\LocomotiveModel();
  11. $locomotiveModel->project_id = '1151';
  12. $time = $locomotiveModel->milliseconds();
  13. $time = explode(' ', microtime())[1];
  14. TWXrequest($params);
  15. function TWXrequest($params)
  16. {
  17. // $url = "http://62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_sources_of_comments";
  18. $url = "http://qaplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/get_sources_of_comments";
  19. $jsonEncoded = json_encode($params);
  20. $curl = curl_init();
  21. curl_setopt($curl, CURLOPT_URL, $url);
  22. //curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1", "Accept:application/json"));
  23. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 33cd23bb-3b03-4638-afef-7104a13e9211", "Accept:application/json"));
  24. curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  25. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  26. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  27. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  28. curl_setopt($curl, CURLOPT_POST, 1);
  29. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  30. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  31. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  32. // var_dump($jsonEncoded);
  33. $result = curl_exec($curl);
  34. // $uuid = json_decode($result)->RemarkId;
  35. // echo "uuid ".$uuid;
  36. // curl_close($curl);
  37. var_dump($result);
  38. // var_dump($result);
  39. }
  40. ?>