|
@@ -172,7 +172,7 @@ class BehaviorRepository
|
|
|
if ($res) {
|
|
|
$cerate_bahavior_data = [
|
|
|
'operator_id' => Auth::user()->id,
|
|
|
- 'behavior_id' => $res->virus_behavior_id,
|
|
|
+ 'behavior_id' => $res['id'],
|
|
|
'username' => Auth::user()->username,
|
|
|
'content' => json_encode($data),
|
|
|
'type' => 0,
|
|
@@ -231,7 +231,7 @@ class BehaviorRepository
|
|
|
if ($res) {
|
|
|
$cerate_bahavior_data = [
|
|
|
'operator_id' => Auth::user()->id,
|
|
|
- 'behavior_id' => $request['virus_behavior_id'],
|
|
|
+ 'behavior_id' => $request['id'],
|
|
|
'username' => Auth::user()->username,
|
|
|
'content' => json_encode($update_bahavior),
|
|
|
'type' => 1,
|
|
@@ -256,5 +256,47 @@ class BehaviorRepository
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function editStatus($request)
|
|
|
+ {
|
|
|
+ $behavior = $this->behavior->find($request['id']);
|
|
|
+
|
|
|
+ $behavior_array = [
|
|
|
+ 'is_open' => $request['is_open'],
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
+
|
|
|
+ DB::beginTransaction();
|
|
|
+ try {
|
|
|
+ $res = $behavior->where('id',$request['id'])->update($behavior_array);
|
|
|
+ if ($res) {
|
|
|
+ $cerate_bahavior_data = [
|
|
|
+ 'operator_id' => Auth::user()->id,
|
|
|
+ 'behavior_id' => $request['id'],
|
|
|
+ 'username' => Auth::user()->username,
|
|
|
+ 'content' => json_encode($behavior_array),
|
|
|
+ 'type' => 1,
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
+ $result = $this->behaviorOperationLog->insert($cerate_bahavior_data);
|
|
|
+ if (!$result) {
|
|
|
+ throw new HttpException(500, '操作日志记录失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DB::commit();
|
|
|
+ return Response::create();
|
|
|
+
|
|
|
+ } catch (QueryException $exception) {
|
|
|
+ DB::rollBack();
|
|
|
+ Log::debug('修改状态行为:' . $exception->getMessage());
|
|
|
+ return Response::create([
|
|
|
+ 'message' => '修改状态失败,请重试',
|
|
|
+ 'error' => $exception->getMessage(),
|
|
|
+ 'status_code' => 500
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|