<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/4/15
 * Time: 15:52
 */

namespace app\index\model;
use think\Model;

class recuitmodel extends Model{
    protected $table='t_recuit';

    public function insinfo($arr){
        $this->allowField(true)->save($arr);
        return $this->id;

    }

    public function selulistbyrecuit($recuit){
        $where_arr['recuituserid']=$recuit;
        $rlist=$this->where($where_arr)->order('indate','asc')->select();
        return $rlist;
    }

    /*
     * 20200416
     * 获取所有的数据
     */
    public function selrlist(){
        $strsql="select *";
        $strsql=$strsql." from t_recuit";
        $rlist=$this->query($strsql);
        return $rlist;
    }

    /*
     * 20200421
     */
    public function selruserlist(){
        $strsql="select DISTINCT recuituserid ";
        $strsql=$strsql." from t_recuit";
        $ulist=$this->query($strsql);
        $ulist=collection($ulist)->toArray();
        return $ulist;

    }

    /*
     * 20200503
     * 判断某人是否是被推荐的，以确认是否计划招人成本
     */
    public function selrecuitinfobyuserid($uid){
        $where_arr['userid']=$uid;
        $rec=$this->where($where_arr)->find();
        return $rec;
    }

    /*
     * 20200817
     * 获取所有的被推荐了
     */
    public function seluserlist(){
        $strsql="select userid ";
        $strsql=$strsql." from t_recuit";
        $ulist=$this->query($strsql);
        $ulist=collection($ulist)->toArray();
        return $ulist;
    }
}