matchScheduleModel = new MatchSchedule(); } public function getOne($scheduleId) { return $this->matchScheduleModel->get($scheduleId); } public function getByWhere($param) { return $this->matchScheduleModel->all($param); } public function addSchedule($add_data) { $data['match_id'] = $add_data['match_id']; $data['title'] = $add_data['title']; $data['content'] = $add_data['content']; $data['schedule_date'] = $add_data['date']; Db::startTrans(); try { if ($this->matchScheduleModel->insertGetId($data)) { Db::commit(); } return true; } catch (Exception $exception) { Db::rollback(); $this->error($exception->getMessage()); } } public function editSchedule($edit_data) { $data['match_id'] = $edit_data['match_id']; $data['title'] = $edit_data['title']; $data['content'] = $edit_data['content']; $data['schedule_date'] = $edit_data['date']; $id = $edit_data['date']; Db::startTrans(); try { if ($this->matchScheduleModel->update($data, ['id' => $id])) { Db::commit(); } return true; } catch (Exception $exception) { Db::rollback(); $this->error($exception->getMessage()); } } public function delSchedule($scheduleId) { Db::startTrans(); try { if ($this->matchScheduleModel->where('id', $scheduleId)->delete()) { Db::commit(); } return true; } catch (Exception $exception) { Db::rollback(); $this->error($exception->getMessage()); } } }