Department.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace WeWork\Api;
  3. use WeWork\Traits\HttpClientTrait;
  4. class Department
  5. {
  6. use HttpClientTrait;
  7. /**
  8. * 创建部门
  9. *
  10. * @param array $json
  11. * @return array
  12. */
  13. public function create(array $json): array
  14. {
  15. return $this->httpClient->postJson('department/create', $json);
  16. }
  17. /**
  18. * 更新部门
  19. *
  20. * @param array $json
  21. * @return array
  22. */
  23. public function update(array $json): array
  24. {
  25. return $this->httpClient->postJson('department/update', $json);
  26. }
  27. /**
  28. * 删除部门
  29. *
  30. * @param int $id
  31. * @return array
  32. */
  33. public function delete(int $id): array
  34. {
  35. return $this->httpClient->get('department/delete', compact('id'));
  36. }
  37. /**
  38. * 获取部门列表
  39. *
  40. * @param int $id
  41. * @return array
  42. */
  43. public function list(int $id = 0): array
  44. {
  45. return $this->httpClient->get('department/list', $id > 0 ? compact('id') : []);
  46. }
  47. }