123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <?php
- /*
- для получения нужно объявить namespace
- use app\models\Api;
- вызов:
- например Api::getsldlist()
- Доступные статические методы
- параметры:
- $params - array входные параметры см. спецификацию [не обязательный]
- return - результат выполнения метода TWX
- getsectionremarks($params = [])
-
- getsectionlist($params = [])
-
- addcomplitedwork($params = [])
- addremark($params = [])
-
- getsourcesofcoments()
-
- getrepairsites()
-
- getsldlist()
-
- getworkers($params = [])
-
- getemployeestatus($params = [])
-
- getworkertimetable($params = [])
-
- getpositionlist()
- */
- namespace app\models;
- use Yii;
- use yii\base\Model;
- use app\models\entity\Accounts;
- use app\models\entity\Sections;
- use app\models\LocomotiveModel;
- use app\models\EmployeesModel;
- use app\models\UserModel;
- use app\models\TasksModel;
- use app\models\AccountModel;
- use app\models\ProjectsModel;
- use app\models\ServiceModel;
- class Api extends MainModel
- {
- public $errors = [];
- public static function getsectionremarks($params = [])
- {
- if ( [] == $params ) {
- $params['number'] = '0469В';
- $params['subnumber'] = '11385168';
- }
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathListCurrentComments'];
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSectionRemarks($params,false);
- return json_decode($result);
- }
-
- public static function getsectionlist($params = [])
- {
-
- if ( [] == $params ) {
- $params['place'] = 'a84d0a15-08ec-11e5-829d-00155d6cab05';
- //$params['place'] = '5fb47130-580c-11e7-aefa-00155d6cab05';
- $params['date'] = '1562077752';//$this->milliseconds();
- }
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSectionList($params);
- return $result;
-
- }
-
- public static function addcompletedwork($params = [])
- {
- if ( [] == $params ) {
- $params['number'] = '345'; // номер секции
- $params['subnumber'] = '123';
- $params['diagnosticCard'] = '123e4567-e89b-12d3-a456-426655440000';
- $params['inspectionId'] = '910'; // ид проекта
- $params['isSCWorksNeeded'] = 'true';
- $params['startTime'] = $this->milliseconds(); //начало выполнения первого таска
- $params['endTime'] = $this->milliseconds()+2000; // завершение последнего
- $params['worker'] = '2';
- $params['engineer'] = '27';
- $params['otcEmployee'] = '3';
- }
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->addCompletedWork($params);
- return $result;
- //$result = $this->curlRequest($url,$params);
- }
-
-
- public static function addremark($params = [])
- {
- $locomotiveModel = new LocomotiveModel();
- if ( [] == $params ) {
- $locomotiveModel->project_id = '1332';
- $params['number'] = '234234';
- $params['subnumber'] = '35468795';
- $params['diagnosticCard'] = '004d9e52-9848-11e9-80d5-005056011052';//'123e4567-e89b-12d3-a456-426655440000';
- $params['date'] = $locomotiveModel->milliseconds();
- $params['worker'] = '023169da-e473-11e2-aaad-ac162db0b20c'; //Котов
- $params['source'] = '';
- $params['description'] = '';
- $params['isSCWorksNeeded'] = '';
- }
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathCommentSection'];
- $result = $locomotiveModel->addRemark($params);
- return $result;
-
- }
-
- public static function getsourcesofcoments()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSourcesOfComents();
- return json_decode($result);
- }
-
- public static function getrepairsites()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getRepairSites();
- return json_decode($result);
- }
-
- public static function getsldlist()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSldList();
- return json_decode($result);
- }
-
- public static function getworkers($params = [])
- {
- if ( [] == $params ) {
- $params['sld'] = '95d764c1-e7ee-11e4-829d-00155d6cab05';
- $params['placeOfRepair'] = 'a84d0a15-08ec-11e5-829d-00155d6cab05'; // из списка get_sld_list
- }
-
- $employeesModel = new EmployeesModel();
- $result = $employeesModel->getWorkers($params);
- return $result;
- }
-
-
- public static function getemployeestatus($params = [])
- {
- if ( [] == $params ) {
- $params['worker'] = '25b3793b-ce67-11e6-aab3-00155d6cab04';
- $params['date'] = '1562072228';//$this->milliseconds();
- }
-
- $employeesModel = new EmployeesModel();
- $result = $employeesModel->getEmployeeStatus($params);
-
- return $result;
-
- }
-
-
- public static function getworkertimetable($params = [])
- {
- if ( [] == $params ) {
- $params['name'] = 'Ивлева Светлана Николаевна';
- $params['date'] = $this->milliseconds();
- }
- $employeesModel = new EmployeesModel();
- $result = $employeesModel->getWorkerTimetable($params);
- return $result;
-
- }
-
- public static function getpositionlist()
- {
- $employeesModel = new EmployeesModel();
- $result = $employeesModel->getPositionList($params);
- return $result;
- }
-
- }
- ?>
|