public function watch()
 {
     $this->params = ['pageNo' => 1, 'startPageNo' => 1, 'pagePerRow' => 10, 'txtNegoDateFrom' => date('Y/m/d', strtotime('-7 day')), 'txtNegoDateTo' => date('Y/m/d')];
     try {
         $html = $this->http->post(static::URL, ['form_params' => $this->params]);
         $html = static::strip_tags($html);
         if (preg_match('/전체 페이지 : (?<total_page>\\d+)/i', $html, $m)) {
             $total_page = $m['total_page'];
         }
         if (!$total_page) {
             throw new \Exception('Empty total_page');
         }
         for ($page = 1; $page <= $total_page; $page++) {
             if ($page > 1) {
                 $this->params['pageNo'] = $page;
                 $html = $this->http->post(static::URL, ['form_params' => $this->params]);
                 $html = static::strip_tags($html);
             }
             $p = '#<tr>' . ' <td>(?<constdt>[^<]*)</td>' . ' <td>(?<constno>[^<]*)</td>' . ' <td>(?<degree>[^<]*)</td>' . ' <td>(?<constnm>[^<]*)</td>' . ' <td>(?<org>[^<]*)</td>' . ' <td>(?<budget>[^<]*)</td>' . ' <td>(?<bidcls>[^<]*)</td>' . ' <td> (?<bidproc>[^<]*)' . ' <input type="hidden" name="hidCsrtNumb" value="(?<hidCsrtNumb>.*)" />' . ' <input type="hidden" name="hidDprtCode" value="(?<hidDprtCode>.*)" />' . ' <input type="hidden" name="hidNegnPldt" value="(?<hidNegnPldt>.*)" />' . ' <input type="hidden" name="hidNegnDegr" value="(?<hidNegnDegr>.*)" />' . ' </td> </tr>#i';
             $p = str_replace(' ', '\\s*', $p);
             if (preg_match_all($p, $html, $matches, PREG_SET_ORDER)) {
                 foreach ($matches as $m) {
                     $data = ['constno' => trim($m['constno']), 'degree' => trim($m['degree']), 'constnm' => trim($m['constnm']), 'org' => trim($m['org']), 'budget' => trim($m['budget']), 'bidcls' => trim($m['bidcls']), 'constdt' => trim($m['constdt']), 'bidproc' => trim($m['bidproc']), 'hidDprtCode' => trim($m['hidDprtCode']), 'hidCsrtNumb' => trim($m['hidCsrtNumb']), 'hidNegnPldt' => trim($m['hidNegnPldt']), 'hidNegnDegr' => trim($m['hidNegnDegr'])];
                     $event = new WatchEvent();
                     $event->row = $data;
                     $this->trigger(WatchEvent::EVENT_ROW, $event);
                 }
             }
             \d2b\Http::sleep();
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
 public function watch()
 {
     $this->params = ['pageNo' => 1, 'startPageNo' => 1, 'pagePerRow' => 10, 'txtBidDateFrom' => date('Y/m/d', strtotime('-7 day')), 'txtBidDateTo' => date('Y/m/d')];
     try {
         $html = $this->http->post(static::URL, ['form_params' => $this->params]);
         $html = static::strip_tags($html);
         if (preg_match('/전체 페이지 : (?<total_page>\\d+)/i', $html, $m)) {
             $total_page = $m['total_page'];
         }
         if (!$total_page) {
             throw new \Exception('Empty total_page');
         }
         for ($page = 1; $page <= $total_page; $page++) {
             if ($page > 1) {
                 $this->params['pageNo'] = $page;
                 $html = $this->http->post(static::URL, ['form_params' => $this->params]);
                 $html = static::strip_tags($html);
             }
             $p = '#<tr>' . ' <td>(?<status>[^A-Z]*)(?<notinum>[0-9A-Z]{7}-\\d{1})</td>' . ' <td>(?<constno>[^<]*)</td>' . ' <td>[^<]*</td>' . ' <td> <a[^>]*>(?<constnm>[^<]*)</a> </td>' . ' <td>(?<org>[^<]*)</td>' . ' <td>(?<contract>[^<]*)</td>' . ' <td>(?<bidcls>[^<]*)</td>' . ' <td>(?<succls>[^<]*)</td>' . ' <td>(?<constdt>[^<]*)</td>' . ' <td>(?<bidproc>[^<]*)</td>' . ' </tr>#i';
             $p = str_replace(' ', '\\s*', $p);
             if (preg_match_all($p, $html, $matches, PREG_SET_ORDER)) {
                 foreach ($matches as $m) {
                     $data = ['status' => trim($m['status']), 'notinum' => trim($m['notinum']), 'constno' => trim($m['constno']), 'constnm' => trim($m['constnm']), 'org' => trim($m['org']), 'contract' => trim($m['contract']), 'bidcls' => trim($m['bidcls']), 'succls' => trim($m['succls']), 'constdt' => trim($m['constdt']), 'bidproc' => trim($m['bidproc'])];
                     $event = new WatchEvent();
                     $event->row = $data;
                     $this->trigger(WatchEvent::EVENT_ROW, $event);
                 }
             }
             \d2b\Http::sleep();
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 3
0
 public function watch()
 {
     $this->params = ['pageNo' => 1, 'startPageNo' => 1, 'pagePerRow' => 10, 'selDateDivs' => 0, 'txtBidxDateFrom' => date('Y/m/d', strtotime('-7 day')), 'txtBidxDateTo' => date('Y/m/d')];
     try {
         $html = $this->http->post(static::URL, ['form_params' => $this->params]);
         $html = static::strip_tags($html);
         if (preg_match('/전체 페이지 : (?<total_page>\\d+)/i', $html, $m)) {
             $total_page = $m['total_page'];
         }
         if (!$total_page) {
             throw new \Exception('Empty total_page');
         }
         for ($page = 1; $page <= $total_page; $page++) {
             if ($page > 1) {
                 $this->params['pageNo'] = $page;
                 $html = $this->http->post(static::URL, ['form_params' => $this->params]);
                 $html = static::strip_tags($html);
             }
             $p = '#<tr>' . ' <td>\\d+</td>' . ' <td>(?<noticedt>[^<]*)</td>' . ' <td>(?<status>[^A-Z]*)(?<notinum>[0-9A-Z]{7}-\\d{1})<br />(?<g2bno>[^<]*)</td>' . ' <td>(?<constno>[^<]*)</td>' . ' <td>(?<constnm>[^<]*)</td>' . ' <td>(?<org>[^<]*)</td>' . ' <td>(?<registdt>.*) <br />(?<closedt>.*)<br />(?<constdt>[^<]*)</td>' . ' <td>(?<contract>[^<]*)<br />[^<]*</td>' . ' <td>(?<basic>[^<]*)' . ' <input type="hidden" name="hidOrdrYear" value="(?<hidOrdrYear>[^>]*)" />' . ' <input type="hidden" name="hidDprtCode" value="(?<hidDprtCode>[^>]*)" />' . ' <input type="hidden" name="hidCsrtNumb" value="(?<hidCsrtNumb>[^>]*)" />' . ' <input type="hidden" name="hidBidxDate" value="(?<hidBidxDate>[^>]*)" />' . ' <input type="hidden" name="hidAnmtDivs" value="(?<hidAnmtDivs>[^>]*)" />' . ' <input type="hidden" name="hidAnmtNumb" value="(?<hidAnmtNumb>[^>]*)" />' . ' <input type="hidden" name="hidRqstDegr" value="(?<hidRqstDegr>[^>]*)" />' . ' <input type="hidden" name="hidDcsnNumb" value="(?<hidDcsnNumb>[^>]*)" />' . '( <input[^>]*>)*' . ' </td> </tr>#i';
             $p = str_replace(' ', '\\s*', $p);
             if (preg_match_all($p, $html, $matches, PREG_SET_ORDER)) {
                 foreach ($matches as $m) {
                     $data = ['noticedt' => trim($m['noticedt']), 'status' => trim($m['status']), 'notinum' => trim($m['notinum']), 'g2bno' => trim($m['g2bno']), 'constno' => trim($m['constno']), 'constnm' => trim($m['constnm']), 'org' => trim($m['org']), 'registdt' => trim($m['registdt']), 'closedt' => trim($m['closedt']), 'constdt' => trim($m['constdt']), 'contract' => trim($m['contract']), 'basic' => trim($m['basic']), 'hidOrdrYear' => trim($m['hidOrdrYear']), 'hidDprtCode' => trim($m['hidDprtCode']), 'hidCsrtNumb' => trim($m['hidCsrtNumb']), 'hidBidxDate' => trim($m['hidBidxDate']), 'hidAnmtDivs' => trim($m['hidAnmtDivs']), 'hidAnmtNumb' => trim($m['hidAnmtNumb']), 'hidRqstDegr' => trim($m['hidRqstDegr']), 'hidDcsnNumb' => trim($m['hidDcsnNumb'])];
                     $event = new WatchEvent();
                     $event->row = $data;
                     $this->trigger(WatchEvent::EVENT_ROW, $event);
                 }
             }
             \d2b\Http::sleep();
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
 public function watch()
 {
     $this->params = ['pageNo' => 1, 'startPageNo' => 1, 'pagePerRow' => 10, 'txtNegoDateFrom' => date('Y/m/d', strtotime('-7 day')), 'txtNegoDateTo' => date('Y/m/d')];
     try {
         $html = $this->http->post(static::URL, ['form_params' => $this->params]);
         $html = static::strip_tags($html);
         if (preg_match('/전체 페이지 : (?<total_page>\\d+)/i', $html, $m)) {
             $total_page = $m['total_page'];
         }
         if (!$total_page) {
             throw new \Exception('Empty total_page');
         }
         for ($page = 1; $page <= $total_page; $page++) {
             if ($page > 1) {
                 $this->params['pageNo'] = $page;
                 $html = $this->http->post(static::URL, ['form_params' => $this->params]);
                 $html = static::strip_tags($html);
             }
             $p = '#<tr>' . ' <td>(?<constdt>[^<]*)</td>' . ' <td>(?<constno>[^<]*)</td>' . ' <td>[^<]*</td>' . ' <td>(?<degree>[^<]*)</td>' . ' <td> <a[^>]*submitForm\\(\'(?<link>[^\\)]+)\'[^>]*>(?<constnm>[^<]*)</a> </td>' . ' <td>(?<org>[^<]*)</td>' . ' <td>(?<budget>[^<]*)</td>' . ' <td>(?<bidcls>[^<]*)</td>' . ' <td>(?<bidproc>[^<]*)</td>' . ' </tr>#i';
             $p = str_replace(' ', '\\s*', $p);
             if (preg_match_all($p, $html, $matches, PREG_SET_ORDER)) {
                 foreach ($matches as $m) {
                     $link = preg_replace('/\\s*/', '', $m['link']);
                     $links = explode("','", $link);
                     $data = ['constno' => trim($m['constno']), 'degree' => trim($m['degree']), 'constnm' => trim($m['constnm']), 'org' => trim($m['org']), 'budget' => trim($m['budget']), 'bidcls' => trim($m['bidcls']), 'constdt' => trim($m['constdt']), 'bidproc' => trim($m['bidproc']), 'numb' => $links[0], 'hidOrdrYear' => $links[1], 'hidDcsnNumb' => $links[2], 'hidDprtCode' => $links[3], 'hidNegnPldt' => $links[4], 'hidNegnDegr' => $links[5], 'hidDmstItnb' => $links[6], 'hidAnmtNumb' => $links[7], 'hidBidxMthd' => $links[8], 'hidOrdrAmnt' => $links[9], 'action' => $links[10]];
                     $event = new WatchEvent();
                     $event->row = $data;
                     $this->trigger(WatchEvent::EVENT_ROW, $event);
                 }
             }
             \d2b\Http::sleep();
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 5
0
 public function actionSuc()
 {
     $peb = new HI_PEB_BidResult_Lst();
     $peb->on(WatchEvent::EVENT_ROW, [$this, 'onSucPebRow']);
     $peb2 = new HI_PEB_OpenNegoResult_Lst();
     $peb2->on(WatchEvent::EVENT_ROW, [$this, 'onSucPebRow2']);
     $pdb = new HI_PDB_BidResult_Lst();
     $pdb->on(WatchEvent::EVENT_ROW, [$this, 'onSucPdbRow']);
     $pdb2 = new HI_PDB_OpenNegoResult_Lst();
     $pdb2->on(WatchEvent::EVENT_ROW, [$this, 'onSucPdb2Row']);
     while (true) {
         try {
             $this->stdout("==시설공사 경쟁입찰 결과==\n", Console::FG_YELLOW);
             $peb->watch();
             $this->stdout("==시설공사 공개수의협상 결과==\n", Console::FG_YELLOW);
             $peb2->watch();
             $this->stdout("==국내조달 경쟁입찰 결과==\n", Console::FG_YELLOW);
             $pdb->watch();
             $this->stdout("==국내조달 공개수의협상 결과==\n", Console::FG_YELLOW);
             $pdb2->watch();
         } catch (\Exception $e) {
             $this->stdout($e . PHP_EOL, Console::FG_RED);
             \Yii::error($e, 'd2b');
         }
         $this->stdout(sprintf("[%s] Peak memory usage: %s MB\n", date('Y-m-d H:i:s'), memory_get_peak_usage(true) / 1024 / 1024), Console::FG_GREY);
         \d2b\Http::sleep();
     }
 }