示例#1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Input::has('shopID')) {
         $shopID = base64_decode(Input::get('shopID'));
         if (0 == strcmp($shopID, ALL_SHOPS_FALG)) {
             $headerShop = (object) array("wy_shop_id" => base64_encode(ALL_SHOPS_FALG), "wy_shop_name" => ALL_SHOPS);
             //获取公告信息
             $announces = array();
             $this->getAnnounces($announces);
             $totalTurnover = 0;
             $totalOrderCount = 0;
             $newOrderCount = 0;
             $this->getAllTradeInfo($totalTurnover, $totalOrderCount, $newOrderCount);
             return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces'));
         } else {
             //获取公告信息
             $announces = array();
             $this->getAnnounces($announces);
             $headerShop = AuthController::checkShop($shopID);
             $totalTurnover = 0;
             $totalOrderCount = 0;
             $newOrderCount = 0;
             //显示当前店铺信息
             //缺少对headerShop为空的判断,这是程序出现问题了,应该统一跳回到原来的界面
             //应该统一到一个界面,提示错误,倒计时跳转到上一个正确的界面即可
             if (!empty($headerShop)) {
                 $this->getSingleTradeInfo($shopID, $totalTurnover, $totalOrderCount, $newOrderCount);
                 return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces'));
             } else {
                 return View::make('admin.index', compact('totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces'));
             }
         }
     } else {
         $shops = AuthController::getShops();
         if (empty($shops->toArray())) {
             return View::make('admin.intro.useflow');
         } else {
             $isPassed = false;
             foreach ($shops as $index => $shop) {
                 if (SHOP_AUDIT_STATUS_4 == $shop->wy_audit_state) {
                     $headerShop = $shop;
                     $headerShop->wy_shop_id = base64_encode($headerShop->wy_shop_id);
                     $isPassed = true;
                     break;
                 }
             }
             if ($isPassed) {
                 //获取公告信息
                 $announces = array();
                 $this->getAnnounces($announces);
                 //返回整体数据
                 $totalTurnover = 0;
                 $totalOrderCount = 0;
                 $newOrderCount = 0;
                 $this->getAllTradeInfo($totalTurnover, $totalOrderCount, $newOrderCount);
                 return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces'));
             } else {
                 return View::make('admin.template.tip')->withMessage(Lang::get('messages.10014'));
             }
         }
     }
 }