Exemple #1
0
 protected function period($beforebefore, $before)
 {
     $proxies = ProxyS::where('time', '>=', $beforebefore)->where('time', '<=', $before)->orderBy('id', 'desc')->get();
     return $proxies;
 }
Exemple #2
0
 public function circle_core($from_secord, $to_secord)
 {
     $stepNum = Variables::getStepNum();
     $period_secord = $from_secord - $to_secord;
     $step_secord = (int) ($period_secord / $stepNum);
     $now = time();
     #_tp means time point.
     $beforebefore_tp = $now - $from_secord;
     $before_tp = $now - $to_secord;
     $slist = ProxyS::period($beforebefore_tp, $before_tp);
     $res = Variables::chartjs_line_three_inited_with_time($beforebefore_tp, $step_secord, $stepNum, 'pachong', 'hidemyass', 'freeproxylists');
     foreach ($slist as $sone) {
         $source = $sone['source'];
         $count = $sone['count'];
         $time = $sone['time'];
         $i = (int) (($time - $beforebefore_tp - 10) / $step_secord);
         if ($source == 10) {
             $res['datasets'][0]['data'][$i] += $count;
         } elseif ($source == 9) {
             $res['datasets'][1]['data'][$i] += $count;
         } elseif ($source == 8) {
             $res['datasets'][2]['data'][$i] += $count;
         }
     }
     $res = json_encode($res);
     $url = action('ProxyController@cstep', ['']);
     return compact('res', 'from_secord', 'to_secord', 'url');
 }