admin_obj = Db::name('admin'); $this->journal_obj = Db::name('journal'); $this->article_obj = Db::name('article'); $this->journal_topic_obj = Db::name('journal_topic'); $this->journal_stage_obj = Db::name('journal_stage'); $this->journal_line_obj = Db::name('journal_line'); $this->journal_notices_obj = Db::name('journal_notices'); $this->journal_abs_obj = Db::name('journal_abstracting'); $this->article_author_obj = Db::name('article_author'); $this->article_to_topic_obj = Db::name('article_to_topic'); $this->article_to_line_obj = Db::name('article_to_line'); $this->journal_cfp_obj = Db::name('journal_cfp'); $this->journal_paper_obj = Db::name('journal_paper'); $this->journal_paper_art_obj = Db::name('journal_paper_art'); $this->subscribe_journal_obj = Db::name('subscribe_journal'); $this->subscribe_topic_obj = Db::name('subscribe_topic'); $this->board_obj = Db::name('board'); $this->board_group_obj = Db::name('board_group'); $this->base_topic_obj = Db::name('base_topic'); $this->subscribe_base_topic_obj = Db::name('subscribe_base_topic'); $this->footer_obj = Db::name('footer'); $this->journal_for_author = Db::name('journal_for_author'); } /** * 获取footer文章列表 */ public function getFooterList() { $where['footer_state'] = 0; $list = $this->footer_obj->where($where)->order('sort desc')->select(); $frag = []; $frag['Publishing Policy'] = []; $frag['Join Us'] = []; $frag['Products'] = []; $frag['Cooperate with Us'] = []; $frag['Publisher Information'] = []; foreach ($list as $v) { switch ($v['footer_group']) { case 1: $frag['Publishing Policy'][] = $v; break; case 2: $frag['Join Us'][] = $v; break; case 3: $frag['Products'][] = $v; break; case 4: $frag['Cooperate with Us'][] = $v; break; case 5: $frag['Publisher Information'][] = $v; break; } } $re['footers'] = $frag; return jsonSuccess($re); } /** * 增加底栏文章 */ public function addFooter() { $data = $this->request->post(); // 验证规则 $rule = new Validate([ 'footer_title' => 'require', 'content' => 'require', 'footer_group' => 'require', ]); if (!$rule->check($data)) { return jsonError($rule->getError()); } $insert['footer_title'] = trim($data['footer_title']); $insert['content'] = trim($data['content']); $insert['footer_group'] = $data['footer_group']; $insert['sort'] = isset($data['sort'])?$data['sort']:0; $insert['footer_ctime'] = time(); $this->footer_obj->insert($insert); return jsonSuccess([]); } /** * 编辑底栏文章 */ public function editFooter(){ $data = $this->request->post(); // 验证规则 $rule = new Validate([ 'footer_id' => 'require', 'footer_title' => 'require', 'content' => 'require', 'sort' => 'require', ]); if (!$rule->check($data)) { return jsonError($rule->getError()); } $updata['footer_title'] = trim($data['footer_title']); $updata['content'] = trim($data['content']); $updata['sort'] = $data['sort']; $this->footer_obj->where('footer_id',$data['footer_id'])->update($updata); return jsonSuccess([]); } /** * 删除底部文章 */ public function delFooter(){ $data = $this->request->post(); // 验证规则 $rule = new Validate([ 'footer_id' => 'require' ]); if (!$rule->check($data)) { return jsonError($rule->getError()); } $this->footer_obj->where('footer_id',$data['footer_id'])->update(['footer_state'=>1]); return jsonSuccess([]); } }