BaseSms.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\services\sms;
  12. use crmeb\basic\BaseStorage;
  13. use crmeb\services\AccessTokenServeService;
  14. /**
  15. * Class BaseSmss
  16. * @package crmeb\basic
  17. */
  18. abstract class BaseSms extends BaseStorage
  19. {
  20. /**
  21. * access_token
  22. * @var null
  23. */
  24. protected $accessToken = NULL;
  25. /**
  26. * BaseSmss constructor.
  27. * @param string $name
  28. * @param AccessTokenServeService $accessTokenServeService
  29. * @param string $configFile
  30. */
  31. public function __construct(string $name, AccessTokenServeService $accessTokenServeService, string $configFile, array $config = [])
  32. {
  33. $this->accessToken = $accessTokenServeService;
  34. $this->name = $name;
  35. $this->configFile = $configFile;
  36. $this->initialize($config);
  37. }
  38. /**
  39. * 初始化
  40. * @param array $config
  41. * @return mixed|void
  42. */
  43. protected function initialize(array $config = [])
  44. {
  45. }
  46. /**
  47. * 开通服务
  48. * @return mixed
  49. */
  50. abstract public function open();
  51. /**修改签名
  52. * @return mixed
  53. */
  54. abstract public function modify(string $sign = null, string $phone, string $code);
  55. /**用户信息
  56. * @return mixed
  57. */
  58. abstract public function info();
  59. /**发送短信
  60. * @return mixed
  61. */
  62. abstract public function send(string $phone, string $templateId, array $data);
  63. /**
  64. * 短信模板
  65. * @param int $page
  66. * @param int $limit
  67. * @param int $type
  68. * @return mixed
  69. */
  70. abstract public function temps(int $page, int $limit, int $type);
  71. /**
  72. * 申请模板
  73. * @param string $title
  74. * @param string $content
  75. * @param int $type
  76. * @return mixed
  77. */
  78. abstract public function apply(string $title, string $content, int $type);
  79. /**
  80. * 模板记录
  81. * @param int $tempType
  82. * @param int $page
  83. * @param int $limit
  84. * @return mixed
  85. */
  86. abstract public function applys(int $tempType, int $page, int $limit);
  87. /**发送记录
  88. * @return mixed
  89. */
  90. abstract public function record($record_id);
  91. }