<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/3/8
 * Time: 16:48
 */

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

class contactmodel extends Model{
    protected $table='t_contact';
    /*
     * 20200308
     * 执行合同
     */
    public function insinfo($arr){
        $res=$this->allowField(true)->save($arr);
        return $this->id;
    }

    /*
     * 20200308
     * 查询工地下的所有合同
     */
    public function selclistbypid($pid){
        $rlist=$this->where('pid',$pid)->select();
        return $rlist;

    }

    /*
     * 20200320
     * 查询所有有效的合同，
     */
   public function selectclistbyacitve(){
       $rlist=$this->where('isacitve',1)->select();
       return $rlist;
   }
    /*
     * 20200309
     * 根据ID查合同信息
     */
    public function selcinfobycid($cid){
        $rec=$this->where('id',$cid)->find();
        return $rec;
    }

    /*
     * 20230215
     */
    public function sellistbycid($cid){
        $where_arr['isacitve']=1;
        $where_arr['companyid']=$cid;
        $rlist=$this->where($where_arr)->select();
        return $rlist;
    }

}