示例#1
0
文件: index.php 项目: limi58/fetchJD
set_time_limit(60);
include '../App.php';
include './Trends.php';
$id = $_POST['class'];
$url = $_POST['url'];
if ($_POST['count']) {
    $count = $_POST['count'];
} else {
    $count = 60;
}
if ($_POST['page']) {
    $page = $_POST['page'];
} else {
    $page = 5;
}
$trends = new Trends($count);
/**
 * dev mode
 */
if ($_GET['type'] === 'dev') {
    dump($trends->getIdsByUrl('http://list.jd.com/list.html?cat=9987%2C653%2C655&delivery=0&page=1&JL=4_10_0', 5));
    exit;
}
if ($id !== NULL) {
    echo json_encode(['skus' => $trends->getIds($id)]);
} else {
    if ($url !== NULL) {
        echo json_encode(['skus' => $trends->getIdsByUrl($url, $page)]);
    }
}
示例#2
0
 /**
  *  赞
  */
 public function actionPraise()
 {
     if (!isset($_POST['uid']) || !$_POST['uid']) {
         $this->_exit($this->_error['20007'], '20007');
     }
     if (!isset($_POST['tid']) || !$_POST['tid']) {
         $this->_exit($this->_error['20057'], '20057');
     }
     $uid = trim($_POST['uid']);
     $tid = trim($_POST['tid']);
     $nickname = UserInfo::model()->getNickname($uid);
     $res = Trends::model()->addPraise($tid, $uid);
     if ($res) {
         $this->_exit($this->_error['20000'], '20000', $nickname, 'nickname');
     }
     $this->_exit($this->_error['20059'], '20059');
 }
示例#3
0
 /**
  * 删除动态
  */
 public function actionDeleteTrends()
 {
     if (!isset($_POST['uid']) || !$_POST['uid']) {
         $this->_exit($this->_error['20007'], '20007');
     }
     if (!isset($_POST['tid']) || !$_POST['tid']) {
         $this->_exit($this->_error['20057'], '20057');
     }
     $uid = trim($_POST['uid']);
     $tid = trim($_POST['tid']);
     $res = Trends::model()->deleteTrends($uid, $tid);
     if ($res) {
         $this->_exit($this->_error['20000'], '20000');
     }
     $this->_exit($this->_error['21000'], '21000');
 }