BaseSmss.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace ln\services;
  3. use ln\basic\BaseStorage;
  4. use ln\services\AccessTokenServeService;
  5. /**
  6. * Class BaseSmss
  7. * @package ln\basic
  8. */
  9. abstract class BaseSmss extends BaseStorage
  10. {
  11. /**
  12. * access_token
  13. * @var null
  14. */
  15. protected $accessToken = NULL;
  16. /**
  17. * BaseSmss constructor.
  18. * @param string $name
  19. * @param AccessTokenServeService $accessTokenServeService
  20. * @param string $configFile
  21. */
  22. public function __construct(string $name, AccessTokenServeService $accessTokenServeService, string $configFile)
  23. {
  24. $this->accessToken = $accessTokenServeService;
  25. $this->name = $name;
  26. $this->configFile = $configFile;
  27. $this->initialize();
  28. }
  29. /**
  30. * 初始化
  31. * @param array $config
  32. * @return mixed|void
  33. */
  34. protected function initialize(array $config = [])
  35. {
  36. }
  37. /**
  38. * 开通服务
  39. * @return mixed
  40. */
  41. abstract public function open();
  42. /**修改签名
  43. * @return mixed
  44. */
  45. abstract public function modify(string $sign = null, string $phone, string $code);
  46. /**用户信息
  47. * @return mixed
  48. */
  49. abstract public function info();
  50. /**发送短信
  51. * @return mixed
  52. */
  53. abstract public function send(string $phone, string $templateId, array $data);
  54. /**
  55. * 短信模板
  56. * @param int $page
  57. * @param int $limit
  58. * @param int $type
  59. * @return mixed
  60. */
  61. abstract public function temps(int $page, int $limit, int $type);
  62. /**
  63. * 申请模板
  64. * @param string $title
  65. * @param string $content
  66. * @param int $type
  67. * @return mixed
  68. */
  69. abstract public function apply(string $title, string $content, int $type);
  70. /**
  71. * 模板记录
  72. * @param int $tempType
  73. * @param int $page
  74. * @param int $limit
  75. * @return mixed
  76. */
  77. abstract public function applys(int $tempType, int $page, int $limit);
  78. /**发送记录
  79. * @return mixed
  80. */
  81. abstract public function record($record_id);
  82. }