<?php

namespace app\admin\controller;

use app\admin\AdminBaseController;
use app\common\model\jucai\RecruitAppointInfoModel;
use app\common\model\jucai\RecruitModel;

class Recruit extends AdminBaseController
{

    /**
     * 列表
     */
    public function index()
    {
        return view();
    }

    public function listRecruit()
    {
        $map = $this->dealLikeInput(['name']);

        $list  = RecruitModel::where($map)
            ->order(['id' => 'desc'])
            ->limit(input('limit'))
            ->page(input('page'))
            ->select();
        $count = RecruitModel::where($map)->count();

        foreach ($list as $v) {
            $v['apply_count'] = RecruitAppointInfoModel::where('recruit_id',$v['id'])->count();
        }

        if ($count == 0) {
            ajax_return(1, '未查询到数据');
        }
        list_return($list, $count);
    }
}