|
@@ -62,6 +62,20 @@ class MessageController extends Curd
|
|
|
return $model;
|
|
|
}
|
|
|
|
|
|
+ public function afterQuery($items)
|
|
|
+ {
|
|
|
+ foreach ($items as &$item) {
|
|
|
+ if (!empty($item['client_message_body_json'])) {
|
|
|
+ $bodyJson = json_decode($item['client_message_body_json'], true);
|
|
|
+ if (isset($bodyJson['body'])) {
|
|
|
+ $item['client_message_body_json'] = $bodyJson['body'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $items;
|
|
|
+ }
|
|
|
+
|
|
|
protected function insertInput(Request $request): array
|
|
|
{
|
|
|
$data = $this->inputFilter($request->post());
|
|
@@ -73,7 +87,7 @@ class MessageController extends Curd
|
|
|
$data['client_message_header_json'] = json_encode(['header' => $data['client_message_header_json']]);
|
|
|
}
|
|
|
if (!empty($data['client_message_body_json']) && !is_json($data['client_message_body_json'])) {
|
|
|
- $data['client_message_body_json'] = json_encode(['header' => $data['client_message_body_json']]);
|
|
|
+ $data['client_message_body_json'] = json_encode(['body' => $data['client_message_body_json']]);
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
@@ -95,7 +109,7 @@ class MessageController extends Curd
|
|
|
$data['client_message_header_json'] = json_encode(['header' => $data['client_message_header_json']]);
|
|
|
}
|
|
|
if (!empty($data['client_message_body_json']) && !is_json($data['client_message_body_json'])) {
|
|
|
- $data['client_message_body_json'] = json_encode(['header' => $data['client_message_body_json']]);
|
|
|
+ $data['client_message_body_json'] = json_encode(['body' => $data['client_message_body_json']]);
|
|
|
}
|
|
|
unset($data[$primary_key]);
|
|
|
return [$id, $data];
|