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://linggong.jinjianghc.com/attachment/images/20221017/69ecf042019c1aa21d33e0d47cc9c535.png"],
  15. ['title'=>'按时','tilurl'=>url('/jobs/index').'?type=2','tilpic'=>"https://linggong.jinjianghc.com/attachment/images/20221017/a0aad83651786e8f4b58b8b58d294c5a.png"],
  16. ['title'=>'按件','tilurl'=>url('/jobs/index').'?type=3','tilpic'=>"https://linggong.jinjianghc.com/attachment/images/20221017/a0a399db96c6e0d0a6d7a3ced3491756.png"],
  17. ['title'=>'按项目','tilurl'=>url('/jobs/index').'?type=4','tilpic'=>"https://linggong.jinjianghc.com/attachment/images/20221017/240c1f65071343575bf06ccbb060ef40.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. }