model_id); DB::beginTransaction(); try { Hook::fire($model->table.'.onBeforeAudit', ['table' => $model->table, 'id' => $data_id]); DB::table($model->table)->where('id', $data_id)->update(['status' => 1]); DB::commit(); return $this->json($bill->name.'审核成功', true); } catch(\Exception $e) { DB::rollBack(); return $this->json($e->getMessage()); } } } /** * 弃审 */ public function abortAction() { if (Request::method() == 'POST') { $key = Request::get('key'); $keys = AES::decrypt($key, config('app.key')); list($bill_id, $data_id) = explode('.', $keys); $bill = Bill::find($bill_id); $model = Model::find($bill->model_id); DB::beginTransaction(); try { Hook::fire($model->table.'.onBeforeAbort', ['table' => $model->table, 'id' => $data_id]); DB::table($model->table)->where('id', $data_id)->update(['status' => 0]); DB::commit(); return $this->json($bill->name.'弃审成功', true); } catch(\Exception $e) { DB::rollBack(); return $this->json($e->getMessage()); } } } }