From 50e7ca0ec471e0834b9c31e8532497f6e1de5987 Mon Sep 17 00:00:00 2001 From: ONEXIN Date: Thu, 29 Apr 2021 17:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F=E8=B4=B4=E5=AD=90=E3=80=81?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=AD=89=E6=97=B6=E6=95=B0=E5=AD=97=E4=B8=8D?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/spacecp/spacecp_favorite.php | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/upload/source/include/spacecp/spacecp_favorite.php b/upload/source/include/spacecp/spacecp_favorite.php index 1aaa75d6d..d39b93fc0 100644 --- a/upload/source/include/spacecp/spacecp_favorite.php +++ b/upload/source/include/spacecp/spacecp_favorite.php @@ -18,16 +18,11 @@ if($_GET['op'] == 'delete') { $deletecounter = array(); $data = C::t('home_favorite')->fetch_all($_GET['favorite']); foreach($data as $dataone) { - switch($dataone['idtype']) { - case 'fid': - $deletecounter['fids'][] = $dataone['id']; - break; - default: - break; - } + $deletecounter[$dataone['idtype']]['idtype'] = $dataone['idtype']; + $deletecounter[$dataone['idtype']]['id'][] = $dataone['id']; } - if($deletecounter['fids']) { - C::t('forum_forum')->update_forum_counter($deletecounter['fids'], 0, 0, 0, 0, -1); + foreach($deletecounter as $thevalue) { + deletefavorite($thevalue); } C::t('home_favorite')->delete($_GET['favorite'], false, $_G['uid']); } @@ -40,31 +35,7 @@ if($_GET['op'] == 'delete') { } if(submitcheck('deletesubmit')) { - switch($thevalue['idtype']) { - case 'tid': - C::t('forum_thread')->increase($thevalue['id'], array('favtimes'=>-1)); - require_once libfile('function/forum'); - update_threadpartake($thevalue['id']); - break; - case 'fid': - C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1); - break; - case 'blogid': - C::t('home_blog')->increase($thevalue['id'], 0, array('favtimes' => -1)); - break; - case 'gid': - C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1); - break; - case 'albumid': - C::t('home_album')->update_num_by_albumid($thevalue['id'], -1, 'favtimes', 0); - break; - case 'uid': - C::t('common_member_status')->increase($thevalue['id'], array('favtimes' => -1)); - break; - case 'aid': - C::t('portal_article_count')->increase($thevalue['id'], array('favtimes' => -1)); - break; - } + deletefavorite($thevalue); C::t('home_favorite')->delete($favid); showmessage('do_success', 'home.php?mod=space&uid='.$_G['uid'].'&do=favorite&view=me&type='.$_GET['type'].'&quickforward=1', array('favid' => $favid, 'id' => $thevalue['id']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'locationtime' => 3)); } @@ -185,5 +156,31 @@ if($_GET['op'] == 'delete') { include template('home/spacecp_favorite'); +function deletefavorite($thevalue = array()){ + switch($thevalue['idtype']) { + case 'tid': + C::t('forum_thread')->increase($thevalue['id'], array('favtimes'=>-1)); + break; + case 'fid': + C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1); + break; + default: + case 'blogid': + C::t('home_blog')->increase($thevalue['id'], 0, array('favtimes' => -1)); + break; + case 'gid': + C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1); + break; + case 'albumid': + C::t('home_album')->update_num_by_albumid($thevalue['id'], -1, 'favtimes', 0); + break; + case 'uid': + C::t('common_member_status')->increase($thevalue['id'], array('favtimes' => -1)); + break; + case 'aid': + C::t('portal_article_count')->increase($thevalue['id'], array('favtimes' => -1)); + break; + } +} ?> \ No newline at end of file -- Gitee