post('status') + 0; $cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1; $page_size = $this->post('pageSize') ? $this->post('pageSize') : 20; $condition = array(); $condition['status'] = $status; $obj = new mWeibo(); $total = $obj->getWeiboTotal($condition); $list = $obj->getWeiboList($condition, $cur_page, $page_size); $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_weibo_detail() { $id = $this->post('id') + 0; $obj = new mWeibo(); $data = $obj->getWeiboDetailById($id); $this->ajax_json(true, '获取成功', $data); } public function ajax_set_weibo_status() { $id = $this->post('id') + 0; if (!$id) $this->ajax_json(true, '参数错误'); $status = $this->post('status') + 0; $obj = new mWeibo(); $data = $obj->updateWeibo($id, array('status' => $status)); $this->ajax_json(true, '设置成功', $data); } public function ajax_edit_weibo() { $id = trim($this->post('id')); $text = trim($this->post('answer')); $refer = trim($this->post('desc')); $status = $this->post('status') + 0; if ($id) { $obj = new mWeibo(); $res = $obj->updateWeibo($id, array('text' => $text, 'refer' => $refer, 'status' => $status)); if (!$res) $this->ajax_json(false, '保存失败'); $this->ajax_json(true, '保存成功'); } $data = array( 'uid' => '1', 'text' => $text, 'refer' => $refer, 'pic_ids' => '', 'video_url' => '', 'video_cover' => '', 'created_at' => date('Y-m-d H:i:s', time()), 'status' => $status, ); $obj = new mWeibo(); $res = $obj->addWeibo($data); if (!$res) $this->ajax_json(false, '保存失败'); $this->ajax_json(true, '保存成功'); } public function ajax_hot_list() { $type = $this->post('type') + 0; $sdate = trim($this->post('sdate')); $edate = trim($this->post('edate')); $cur_page = $this->post('currentPage') ? $this->post('currentPage') : 1; $page_size = $this->post('pageSize') ? $this->post('pageSize') : 20; $obj = new mWeiboBehavior(); $list = $obj->getHotBehavior($type, $sdate, $edate, $cur_page, $page_size); $total = $obj->getHotBehaviorTotal($sdate, $edate); $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); } }