Index.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\common\model\SlideWoman as SlideModel;
  4. use app\common\model\Comjobs as ComjobsModel;
  5. use app\mobile\UserBaseController;
  6. class Index extends UserBaseController
  7. {
  8. public function index()
  9. {
  10. //轮播图
  11. $slide = SlideModel::where('pagetab', '=', 'woman')->order(['priority' => 'desc', 'id' => 'desc'])->limit(10)->select();
  12. //导航
  13. $navigation = [
  14. ['title'=>'按月','tilurl'=>url('/jobs/index').'?type=1','tilpic'=>"https://mw_odd_job.jucai.gov.cn/attachment/images/20230922/3ca26d61dddf8bfb745ad624b97dfac6.png"],
  15. ['title'=>'按时','tilurl'=>url('/jobs/index').'?type=2','tilpic'=>"https://mw_odd_job.jucai.gov.cn/attachment/images/20230922/0807346add3879c8ad38905c062ee4e2.png"],
  16. ['title'=>'按件','tilurl'=>url('/jobs/index').'?type=3','tilpic'=>"https://mw_odd_job.jucai.gov.cn/attachment/images/20230922/21840b966c01ad30d04d66cad991c899.png"],
  17. ['title'=>'按项目','tilurl'=>url('/jobs/index').'?type=4','tilpic'=>"https://mw_odd_job.jucai.gov.cn/attachment/images/20230922/531d76d74c996d81203ccd927cc6bd2f.png"],
  18. ];
  19. //列表
  20. $map = [];
  21. $map[] = ['createtime', '<=', time()];
  22. $map[] = ['priority', '>', 0];
  23. $map[] = ['status', 'in', '3,4'];
  24. $list = ComjobsModel::with(['worker'])->where($map)->order(['status' => 'asc', 'priority' => 'desc', 'updatetime' => 'desc', 'id' => 'desc'])->limit(10)->select();
  25. foreach ($list as $v) {
  26. $tags = [];
  27. foreach ($v['tags'] as $tag) {
  28. $tags = array_merge($tags,explode(',',$tag));
  29. }
  30. $v['tags'] = $tags;
  31. }
  32. return view('index/index', [
  33. 'slide' => $slide,
  34. 'navigation' => json_encode($navigation),
  35. 'list' => $list,
  36. ]
  37. );
  38. }
  39. }