select()->columns('log_id') ->where('shop_id=?',$data['shop_id']) ->where('bn=?',$data['bn']) ->instance()->fetch_one(); # 更新 if ($id) { $this->update($data,array('log_id' => $id)); }else{ # 保存 $this->insert($data); } } }