Browse Source

Merge pull request '查看抓取结果' (#50) from wpd_get2 into master

Reviewed-on: #50
pull/52/head
pengda 1 week ago
parent
commit
9e73bc8129
  1. 5
      control/weibo.php
  2. 19
      model/mWeiboBehavior.php

5
control/weibo.php

@ -87,12 +87,13 @@ class weibo extends publicBase {
public function ajax_get_spider_list() { public function ajax_get_spider_list() {
$date = trim($this->post('date')); $date = trim($this->post('date'));
$uid = trim($this->post('uid'));
$cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1; $cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1;
$page_size = $this->post('pageSize') ? $this->post('pageSize') : 20; $page_size = $this->post('pageSize') ? $this->post('pageSize') : 20;
$obj = new mWeiboBehavior(); $obj = new mWeiboBehavior();
$list = $obj->getSpiderBehavior($date, $cur_page, $page_size); $list = $obj->getSpiderBehavior($date, $uid, $cur_page, $page_size);
$total = $obj->getSpiderBehaviorTotal($date); $total = $obj->getSpiderBehaviorTotal($date, $uid);
$rdata = array( $rdata = array(
'total' => $total, 'total' => $total,

19
model/mWeiboBehavior.php

@ -36,13 +36,24 @@ class mWeiboBehavior extends mBase {
return $this->obj->delete($this->tbl_delta, array('sql' => "`date`<?", 'vals' => array($date))); return $this->obj->delete($this->tbl_delta, array('sql' => "`date`<?", 'vals' => array($date)));
} }
public function getSpiderBehavior($date, $page_num, $page_size) { public function getSpiderBehavior($date, $uid, $page_num, $page_size) {
$where = array('sql' => "`date`=?", 'vals' => array($date));
if ($uid > 0) {
$where['sql'] .= " AND `uid`=?";
$where['vals'][] = $uid;
}
$offset = ($page_num - 1) * $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));
return $this->obj->selectAll($this->tbl_data, $where, 'created_at desc', array($offset, $page_size));
} }
public function getSpiderBehaviorTotal($date) { public function getSpiderBehaviorTotal($date, $uid) {
return $this->obj->count($this->tbl_data, array('sql' => "`date`=?", 'vals' => array($date))); $where = array('sql' => "`date`=?", 'vals' => array($date));
if ($uid > 0) {
$where['sql'] .= " AND `uid`=?";
$where['vals'][] = $uid;
}
return $this->obj->count($this->tbl_data, $where);
} }
public function getHotBehavior($type, $sdate, $edate, $page_num, $page_size) { public function getHotBehavior($type, $sdate, $edate, $page_num, $page_size) {

Loading…
Cancel
Save