festivalModel = new festivalModel; } /** * @title: 节日列表 * @return array * @Author: wangkewei * @Date: 2021/5/18 9:13 */ public function getList() { $list = $this->festivalModel->order("weigh ASC")->select(); $list = FieldConverList($list); return res(1,"获取成功",$list); } /** * @title: 节日编辑 * @param array * @return array * @Author: wangkewei * @Date: 2021/5/18 9:13 */ public function doEdit() { $data = $this->request->param(); try{ $this->festivalModel->replace()->save($data); slog(1,"编辑了节日".$data['festival_name']); return res(1,"保存成功"); }catch(Exception $e){ return res(2,"保存失败".$e->getMessage()); } } /** * @title: 节日删除 * @param {int} {ids} {必填} {id} * @return array * @Author: wangkewei * @Date: 2021/5/18 9:14 */ public function doDelete() { $data = $this->request->param(); if(empty($data['ids']))return res(2,"参数错误"); $info = $this->festivalModel->where("festival_id",$data['ids'])->find(); $this->festivalModel->where("festival_id",$data['ids'])->delete(); slog(1,"删除了节日".$info->festival_name); return res(1,"删除成功"); } }