Batch 6a: application controllers base

This commit is contained in:
sas.fajri
2026-04-15 15:23:57 +07:00
parent 44b14b20a3
commit 3784d9ee28
1553 changed files with 1307399 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Merge_report extends MY_Controller {
public function __construct() {
parent::__construct();
$this->load->database();
}
public function get($id = null) {
header('Content-Type: application/json');
try {
if ($id === null || !is_numeric($id)) {
throw new Exception('Invalid or missing ID parameter.');
}
$query = $this->db
->select('mergeRequestPayload')
->where('mergeRequestID', $id)
->get('merge_request');
if ($query->num_rows() === 0) {
throw new Exception('Record not found.');
}
$row = $query->row();
$payload = json_decode($row->mergeRequestPayload, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new Exception('Invalid JSON in mergeRequestPayload.');
}
echo json_encode([
'status' => 'OK',
'data' => $payload
]);
} catch (Exception $e) {
echo json_encode([
'status' => 'ERR',
'message' => $e->getMessage()
]);
}
}
}