private static function divideRanges($ranges) { $grid = array(); for ($i = 0; $i < 24 * 7; $i++) { $grid[$i] = array(); } foreach ($ranges as $range) { $grid[DailyAnalyzer::getCellIndex($range)][] = $range; } return $grid; }
public function updateBean(Request $request) { $customer = \Helper::getCustomer(); if (!$customer) { return response()->json(['result' => '-1']); } /*if>*/ if (!$customer->is_registered) { return response()->json(['result' => '-1']); } /*if>*/ $article = Article::where('id', $request->input('id'))->first(); \Analyzer::updateArticleStatistics($customer->id, $article->type_id); \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE); \EnterpriseAnalyzer::updateArticleStatistics($article->type_id); \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_ARTICLE); if (\DailyAnalyzer::getDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE)) { \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE); return response()->json(['result' => '-1']); } \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE); \BeanRecharger::executeEducation($customer); return response()->json(['result' => '1']); }