pause push

This commit is contained in:
Edmond Lang
2025-10-28 18:17:33 +08:00
parent a4e8df6c6b
commit 9361cdd8c1
2 changed files with 60 additions and 2 deletions
+2 -2
View File
@@ -107,8 +107,8 @@ class Kernel extends ConsoleKernel
}
// // Push booking module to Lark
$schedule->command('lark:push-booking-transactions-module')
->everyTenMinutes();
// $schedule->command('lark:push-booking-transactions-module')
// ->everyTenMinutes();
}
/**
@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::statement("
CREATE OR REPLACE VIEW wallet_transactions_view AS
SELECT
t.id AS transaction_id,
t.type AS transaction_type,
t.status AS transaction_status,
t.bill_no AS transaction_bill_no,
b.id AS booking_id,
b.marking AS booking_marking,
c.name AS company_name,
c.reference AS company_reference,
st.name AS service_name,
fc.short_code AS currency_code,
b.fix_amount AS booking_amount,
t.created_at AS transaction_created_at,
t.updated_at AS transaction_updated_at,
CASE c.e_invoice
WHEN 1 THEN 'Yes'
WHEN 0 THEN 'No'
ELSE 'Not Submitted'
END AS need_e_invoice
FROM transactions t
LEFT JOIN bookings b
ON (
(t.type IN (1,2,4,6,7,8,17) AND b.id = t.owner_id)
OR (t.type IN (3,15,16) AND b.id = (
SELECT bb.id FROM transactions tt
JOIN bookings bb ON bb.id = tt.owner_id
WHERE tt.id = t.owner_id LIMIT 1
))
OR (t.type = 12 AND b.id = (
SELECT bbb.id FROM transactions ttt
JOIN bookings bbb ON bbb.id = ttt.owner_id
WHERE ttt.id = (
SELECT tt2.owner_id FROM transactions tt2 WHERE tt2.id = t.owner_id LIMIT 1
) LIMIT 1
))
)
LEFT JOIN companies c ON c.id = b.company_id
LEFT JOIN service_types st ON st.id = b.service_id
LEFT JOIN currencies fc ON fc.id = b.fix_currency_id;
");
}
public function down(): void
{
DB::statement('DROP VIEW IF EXISTS booking_transactions');
}
};