assign(['mer_list' => $mer_list]); return $this->fetch(); } /** * 资质列表 */ public function event_registration_list() { $where = parent::getMore([ ['title', ''], ['status', 1], ['is_show', ''], ['mer_id', ''], ['page', 1], ['limit', 20], ], $this->request); return Json::successlayui(EducationModel::systemPage($where)); } /**编辑 * @param string $is_show * @param string $id */ public function set_show($is_show = '', $id = '') { if ($is_show == '' || $id == '') return Json::fail('缺少参数'); $res = parent::getDataModification('event', $id, 'is_show', (int)$is_show); if ($res) return Json::successful($is_show == 1 ? '显示成功' : '隐藏成功'); else return Json::fail($is_show == 1 ? '显示失败' : '隐藏失败'); } /**获得添加 * @return mixed|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function create($id = 0) { $news = []; $event = []; if ($id) { $data = EducationModel::where('id',$id)->find(); $news = $data; $event =json_decode($data['qualifications'],true); } $this->assign(['id' => $id, 'news' => json_encode($news), 'event' => json_encode($event)]); return $this->fetch(); } /** * 删除活动 * */ public function delete($id) { EducationModel::where('id',$id)->delete($id); return Json::successful('删除成功!'); } /** * 添加和修改资质 */ public function add_new() { $data = parent::postMore([ ['id', 0], 'title', ['sort', 0], ['event', ''],//资质 ]); $id = $data['id']; unset($data['id']); $data_li = [ 'qualifications' => $data['event'], 'sort' => $data['sort'], 'title' => $data['title'], 'add_time' => time(), ]; if($id){ $res = EducationModel::where('id',$id)->update($data_li); }else{ $res = EducationModel::insert($data_li); } return Json::successful($id == 0 ? '添加成功' : '修改成功'); } }