Commit 3ffd7e89 authored by Thidaporn Laisan's avatar Thidaporn Laisan
Browse files

update file create patch

parent 4bcd8562
...@@ -27,30 +27,12 @@ class ExchangerateUpload extends Component ...@@ -27,30 +27,12 @@ class ExchangerateUpload extends Component
$temporaryFilePath = 'livewire-tmp/' . $this->file->getFilename(); $temporaryFilePath = 'livewire-tmp/' . $this->file->getFilename();
try {
if (Storage::disk('public')->exists($temporaryFilePath)) {
$absolutePath = Storage::disk('public')->path($temporaryFilePath);
$absolutePath = str_replace('/', '\\', $absolutePath);
$this->processFileForPatch($absolutePath);
session()->flash('message', 'File processed successfully.');
} else {
session()->flash('message', 'Temporary file not found.');
}
} catch (\Exception $e) {
session()->flash('message', 'Error during file processing: ' . $e->getMessage());
}
if ($this->sendToEec) { if ($this->sendToEec) {
$absolutePath = Storage::disk('public')->path($temporaryFilePath); $absolutePath = Storage::disk('public')->path($temporaryFilePath);
$absolutePath = str_replace('/', '\\', $absolutePath); $absolutePath = str_replace('/', '\\', $absolutePath);
$resultEEC = $this->sendMasterFileToEcc($absolutePath); $resultEEC = $this->sendMasterFileToEcc($absolutePath);
if ($resultEEC['http_code'] == 200) {
session()->flash('message', 'Send MasterFile To EEC successfully!');
} else {
session()->flash('message', 'Failed to send MasterFile To EEC.');
}
} }
if ($this->createPatch && $this->updatePatch) { if ($this->createPatch && $this->updatePatch) {
...@@ -156,7 +138,7 @@ class ExchangerateUpload extends Component ...@@ -156,7 +138,7 @@ class ExchangerateUpload extends Component
if ($chk === true) { if ($chk === true) {
session()->flash('message', 'ไม่สามารถเพิ่ม Patch เดือน '.$m2.' ปี '.$y2.' ได้เนื่องจากได้มีการเพิ่มข้อมูลไว้ในระบบเรียบร้อยแล้ว.'); session()->flash('message', 'ไม่สามารถเพิ่ม Patch เดือน '.$m2.' ปี '.$y2.' ได้เนื่องจากได้มีการเพิ่มข้อมูลไว้ในระบบเรียบร้อยแล้ว.');
return; return false;
} }
// session()->forget('message'); // session()->forget('message');
...@@ -306,15 +288,15 @@ class ExchangerateUpload extends Component ...@@ -306,15 +288,15 @@ class ExchangerateUpload extends Component
$MAJOR_VERSION = 'All'; $MAJOR_VERSION = 'All';
$POWNER = auth()->user()->id; $POWNER = auth()->user()->id;
$PATCHCODE = Storage::get($this->findHTX('patchcode_new.txt')); $PATCHCODE = Storage::get('patchcode_new.txt');
$PATCHCODE = str_replace("'", "''", $PATCHCODE); $PATCHCODE = str_replace("'", "''", $PATCHCODE);
$UNINSTALL = Storage::get($this->findHTX('uninstall_new.txt')); $UNINSTALL = Storage::get('uninstall_new.txt');
$UNINSTALL = str_replace("'", "''", $UNINSTALL); $UNINSTALL = str_replace("'", "''", $UNINSTALL);
$i=0; $i=0;
$PATCHCODE_SERVER = ''; $PATCHCODE_SERVER = '';
$filePath = $this->findHTX('patchcode_server_new.txt'); $filePath = 'patchcode_server_new.txt';
$fileContent = Storage::get($filePath); $fileContent = Storage::get($filePath);
foreach (explode("\n", $fileContent) as $tmp) { foreach (explode("\n", $fileContent) as $tmp) {
if ($i==0) { if ($i==0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment