ByteDanceQueryOrder.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\service\byte_dance;
  3. class ByteDanceQueryOrder implements ByteDanceInterface {
  4. protected $orderNo;
  5. /**
  6. * @param array $body
  7. */
  8. public function setOrderNo($body)
  9. {
  10. $this->orderNo = $body;
  11. return $this;
  12. }
  13. public function get()
  14. {
  15. $params=[
  16. 'app_id'=>ByteDance::appId(),
  17. 'out_order_no'=>$this->orderNo,
  18. ];
  19. $params['sign']=ByteDance::sign($params);
  20. $data=ByteDance::httpPost('https://developer.toutiao.com/api/apps/ecpay/v1/query_order',$params,[],false);
  21. user_log('dyQueryOrderPayed',['orderNo'=>$this->orderNo,'data'=>$data]);
  22. return $data['err_no']===0;
  23. }
  24. public function getWangKa()
  25. {
  26. $params=[
  27. 'app_id'=>ByteDance::appIdTwo(),
  28. 'out_order_no'=>$this->orderNo,
  29. ];
  30. $params['sign']=ByteDance::signWangKa($params);
  31. $data=ByteDance::httpPost('https://developer.toutiao.com/api/apps/ecpay/v1/query_order',$params,[],false);
  32. user_log('dyQueryOrderPayed',['orderNo'=>$this->orderNo,'data'=>$data]);
  33. return $data['err_no']===0;
  34. }
  35. public function getHaoYuan()
  36. {
  37. $params=[
  38. 'app_id'=>ByteDance::appIdThree(),
  39. 'out_order_no'=>$this->orderNo,
  40. ];
  41. $params['sign']=ByteDance::signHaoYuan($params);
  42. $data=ByteDance::httpPost('https://developer.toutiao.com/api/apps/ecpay/v1/query_order',$params,[],false);
  43. user_log('dyQueryOrderPayed',['orderNo'=>$this->orderNo,'data'=>$data]);
  44. return $data['err_no']===0;
  45. }
  46. }