<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/4/18
 * Time: 17:16
 */

namespace app\index\model;
use think\Model;
class recuitawardmodel extends Model{
    protected $table='t_recuitaward';

    public function insinfo($arr){
        $this->allowField(true)->isUpdate(false)->setAttr('id',null)->save($arr);
        return $this->id;
    }

    public function updateinfobyid($id,$arr){
        $where_arr['id']=$id;
        $this->allowField(true)->where($where_arr)->update($arr);

    }

    public function selinfobywid($uid,$strmoth){
        $where_arr['recuituser']=$uid;
        $where_arr['summonth']=$strmoth;
        $rec=$this->where($where_arr)->find();
        return $rec;

    }
    /*
     * 20200418
     * 获取某用户的所有记录,并按时间降序排列
     * todo 压力大后改为只返回结果值
     */
    public function selinfolistbywid($uid,$sort){
        $where_arr['recuituser']=$uid;
        if ($sort==0){
            $rlist=$this->where($where_arr)->order('sumdate','asc')->select();
        }else{
            $rlist=$this->where($where_arr)->order('sumdate','desc')->select();
        }
        return $rlist;
    }

    /*
     * 20200419
     *获取指定日期的
     */

    public function selinfobyiddate($uid,$strdate){
        $where_arr['recuituser']=$uid;
        $where_arr['sumdate']=$strdate;
        $rec=$this->where($where_arr)->find();
        return $rec;

    }


}