This commit is contained in:
antv
2026-07-15 10:04:06 +07:00
parent ce6c4d2cf3
commit 866d46bf21
7 changed files with 222 additions and 60 deletions
@@ -199,14 +199,4 @@ class AdminController extends Controller
return redirect()->back()->withErrors(['error' => $e->getMessage()]);
}
}
/**
* Reset all cards for active users.
*/
public function resetCards(): RedirectResponse
{
$this->adminService->resetAllCards();
return redirect()->back()->with('success', __('messages.cards_reset_success'));
}
}
@@ -75,6 +75,23 @@ class UserController extends Controller
$receiverUser = \App\Models\User::where('msnv', $request->input('receiver'))->first();
// Send ChatOps notification from backend to avoid CORS issues
$chatOpsUrl = config('constants.CHATOPS_API_URL');
$chatOpsToken = config('constants.CHATOPS_API_TOKEN');
$email = 'antv@runsystem.net';
if ($chatOpsUrl && $chatOpsToken) {
try {
\Illuminate\Support\Facades\Http::timeout(5)->post($chatOpsUrl, [
'message' => "💌 Bạn nhận được một Thank Card mới!\nNhanh chân đến khu vực nhận thư để nhận ngay nhé!",
'userEmail' => $email,
'token' => $chatOpsToken,
]);
} catch (\Exception $e) {
\Illuminate\Support\Facades\Log::error('ChatOps API failed: ' . $e->getMessage());
}
}
return response()->json([
'success' => true,
'message' => __('messages.thank_card_send_success'),