<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2023/1/31
 * Time: 13:59
 */
namespace app\index\model;
use think\Model;
class inventrecmodel extends Model{
    protected $table='t_inventworkerrec';
    /*
     * 20200308
     *
     */
    public function insinfo($arr){
        $res=$this->allowField(true)->save($arr);
        return $this->id;
    }

    /*
     * 20230131
     */
    public function selinfobywid($wid){
        $where_arr['workerid']=$wid;
        $where_arr['isaccept']=0;
        $rec=$this->where($where_arr)->order('id','desc')->find();
        return $rec;
    }

    /*
     * 20230131
     */
    public function updateacceptbyid($id){
        $where_arr['id']=$id;
        $where_arr['isaccept']=0;
        $update_arr['isaccept']=1;
        $update_arr['accpetdate']=date('Y-m-d');
        $rec=$this->where($where_arr)->update($update_arr);
        return $rec;
    }

    /*
     * 20230201
     */
    public function selinfobyid($id){
        $where_arr['id']=$id;
        $rec=$this->where($where_arr)->find();
        return $rec;
    }
}