public function index() { if (IS_POST) { $q = I('q'); $cid = I('cid'); $sort = I('sort'); $startTkRate = I("start_tk_rate"); $endTkRate = I("end_tk_rate"); $startPrice = I('start_price'); $endPrice = I('end_price'); $isTmall = I('is_tmall') > 0 ? true : false; $pageSize = I('num') ? I('num') : 30; $cateId = I('cate_id') ? intval(I('cate_id')) : 0; $taobao = new TopApi(C('APP_KEY'), C('APP_SECRET')); $result = $taobao->getItem($q, $cid, $isTmall, $startPrice, $endPrice, $startTkRate, $endTkRate, $sort, 1, $pageSize); $CollectGoodsModel = new CollectGoodsModel(); if (is_array($result)) { foreach ($result as $k => $v) { $result[$k]['cate_id'] = $cateId; if ($CollectGoodsModel->create($result[$k])) { $result[$k]['id'] = $CollectGoodsModel->add(); } } $this->assign('_list', $result); $this->display('collect'); } } else { $category = D('CategoryGoods')->getGoodsCategory(); $this->assign('category', $category); $this->display(); } }
public function getTbkItem() { $taobao = new TopApi(C('APP_KEY'), C('APP_SECRET')); $result = $taobao->getItem("女装"); }