This commit is contained in:
antv
2026-07-16 16:01:15 +07:00
parent 939287d9b3
commit 9c20a25111
10 changed files with 123 additions and 180 deletions
@@ -61,6 +61,25 @@ class UserController extends Controller
return view('user.send', compact('users'));
}
/**
* Get statistics for a specific recipient.
*/
public function getRecipientStats(Request $request): JsonResponse
{
$receiverMsnv = (string) $request->query('receiver');
if (empty($receiverMsnv)) {
return response()->json(['success' => false, 'message' => 'Receiver is required'], 400);
}
$sender = Auth::user();
$sentCount = $this->userService->getSentCardsToUserThisMonth($sender, $receiverMsnv);
return response()->json([
'success' => true,
'sent_count' => $sentCount,
]);
}
public function storeThankcards(SendThankCardRequest $request): JsonResponse
{
try {
@@ -91,10 +110,15 @@ class UserController extends Controller
}
}
$sender = Auth::user();
$newRecipientSentCount = $this->userService->getSentCardsToUserThisMonth($sender, (string) $request->input('receiver'));
return response()->json([
'success' => true,
'message' => __('messages.thank_card_send_success'),
'receiver_email' => $receiverUser ? $receiverUser->mail : '',
'new_balance' => (int) $sender->card,
'new_recipient_sent_count' => $newRecipientSentCount,
]);
}