BaseSmss.php 2.6 KB

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