Browse Source

查看抓取结果

pull/49/head
pengda 5 days ago
parent
commit
2e47c81370
  1. 20
      control/weibo.php
  2. 9
      model/mWeiboBehavior.php

20
control/weibo.php

@ -85,6 +85,26 @@ class weibo extends publicBase {
$this->ajax_json(true, '保存成功');
}
public function ajax_get_spider_list() {
$date = trim($this->post('date'));
$cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1;
$page_size = $this->post('pageSize') ? $this->post('pageSize') : 20;
$obj = new mWeiboBehavior();
$list = $obj->getSpiderBehavior($date, $cur_page, $page_size);
$total = $obj->getSpiderBehaviorTotal($date);
$rdata = array(
'total' => $total,
'per_page' => $page_size,
'last_page' => ceil($total / $page_size),
'cur_page' => $cur_page,
'list' => $list,
);
$this->ajax_json(true, '获取成功', $rdata);
}
public function ajax_hot_list() {
$type = $this->post('type') + 0;
$sdate = trim($this->post('sdate'));

9
model/mWeiboBehavior.php

@ -36,6 +36,15 @@ class mWeiboBehavior extends mBase {
return $this->obj->delete($this->tbl_delta, array('sql' => "`date`<?", 'vals' => array($date)));
}
public function getSpiderBehavior($date, $page_num, $page_size) {
$offset = ($page_num - 1) * $page_size;
return $this->obj->selectAll($this->tbl_data, array('sql' => "`date`=?", 'vals' => array($date)), 'created_at desc', array($offset, $page_size));
}
public function getSpiderBehaviorTotal($date) {
return $this->obj->count($this->tbl_data, array('sql' => "`date`=?", 'vals' => array($date)));
}
public function getHotBehavior($type, $sdate, $edate, $page_num, $page_size) {
$offset = ($page_num - 1) * $page_size;

Loading…
Cancel
Save