diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index dd55cb93..60d6f36b 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -774,12 +774,31 @@ class ShopController extends BaseAuthedController $chk = $this->getTodayLastDailySelection($address); } + // 预检查是否有表格更新,未必能检测准确,但是可以避免大部分情况下的错误 + $check = true; + $selection = $chk[0]; + $pre_goodsList = array(); + for ($i = 1; $i <= 6; $i++) { + $pre_goodsList[$i] = mt\Dailyselection::get($selection['grid_' . $i]); + if (!$pre_goodsList[$i]) { + $check = false; + break; + } + } + if (!$check) { + $chk = $this->refreshDailySelectionWithMode($address, 0); + $chk = $this->getTodayLastDailySelection($address); + $selection = $chk[0]; + } + $selection = $chk[0]; $goodsList = array(); for ($i = 1; $i <= 6; $i++) { $goodsList[$i] = mt\Dailyselection::get($selection['grid_' . $i]); - $goodsList[$i]['count'] = $selection['count_' . $i]; - $goodsList[$i]['pending'] = $this->checkPendingBuyGoodsDS($address, $goodsList[$i]['goods_id'], $selection['idx'], $i); + if ($goodsList[$i]) { + $goodsList[$i]['count'] = $selection['count_' . $i]; + $goodsList[$i]['pending'] = $this->checkPendingBuyGoodsDS($address, $goodsList[$i]['goods_id'], $selection['idx'], $i); + } } $count = $this->countTodayRefreshTimes($address);