<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Sms; use Module\Vendor\Sms\Service\AliyunSmsService; use Module\Vendor\SoftApi\SoftApi; use ModStart\Core\Input\Response; class SmsUtil { public static function calcNumber($iiYqe) { return ceil(mb_strlen($iiYqe) / 67); } public static function parseContent($pwVFJ, $mPYif = array()) { goto PbgJL; PbgJL: $rXl0r = array(); goto FMLGh; w1NUc: return str_replace($rXl0r, $B4shU, $pwVFJ); goto uqYHz; h_iBw: foreach ($mPYif as $l0ek5 => $vuqB0) { $rXl0r[] = '{' . $l0ek5 . '}'; $B4shU[] = $vuqB0; } goto w1NUc; FMLGh: $B4shU = array(); goto h_iBw; uqYHz: } public static function parseTemplateParam($pwVFJ) { preg_match_all('/\\{(.*?)\\}/', $pwVFJ, $KBRHO); return $KBRHO[1]; } public static function replaceTemplate($pwVFJ, $H26LL = '#') { goto K5Vgm; WMWZm: return $pwVFJ; goto LsmI_; GVXpa: foreach ($OzAEo as $vuqB0) { if (is_string($H26LL)) { $pwVFJ = str_replace('{' . $vuqB0 . '}', $H26LL . $vuqB0 . $H26LL, $pwVFJ); } else { $pwVFJ = str_replace('{' . $vuqB0 . '}', call_user_func($H26LL, $vuqB0), $pwVFJ); } } goto WMWZm; K5Vgm: $OzAEo = self::parseTemplateParam($pwVFJ); goto GVXpa; LsmI_: } public static function send($fFmiT, $aA2dJ, $OQfgJ = array()) { goto ipKMh; Odcf7: $d5oSQ = modstart_config('systemSmsSender') . 'Execute'; goto Hcrcj; ipKMh: if (!modstart_config('systemSmsEnable')) { return Response::generate(-1, '短信发送未开启'); } goto Odcf7; Hcrcj: return self::$d5oSQ($fFmiT, $aA2dJ, $OQfgJ); goto ICPl6; ICPl6: } private static function softApiExecute($fFmiT, $aA2dJ, $OQfgJ = array()) { goto xzYXe; e5Zv5: switch ($aA2dJ) { case SmsTemplate::VERIFY: return $hG3Bi->smsSend($fFmiT, modstart_config('systemSmsSender_softApi_verify_templateId'), array('code' => $OQfgJ['code'])); } goto C0_yt; C0_yt: return Response::generate(-1, '错误'); goto no2Wc; xzYXe: $hG3Bi = SoftApi::instance(modstart_config('systemSmsSender_softApi_appId'), modstart_config('systemSmsSender_softApi_appSecret')); goto e5Zv5; no2Wc: } private static function aliyunExecute($fFmiT, $aA2dJ, $OQfgJ = array()) { $GUa4T = new AliyunSmsService(modstart_config('systemSmsSender_aliyun_accessKeyId'), modstart_config('systemSmsSender_aliyun_accessKeySecret'), modstart_config('systemSmsSender_aliyun_signName')); switch ($aA2dJ) { case SmsTemplate::VERIFY: return $GUa4T->send($fFmiT, modstart_config('systemSmsSender_aliyun_verify_templateId'), array('code' => $OQfgJ['code'])); } } }