GroupController.php 874 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/19
  6. * Time: 下午2:52
  7. */
  8. namespace mobile\controllers;
  9. use mobile\base\CommonController;
  10. class GroupController extends CommonController{
  11. public function actionHome()
  12. {
  13. return $this->render('home');
  14. }
  15. public function actionDetails()
  16. {
  17. return $this->render('details');
  18. }
  19. public function actionAa()
  20. {
  21. $p = \common\model\CategoryCity::find()->select(['id','city_name'])->andWhere(['del'=>1])->andWhere(['pid'=>0])->asArray()->all();
  22. $p = array_column($p,'id','city_name');
  23. $son = \common\model\CategoryCity::find()->select(['id','city_name'])->andWhere(['del'=>1])->andWhere(['pid'=>$p])->asArray()->all();
  24. $sonArr = [];
  25. foreach ($son as $key => $value) {
  26. $sonArr[$value['pid']][] = $value;
  27. }
  28. p($sonArr);
  29. }
  30. }