NoticeApi.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: chenkuan
  5. * Date: 2017/11/6
  6. * Time: 上午10:15
  7. */
  8. namespace backend\models;
  9. class NoticeApi extends BaseApi
  10. {
  11. public $apiUrl = 'notice';
  12. public function getNoticeList($data = [])
  13. {
  14. $result = $this->get($this->apiUrl.'/index', $data);
  15. if ($result['code'] == 1) {
  16. return $this->returnArray(1, $result['data'], '获取公告记录成功');
  17. } else {
  18. return $this->returnArray(0, [], '获取公告记录失败');
  19. }
  20. }
  21. public function findNotReadCount($member_id = '', $type)
  22. {
  23. $result = $this->get($this->apiUrl.'/not-read-count', [
  24. 'member_id' => $member_id,
  25. 'type' => $type,
  26. ]);
  27. if ($result['code'] == 1) {
  28. return $this->returnArray(1, $result['data'], '获取未读数成功');
  29. } else {
  30. return $this->returnArray(0, [], '获取未读数失败');
  31. }
  32. }
  33. public function view($data = [])
  34. {
  35. $result = $this->get($this->apiUrl.'/view', $data);
  36. if ($result['code'] == 1) {
  37. return $this->returnArray(1, $result['data'], '获取详情成功');
  38. } else {
  39. return $this->returnArray(0, [], '获取详情失败');
  40. }
  41. }
  42. public function getHelpList($member_id = '', $type)
  43. {
  44. $result = $this->get($this->apiUrl.'/get-help-list', [
  45. 'member_id' => $member_id,
  46. 'type' => $type,
  47. ]);
  48. if ($result['code'] == 1) {
  49. return $this->returnArray(1, $result['data'], '获取常见问题成功');
  50. } else {
  51. return $this->returnArray(0, [], '获取常见问题失败');
  52. }
  53. }
  54. public function saveNotice($data = [])
  55. {
  56. $result = $this->post($this->apiUrl.'/create', $data);
  57. if ($result['code'] == 1) {
  58. return $this->returnArray(1, $result['data'], '保存成功');
  59. } else {
  60. return $this->returnArray(0, [], '保存失败');
  61. }
  62. }
  63. public function updateNotice($data = [])
  64. {
  65. $result = $this->post($this->apiUrl.'/update', $data);
  66. if ($result['code'] == 1) {
  67. return $this->returnArray(1, $result['data'], '更新成功');
  68. } else {
  69. return $this->returnArray(0, [], '更新失败');
  70. }
  71. }
  72. public function deleteNotice($data = [])
  73. {
  74. $result = $this->post($this->apiUrl.'/delete', $data);
  75. if ($result['code'] == 1) {
  76. return $this->returnArray(1, $result['data'], '删除成功');
  77. } else {
  78. return $this->returnArray(0, [], '删除失败');
  79. }
  80. }
  81. }