/** * 拍品信息保存 * @param int $id * @throws \Exception * @throws \FuelException */ public function action_save($id = 0) { if (\Input::method() == 'POST') { $msg = ['status' => 'err', 'msg' => '', 'errcode' => 10]; $data = \Input::post(); $data['begin_at'] = $data['begin_at'] ? strtotime($data['begin_at']) : 0; $data['end_at'] = $data['end_at'] ? strtotime($data['end_at']) : 0; $lot = \Model_Lot::find($id); if (!$lot) { $lot = \Model_Lot::forge(); } $lot->set($data); if ($lot->save()) { $msg = ['status' => 'succ', 'msg' => '', 'errcode' => 0, 'data' => $lot->to_array()]; } if (\Input::is_ajax()) { die(json_encode($msg)); } \Session::set_flash('msg', $msg); } $params = []; $params['item'] = \Model_Lot::find($id); \View::set_global($params); $this->template->content = \View::forge("{$this->theme}/auction/details"); }