ProductClient.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace EasyWeChat\MiniProgram\Mall;
  11. use EasyWeChat\Kernel\BaseClient;
  12. /**
  13. * Class Client.
  14. *
  15. * @author mingyoung <mingyoungcheung@gmail.com>
  16. */
  17. class ProductClient extends BaseClient
  18. {
  19. /**
  20. * 更新或导入物品信息.
  21. *
  22. * @param array $params
  23. * @param bool $isTest
  24. *
  25. * @return mixed
  26. *
  27. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  28. * @throws \GuzzleHttp\Exception\GuzzleException
  29. */
  30. public function import($params, $isTest = false)
  31. {
  32. return $this->httpPostJson('mall/importproduct', $params, ['is_test' => (int) $isTest]);
  33. }
  34. /**
  35. * 查询物品信息.
  36. *
  37. * @param array $params
  38. *
  39. * @return mixed
  40. *
  41. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  42. * @throws \GuzzleHttp\Exception\GuzzleException
  43. */
  44. public function query($params)
  45. {
  46. return $this->httpPostJson('mall/queryproduct', $params, ['type' => 'batchquery']);
  47. }
  48. /**
  49. * 小程序的物品是否可被搜索.
  50. *
  51. * @param bool $value
  52. *
  53. * @return mixed
  54. *
  55. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  56. * @throws \GuzzleHttp\Exception\GuzzleException
  57. */
  58. public function setSearchable($value)
  59. {
  60. return $this->httpPostJson('mall/brandmanage', ['can_be_search' => $value], ['action' => 'set_biz_can_be_search']);
  61. }
  62. }