Driver.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace addons\baidupush\library\push;
  3. /**
  4. * Push基础类
  5. */
  6. abstract class Driver
  7. {
  8. protected $options = [];
  9. protected $error = '';
  10. protected $data = [
  11. "remain" => 0,
  12. "success" => 0,
  13. "not_same_site" => [],
  14. "not_valid" => []
  15. ];
  16. /**
  17. * 推送实时链接
  18. * @param array $urls URL链接数组
  19. * @return bool
  20. */
  21. abstract public function realtime($urls);
  22. /**
  23. * 推送历史链接
  24. * @param array $urls URL链接数组
  25. * @return bool
  26. */
  27. abstract public function history($urls);
  28. /**
  29. * 删除链接
  30. * @param array $urls URL链接数组
  31. * @return boolean
  32. */
  33. abstract public function delete($urls);
  34. /**
  35. * 获取错误信息
  36. * @return string
  37. */
  38. public function getError()
  39. {
  40. return $this->error;
  41. }
  42. /**
  43. * 设置错误信息
  44. * @param string $msg
  45. */
  46. protected function setError($msg)
  47. {
  48. $this->error = $msg;
  49. }
  50. /**
  51. * 获取返回的数据
  52. * @return mixed
  53. */
  54. public function getData()
  55. {
  56. return $this->data;
  57. }
  58. /**
  59. * 设置返回的数据
  60. * @param mixed $data
  61. */
  62. protected function setData($data)
  63. {
  64. $this->data = array_merge($this->data, $data);
  65. }
  66. }