From 0275ff30c6e3c670e32f6c2f6d1e143d34f80bab Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:19:26 +0300 Subject: [PATCH] update send pretend --- .../Api/Images/Contests/SendPretend.php | 16 +++++++++------- views/pages/Contests/VotingSendPretend.php | 4 +++- views/pages/Search/Index.php | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/Controllers/Api/Images/Contests/SendPretend.php b/app/Controllers/Api/Images/Contests/SendPretend.php index 8457c3b..466dda2 100644 --- a/app/Controllers/Api/Images/Contests/SendPretend.php +++ b/app/Controllers/Api/Images/Contests/SendPretend.php @@ -12,12 +12,14 @@ class SendPretend { public function __construct() { - DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id'=>$_POST['cid'], ':idd'=>$_POST['photo_id'])); - echo json_encode( - array( - 'errorcode' => 0, - 'error' => 0 - ) - ); + if (DB::query('SELECT contest_id FROM photos WHERE user_id=:uid', array(':uid' => Auth::userid()))[0]['contest_id'] != $_POST['cid']) { + DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id' => $_POST['cid'], ':idd' => $_POST['photo_id'])); + echo json_encode( + array( + 'errorcode' => 0, + 'error' => 0 + ) + ); + } } } diff --git a/views/pages/Contests/VotingSendPretend.php b/views/pages/Contests/VotingSendPretend.php index 9cdd709..f6211e5 100644 --- a/views/pages/Contests/VotingSendPretend.php +++ b/views/pages/Contests/VotingSendPretend.php @@ -151,7 +151,9 @@ function convertUnixToRussianDateTime($unixTime) data: $(this).serialize(), success: function(response) { var jsonData = JSON.parse(response); - + if (jsonData.errorcode === 0) { + alert('Фотография успешно отправлена на претенденты на Фотоконкурс'); + } } }); diff --git a/views/pages/Search/Index.php b/views/pages/Search/Index.php index 2e9ed53..8c9ddea 100644 --- a/views/pages/Search/Index.php +++ b/views/pages/Search/Index.php @@ -425,10 +425,10 @@ $(document).ready(function() -