123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- declare (strict_types = 1);
- namespace library\utils;
- use library\utils\Sms\TencentSms;
- class Sms {
- /**
- * 发送模板短信【前台使用】
- * @param $tel
- * @param $code
- * @param array $array
- * @return mixed
- */
- public function SmsCode($tel, $code, $array = array()) {
- $data = $this->SmsSendTpl($tel, $code, $array);
- if ($data['Code'] == 'OK') {
- $r['status'] = 1;
- $r['error'] = 'ok';
- } else {
- $r['status'] = -1;
- $r['error'] = $data['Message'];
- }
- return $r;
- }
- /**
- * 发送模板的数据
- * @param $tel 手机号码
- * @param $code code
- * @param array $array
- * @return mixed|null
- */
- function SmsSendTpl($tel, $code, $array = array()) {
- $tencent = new TencentSms();
- $r = $tencent->SmsSendTmplete($tel,$code,$array);
- return $r;
- }
- }
|