where('id',$post['id'])->save($post); return true; } else { unset($post['id']); $post["time"] = time(); $bool = $this->insert($post); return $bool; } } /** * 删除数据 * @param type $id * @return boolean */ public function newsDel($id){ $this->where("id",$id)->delete(); return true; } /** * 设置显示状态 * @param $id * @param $status */ public function newsShowSet($id,$status) { self::beginTrans(); try{ $this->where('id', $id)->save(['is_show'=>$status]); self::commitTrans(); return true; }catch (DbException $db) { self::rollbackTrans(); return false; } } }