<?php
namespace app\web\controller;

use think\facade\Session;
use app\web\BaseController;
use app\common\model\Comjobs as ComjobsModel;
use app\common\model\Worker as WorkerModel;
use app\common\model\Article as ArticleModel;

class Home extends BaseController
{
	public function home() 
	{
		$cmap = array();
		$cmap[] = ['createtime','<=',time()];
		$cmap[] = ['status','in','3,4'];
		$comjobslist = ComjobsModel::with(['worker'])->where($cmap)->order(['status'=>'asc','priority'=>'desc','updatetime'=>'desc','id'=>'desc'])->limit(9)->select();
		
		$wmap = array();
		$wmap[] = ['createtime','<=',time()];
		$wmap[] = ['status','in','4,5'];
		$workerlist = WorkerModel::where($wmap)->order(['priority'=>'desc','id'=>'desc'])->limit(9)->append(['wtype_text'])->select();

		$articleonelist = ArticleModel::with(["articleCate"])->where(["cateid"=>5])->limit(8)->select();
		return view('home', [
			'comjobslist'	=> $comjobslist,
			'workerlist'	=> $workerlist,
            'articleonelist'	=> $articleonelist
		]);
	}
	
}