Client.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\extra\douyin;
  3. use yzh52521\EasyHttp\Http;
  4. class Client extends Base
  5. {
  6. /**
  7. * 设置小程序跳转path
  8. * @param string $account
  9. * @return array
  10. */
  11. public function setMiniPath(string $account = "",string $order = ""): array
  12. {
  13. $param = [
  14. "account_id" => $account,
  15. "bind_biz_type" => 0,
  16. "path_data_list" => [
  17. [
  18. "path" => "pages/order/detail",
  19. "path_type" => 1
  20. ],
  21. [
  22. "path" => "pages/order/detail",
  23. "path_type" => 2
  24. ],
  25. [
  26. "path" => "pages/order/detail",
  27. "path_type" => 3
  28. ]
  29. ]
  30. ];
  31. return Http::asJson()->withHeaders($this->header)->post($this->gateway."api/apps/trade/v2/toolkit/update_merchant_path/", $param)->array();
  32. }
  33. /**
  34. * 查下用户订单
  35. * @param string $account
  36. * @param string $openId
  37. * @return array
  38. */
  39. public function queryOrder(string $account = "",string $openId = ""): array
  40. {
  41. $param = [
  42. "account_id" => $account,
  43. "open_id" => $openId,
  44. "biz_type" => 1,
  45. "time_range" => [
  46. "start_time" => strtotime("-2 day"),
  47. "end_time" => time()
  48. ]
  49. ];
  50. return Http::asJson()->withHeaders($this->header)->post($this->gateway."api/trade/v2/fulfillment/query_user_certificates/", $param)->array();
  51. }
  52. /**
  53. * 查询订单可用门店
  54. * @param string $orderId
  55. * @return array
  56. */
  57. public function queryOrderStore(string $orderId = ""): array
  58. {
  59. $param = [
  60. "order_id" => $orderId
  61. ];
  62. return Http::asJson()->withHeaders($this->header)->post($this->gateway."api/trade/v2/fulfillment/order_can_use/", $param)->array();
  63. }
  64. /**
  65. * 查询商家配置文案
  66. * @return array
  67. */
  68. public function getBtnText(): array
  69. {
  70. return Http::asJson()->withHeaders($this->header)->post($this->gateway."api/apps/trade/v2/toolkit/query_text/", ["text_type" => 0])->array();
  71. }
  72. /**
  73. * 设置商家配置文案
  74. * @param string $account
  75. * @return array
  76. */
  77. public function setBtnText(string $account = ""): array
  78. {
  79. $param = [
  80. "account_id" => $account,
  81. "bind_biz_type" => 0,
  82. "delivery_app_info" => [
  83. "button_text_id" => "te7252216917182660619",
  84. "display_mode" => 2,
  85. "guidance_text_id"=>"te7249212519187791884"
  86. ]
  87. ];
  88. return Http::asJson()->withHeaders($this->header)->post($this->gateway."api/apps/trade/v2/toolkit/update_merchant_conf/", $param)->array();
  89. }
  90. }