GroupApi.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace wechat\models;
  3. use Yii;
  4. class GroupApi extends BaseApi
  5. {
  6. public $apiUrl = 'group';
  7. /**
  8. * @param array $data
  9. * @return array
  10. */
  11. public function getList($data)
  12. {
  13. $result = $this->post($this->apiUrl . '/list', $data);
  14. if ($result['code'] == 1) {
  15. return $this->returnArray(1, $result['data'], $result['message']);
  16. } else {
  17. return $this->returnArray(0, [], $result['message']);
  18. }
  19. }
  20. /**
  21. * @param array $data
  22. * @return array
  23. */
  24. public function getCurrentGroup($data)
  25. {
  26. $result = $this->post($this->apiUrl . '/get-current-group', $data);
  27. if ($result['code'] == 1) {
  28. return $this->returnArray(1, $result['data'], $result['message']);
  29. } else {
  30. return $this->returnArray(0, [], $result['message']);
  31. }
  32. }
  33. /**
  34. * @param array $data
  35. * @return array
  36. */
  37. public function save($data)
  38. {
  39. $result = $this->post($this->apiUrl . '/save', $data);
  40. if ($result['code'] == 1) {
  41. return $this->returnArray(1, $result['data'], $result['message']);
  42. } else {
  43. return $this->returnArray(0, [], $result['message']);
  44. }
  45. }
  46. /**
  47. * @param array $data
  48. * @return array
  49. */
  50. public function getGroupById($data)
  51. {
  52. $result = $this->post($this->apiUrl . '/get-group-by-id', $data);
  53. if ($result['code'] == 1) {
  54. return $this->returnArray(1, $result['data'], $result['message']);
  55. } else {
  56. return $this->returnArray(0, [], $result['message']);
  57. }
  58. }
  59. /**
  60. * @param array $data
  61. * @return array
  62. */
  63. public function deleteGroup($data)
  64. {
  65. $result = $this->post($this->apiUrl . '/delete', $data);
  66. if ($result['code'] == 1) {
  67. return $this->returnArray(1, $result['data'], $result['message']);
  68. } else {
  69. return $this->returnArray(0, [], $result['message']);
  70. }
  71. }
  72. }