ActionBehaviorService.php 934 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace services\common;
  3. use common\components\Service;
  4. use common\enums\StatusEnum;
  5. use common\models\common\ActionBehavior;
  6. /**
  7. *
  8. * Class ActionBehaviorService
  9. * @package services\common
  10. * @author qimall
  11. */
  12. class ActionBehaviorService extends Service
  13. {
  14. /**
  15. * 重组数据列表
  16. *
  17. * @return array
  18. */
  19. public function getAllData()
  20. {
  21. $list = $this->findAll();
  22. $data = [];
  23. foreach ($list as $item) {
  24. $key = [];
  25. $key[] = $item['app_id'];
  26. $key[] = $item['url'];
  27. $key[] = $item['action'];
  28. $data[implode('|', $key)] = $item;
  29. }
  30. return $data;
  31. }
  32. /**
  33. * @return array|\yii\db\ActiveRecord[]
  34. */
  35. public function findAll()
  36. {
  37. return ActionBehavior::find()
  38. ->andWhere(['status' => StatusEnum::ENABLED])
  39. ->asArray()
  40. ->all();
  41. }
  42. }