MappingStartController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\controllers;
  3. use Yii;
  4. use yii\filters\AccessControl;
  5. use yii\web\Controller;
  6. use yii\web\Response;
  7. use yii\filters\VerbFilter;
  8. use app\models\LoginForm;
  9. use app\models\ContactForm;
  10. use app\models\MappingStartModel;
  11. use app\models\entity\Tasktypes;
  12. use app\models\entity\Tasks;
  13. use app\models\entity\Tasknotes;
  14. use app\models\entity\Accounts;
  15. use app\models\entity\AccountsJobtypes;
  16. use app\models\entity\Sections;
  17. use app\models\entity\Companies;
  18. use app\models\entity\Jobtypes;
  19. use app\models\entity\ProjectsLocotech;
  20. use app\models\entity\Projecttypes;
  21. class MappingstartController extends MainController
  22. {
  23. public function beforeAction($action)
  24. {
  25. parent::beforeAction($action);
  26. //$date = strtotime('-3 weeks');
  27. //$this->threeWeeksAgo = date('Y-m-d', $date);
  28. $key = Yii::$app->request->headers->get('uuid-key');
  29. $this->checkAuth($key);
  30. //$headerContent = Yii::$app->request->headers->get('content-type');
  31. //\Yii::$app->response->format = \yii\web\Response::FORMAT_XML;
  32. //if ( 'application/json' == $headerContent ) {
  33. // \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  34. //}
  35. return true;
  36. }
  37. public function actionExecute($user_uuid = null) {
  38. if ( null == $user_uuid ) {
  39. return false;
  40. }
  41. $accountsEntity = Accounts::find()->where(['uuid' => $user_uuid])->one();
  42. if( null == $accountsEntity) {
  43. return false;
  44. }
  45. Yii::$app->db->createCommand('update `accounts_internal` set `last_seen_mobile` = NOW() where id in ('.$accountsEntity->id.')')->execute();
  46. $mappingStartModel = new MappingStartModel();
  47. $mappingStartModel->actionGetworks($accountsEntity->company);
  48. return true;
  49. }
  50. }