优惠券订单及其他脚本

TBK.class.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. include_once 'top/ResultSet.php';
  3. include_once 'top/TopLogger.php';
  4. include_once 'top/RequestCheckUtil.php';
  5. include_once 'top/TopClient.php';
  6. include_once 'top/request/TbkItemInfoGetRequest.php';
  7. include_once 'top/request/TbkDgMaterialOptionalRequest.php';
  8. class TBK{
  9. private static $appkey = '23260528';
  10. private static $secret = '842fc308fb5f95b1250581f664cdcde8';
  11. public function __Construct(){
  12. }
  13. public static function tbkItemInfoGet( $params ){
  14. try{
  15. $c = new TopClient;
  16. $c->appkey = self::$appkey;
  17. $c->secretKey = self::$secret;
  18. $req = new TbkItemInfoGetRequest;
  19. $req->setNumIids((string)$params['goods_id']);
  20. $req->setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
  21. $req->setPlatform("2");
  22. $resp = $c->execute($req);
  23. if(!isset($resp->code)) {
  24. $goods = $resp->results->n_tbk_item[0];
  25. return $goods;
  26. }else{
  27. return false;
  28. }
  29. }
  30. catch(Exception $e){
  31. return false;
  32. }
  33. }
  34. public static function search($keyword){
  35. try{
  36. $c = new TopClient;
  37. $c->appkey = self::$appkey;
  38. $c->secretKey = self::$secret;
  39. $req = new TbkDgMaterialOptionalRequest;
  40. $req->setStartDsr("10");
  41. $req->setPageSize("1");
  42. $req->setPageNo("1");
  43. $req->setPlatform("2");
  44. $req->setStartPrice("1");
  45. $req->setQ($keyword);
  46. $req->setAdzoneId('40352826');
  47. $req->setHasCoupon("false");
  48. $resp = $c->execute($req);
  49. if(!isset($resp->code)) {
  50. $data = $resp->result_list->map_data;
  51. return $data[0];
  52. }
  53. 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);
  54. return false;
  55. }
  56. catch(Exception $e){
  57. return false;
  58. }
  59. }
  60. }