CRMEB_PRO_M/crmeb/basic/BaseSms.php

66 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace crmeb\basic;
use think\facade\Config;
/**
* Class BaseSms
* @package crmeb\basic
*/
abstract class BaseSms extends BaseStorage
{
/**
* 模板id
* @var array
*/
protected $templateIds = [];
/**
* 初始化
* @param array $config
* @return mixed|void
*/
protected function initialize(array $config)
{
$this->templateIds = Config::get($this->configFile . '.stores.' . $this->name . '.template_id', []);
}
/**
* 获取模板id
* @return array
*/
public function getTemplateId()
{
return $this->templateIds;
}
/**
* 提取模板code
* @param string $templateId
* @return null
*/
protected function getTemplateCode(string $templateId)
{
return $this->templateIds[$templateId] ?? null;
}
/**
* 发送短信
* @param string $phone
* @param string $templateId
* @param array $data
* @return mixed
*/
abstract public function send(string $phone, string $templateId, array $data = []);
}