GiftCardPageClient.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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\OfficialAccount\Card;
  11. use EasyWeChat\Kernel\BaseClient;
  12. /**
  13. * Class GiftCardPageClient.
  14. *
  15. * @author overtrue <i@overtrue.me>
  16. */
  17. class GiftCardPageClient extends BaseClient
  18. {
  19. /**
  20. * 创建-礼品卡货架接口.
  21. *
  22. * @return mixed
  23. */
  24. public function add(array $attributes)
  25. {
  26. $params = [
  27. 'page' => $attributes,
  28. ];
  29. return $this->httpPostJson('card/giftcard/page/add', $params);
  30. }
  31. /**
  32. * 查询-礼品卡货架信息接口.
  33. *
  34. * @return mixed
  35. */
  36. public function get(string $pageId)
  37. {
  38. $params = [
  39. 'page_id' => $pageId,
  40. ];
  41. return $this->httpPostJson('card/giftcard/page/get', $params);
  42. }
  43. /**
  44. * 修改-礼品卡货架信息接口.
  45. *
  46. * @return mixed
  47. */
  48. public function update(string $pageId, string $bannerPicUrl, array $themeList)
  49. {
  50. $params = [
  51. 'page' => [
  52. 'page_id' => $pageId,
  53. 'banner_pic_url' => $bannerPicUrl,
  54. 'theme_list' => $themeList,
  55. ],
  56. ];
  57. return $this->httpPostJson('card/giftcard/page/update', $params);
  58. }
  59. /**
  60. * 查询-礼品卡货架列表接口.
  61. *
  62. * @return mixed
  63. */
  64. public function list()
  65. {
  66. return $this->httpPostJson('card/giftcard/page/batchget');
  67. }
  68. /**
  69. * 下架-礼品卡货架接口(下架某一个货架或者全部货架).
  70. *
  71. * @return mixed
  72. */
  73. public function setMaintain(string $pageId = '')
  74. {
  75. $params = ($pageId ? ['page_id' => $pageId] : ['all' => true]) + [
  76. 'maintain' => true,
  77. ];
  78. return $this->httpPostJson('card/giftcard/maintain/set', $params);
  79. }
  80. }