where($map)->find(); $r = null; if ($record&&$zd_id != null ) { // 符合条件的记录已存在,做更新操作 $r = $this->where($map)->update($data); } else { $r = $this->save($data); $zd_id = $this->id; } return ['res'=>$r,'id'=>$zd_id]; } }