appkey = self::$appkey; $c->secretKey = self::$secret; $req = new TbkItemInfoGetRequest; $req->setNumIids((string)$params['goods_id']); $req->setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url"); $req->setPlatform("2"); $resp = $c->execute($req); if(!isset($resp->code)) { $goods = $resp->results->n_tbk_item[0]; return $goods; }else{ return false; } } catch(Exception $e){ return false; } } public static function search($keyword){ try{ $c = new TopClient; $c->appkey = self::$appkey; $c->secretKey = self::$secret; $req = new TbkDgMaterialOptionalRequest; $req->setStartDsr("10"); $req->setPageSize("1"); $req->setPageNo("1"); $req->setPlatform("2"); $req->setStartPrice("1"); $req->setQ($keyword); $req->setAdzoneId('40352826'); $req->setHasCoupon("false"); $resp = $c->execute($req); if(!isset($resp->code)) { $data = $resp->result_list->map_data; return $data[0]; } file_put_contents('scan_orderv4.log', date('Y-m-d H:i:s') . " " . "[". $keyword . json_encode($resp, JSON_UNESCAPED_UNICODE) ."【search】". "\r\n", FILE_APPEND); return false; } catch(Exception $e){ return false; } } }