where($where); if(!is_null($page)) $modelObj->page((int)$page); if(!is_null($limit)) $modelObj->limit((int)$limit); if(!is_null($order)) $modelObj->order($order); $data = $modelObj->select()->toArray(); return $data; } /** * 总数获取 */ public function count($where) { $modelObj = Model::where($where); $num = $modelObj->count(); return $num; } /** * 添加每日发圈内容 */ public function addArticle($data) { Model::insert($data); } /** * 内容上下架 */ public function shelf($id) { $shelf = Model::where('id', $id)->value('shelf'); $shelf = $shelf == 1 ? 0 : 1; Model::where('id',$id)->setField('shelf',$shelf); } /** * 删除每日发圈内容 */ public function del($id) { Model::where('id',$id)->setField('del',1); } /** * 内容编辑 */ public function edit($id) { $data = Model::where('id', $id)->find(); return $data; } /** * 内容编辑保存 */ public function save($data) { Model::where('id', $data['id'])->update($data); } }