IndexController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\controller;
  12. use app\portal\model\UserinfoModel;
  13. use cmf\controller\HomeBaseController;
  14. class IndexController extends HomeBaseController {
  15. public function index() {
  16. $this->getList();
  17. return $this->fetch(':index');
  18. }
  19. private function getList() {
  20. $m_u = new UserinfoModel();
  21. $list = $m_u->getlist();
  22. $list = $list->toArray();
  23. foreach ($list as $key => $value) {
  24. $userid = $value['id'];
  25. $worktype = $m_u->getworktype($userid);
  26. if (empty($worktype)) {
  27. $worktype = [['workertypedisstr' => '普工']];
  28. }
  29. $list[$key]['worktype'] = $worktype;
  30. }
  31. // var_dump($list);
  32. $this->assign('list', $list);
  33. }
  34. }