<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2021/2/28
 * Time: 14:58
 */
namespace app\index\model;
use think\Model;
class transfermodel extends Model {
    protected $table = 't_waittransfer';

    /*
     * 20210228
     * 插入记录
     */
    public function insinfo($arr) {
        $this->allowField(true)->isUpdate(false)->setAttr('id', null)->save($arr);
        return $this->id;
    }

    /*
     * 20210303
     * 获取未处理的
     */
    public function selinfolistbyopr($page, $size) {
        $where_arr['isopr'] = 0;
        $index = ($page - 1) * $size;
        $rlist = $this->where($where_arr)->limit($index, $size)->order("id desc")->select();
        $rlist = collection($rlist)->toArray();
        return $rlist;
    }

    /*
     * 20210303
     * 修改处理状态
     */
    public function updoprbywid($wid, $prjid) {
        $where_arr['isopr'] = 0;
        $where_arr['wid'] = $wid;
        $update_arr['isopr'] = 1;
        $update_arr['transferprj'] = $prjid;
        $this->where($where_arr)->update($update_arr);
    }
}