m
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user