12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- include_once 'top/ResultSet.php';
- include_once 'top/TopLogger.php';
- include_once 'top/RequestCheckUtil.php';
- include_once 'top/TopClient.php';
- include_once 'top/request/TbkItemInfoGetRequest.php';
- include_once 'top/request/TbkDgMaterialOptionalRequest.php';
-
- class TBK{
- private static $appkey = '23260528';
- private static $secret = '842fc308fb5f95b1250581f664cdcde8';
- public function __Construct(){
- }
- public static function tbkItemInfoGet( $params ){
- try{
- $c = new TopClient;
- $c->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;
- }
- }
-
- }
|