diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 72d0bd0..51a24a9 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -534,48 +534,50 @@ class SignController{ )); $order = 0; $lastid = 0; - foreach ($rowShare as $rs) { - if ($rs['status'] == 1) { - $order++; - } - $lastid = $rs['ach_id']; - } - if ($order >= count($rowShare)) { - //更新新的邀请列表 - $s = $this->getShare($lastid); - if (!$s) { - die(); - } - $share_meta_table = require('../res/share@share.php'); - $type = $s['type'] + 1; - if ($lastid >= count($share_meta_table)) { - $type = $s['type']; - } - $count = 0; - for ($i = 1; $i <= count($share_meta_table); $i++) { - $s1 = $this->getShare($i); - if (!$s1 || $s1['type'] != $type) { - continue; + if (count($rowShare) != 0) { + foreach ($rowShare as $rs) { + if ($rs['status'] == 1) { + $order++; } - $id = $i; - $updateid = $rowShare[$count]['ach_id']; - $count++; - $share_ret = $conn->execScript('UPDATE share_achievement SET ach_id=:ach_id, status=0, modify_time=:modify_time ' . - ' WHERE accountid=:accountid AND ach_id=:id;', + $lastid = $rs['ach_id']; + } + if ($order >= count($rowShare)) { + //更新新的邀请列表 + $s = $this->getShare($lastid); + if (!$s) { + die(); + } + $share_meta_table = require('../res/share@share.php'); + $type = $s['type'] + 1; + if ($lastid >= count($share_meta_table)) { + $type = $s['type']; + } + $count = 0; + for ($i = 1; $i <= count($share_meta_table); $i++) { + $s1 = $this->getShare($i); + if (!$s1 || $s1['type'] != $type) { + continue; + } + $id = $i; + $updateid = $rowShare[$count]['ach_id']; + $count++; + $share_ret = $conn->execScript('UPDATE share_achievement SET ach_id=:ach_id, status=0, modify_time=:modify_time ' . + ' WHERE accountid=:accountid AND ach_id=:id;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':ach_id' => $id, + ':id' => $updateid + )); + } + } else { + $share_ret = $conn->execScript('UPDATE share_achievement SET status=0, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), - ':ach_id' => $id, - ':id' => $updateid )); } - } else { - $share_ret = $conn->execScript('UPDATE share_achievement SET status=0, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - )); } }