callApiService = $callApiService; } public function index($siseType, $area=null, $memberbershipname=null) { // siseType별로 title 변수 생성 switch ($siseType) { case 'golf': $title_dir = "골프"; $title = "골프회원권 시세"; break; case 'condo': $title_dir = "콘도"; $title = "콘도회원권 시세"; break; default: $title_dir = "휘트니스"; $title = "휘트니스회원권 시세"; } $query = "post_type_id = 59 and pc5='$siseType'"; if($area){ if($area != 'all'){ $query .= " and pc2='$area'"; } } if($memberbershipname){ $query .= " and postTitle like '%$memberbershipname%'"; } $limit = (int)request('limit', 10); $page = (int)request('page', 1); // api 호출 request $siseList = $this->callApiService->callApi([ 'url' => 'post-page', 'data' => [ 'PageVars' => [ 'Query' => $query, 'Desc' => 'post_title', 'Limit' => $limit, 'Offset' => ($page - 1) * $limit ] ] ]); // dd($siseList); // 등락 계산 if (isset($siseList['Page']) && !empty($siseList['Page'])) { foreach ($siseList['Page'] as &$sise) { if (isset($sise['Pc3'], $sise['Pc4'])) { $sise['fluctuation'] = (float)$sise['Pc3'] - (float)$sise['Pc4']; } else { $sise['fluctuation'] = 0; } } } if ($this->callApiService->verifyApiError($siseList)) { notify()->error($siseList['body'], 'Error', 'bottomRight'); return redirect()->back(); } // pagenation // $totalcnt = $siseList['PageVars']['QueryCnt']; // $siseItems['Page'] = new LengthAwarePaginator( // $siseList['Page'], // $totalcnt, // $limit, // $page, // ['path' => request()->url()] // ); // dd($siseItems['Page']); return view('views.page.sise', compact('siseList', 'title', "title_dir", "siseType", "area")); } public function loadScrollSise(Request $request) { $today = date('ymd'); $limit = (int) $request->query('limit', 400); $page = (int) $request->query('page', 1); $siseType = $request->query('siseType', "golf"); $areaType = $request->query('areaType', "all"); $siseDate = $request->query('siseDate', $today); $query = "post_type_id = 59 "; if($areaType != 'all'){ $query .= "and pc5='$siseType' and pc2='$areaType' and pc6='$siseDate'"; }else{ $query .= "and pc5='$siseType' and pc6='$siseDate'"; } // Log::info('More Sise List:',$siseDate ); $moreSiseList=$this->callApiService->callApi([ 'url' => 'post-page', 'data' => [ 'PageVars' => [ 'Query' => $query, 'Asc' => 'post_title', 'Limit' => $limit, 'Offset' => ($page - 1) * $limit ] ] ]); // 등락 계산 if (isset($moreSiseList['Page']) && !empty($moreSiseList['Page'])) { foreach ($moreSiseList['Page'] as &$sise) { if (isset($sise['Pc3'], $sise['Pc4'])) { $sise['fluctuation'] = (float)$sise['Pc3'] - (float)$sise['Pc4']; } else { $sise['fluctuation'] = 0; } } } if ($this->callApiService->verifyApiError($moreSiseList)) { notify()->error($moreSiseList['body'], 'Error', 'bottomRight'); return redirect()->back(); } return $moreSiseList; } }