|
|
@ -36,13 +36,24 @@ 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) { |
|
|
|
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; |
|
|
|
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) { |
|
|
|
return $this->obj->count($this->tbl_data, array('sql' => "`date`=?", 'vals' => array($date))); |
|
|
|
public function getSpiderBehaviorTotal($date, $uid) { |
|
|
|
$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) { |
|
|
@ -75,11 +86,11 @@ class mWeiboBehavior extends mBase { |
|
|
|
$weibo_list = array_column($weibos, null, 'wid'); |
|
|
|
|
|
|
|
$weibo_user = $GLOBALS['WEIBO_USER_LIST']; |
|
|
|
foreach ($res as &$re){ |
|
|
|
foreach ($res as &$re) { |
|
|
|
$weibo = isset($weibo_list[$re['wid']]) ? $weibo_list[$re['wid']] : array(); |
|
|
|
|
|
|
|
$re['uname'] = empty($weibo)? $weibo_user[WEIBO_USER_ZHANG] : $weibo_user[$weibo['uid']]; |
|
|
|
$re['title'] = empty($weibo)? '无文字展示' : $weibo['text']; |
|
|
|
$re['uname'] = empty($weibo) ? $weibo_user[WEIBO_USER_ZHANG] : $weibo_user[$weibo['uid']]; |
|
|
|
$re['title'] = empty($weibo) ? '无文字展示' : $weibo['text']; |
|
|
|
$re['url'] = sprintf(WEIBO_DETAIL_URL, $re['wid']); |
|
|
|
} |
|
|
|
return $res; |
|
|
|