GroupController.php 788 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace wechat\controllers;
  3. use wechat\base\CommonController;
  4. class GroupController extends CommonController{
  5. public function actionHome()
  6. {
  7. return $this->render('home');
  8. }
  9. public function actionDetails()
  10. {
  11. return $this->render('details');
  12. }
  13. public function actionAa()
  14. {
  15. $p = \common\model\CategoryCity::find()->select(['id','city_name'])->andWhere(['del'=>1])->andWhere(['pid'=>0])->asArray()->all();
  16. $p = array_column($p,'id','city_name');
  17. $son = \common\model\CategoryCity::find()->select(['id','city_name'])->andWhere(['del'=>1])->andWhere(['pid'=>$p])->asArray()->all();
  18. $sonArr = [];
  19. foreach ($son as $key => $value) {
  20. $sonArr[$value['pid']][] = $value;
  21. }
  22. p($sonArr);
  23. }
  24. }