<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Sms; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\Response; use Module\Vendor\Provider\SmsSender\SmsSenderProvider; class SmsUtil { public static function calcNumber($ybjC4) { return ceil(mb_strlen($ybjC4) / 67); } public static function parseContent($oqfDC, $YPKfi = array()) { goto auRIm; chRZa: return str_replace($L2mWa, $G4P70, $oqfDC); goto KYp2H; auRIm: $L2mWa = array(); goto iUbsL; iUbsL: $G4P70 = array(); goto JGrTQ; JGrTQ: foreach ($YPKfi as $KAKiA => $Iim2u) { $L2mWa[] = '{' . $KAKiA . '}'; $G4P70[] = $Iim2u; } goto chRZa; KYp2H: } public static function parseTemplateParam($oqfDC) { preg_match_all('/\\{(.*?)\\}/', $oqfDC, $hId04); return $hId04[1]; } public static function replaceTemplate($oqfDC, $aaDEN = '#') { goto jgR7z; jgR7z: $w6bW5 = self::parseTemplateParam($oqfDC); goto JQISv; JQISv: foreach ($w6bW5 as $Iim2u) { if (is_string($aaDEN)) { $oqfDC = str_replace('{' . $Iim2u . '}', $aaDEN . $Iim2u . $aaDEN, $oqfDC); } else { $oqfDC = str_replace('{' . $Iim2u . '}', call_user_func($aaDEN, $Iim2u), $oqfDC); } } goto oO1Oe; oO1Oe: return $oqfDC; goto jlxWm; jlxWm: } public static function templates() { $P42I2 = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $P42I2; } public static function send($I2nM5, $oqfDC, $nwAwA = array()) { goto ptkzN; ptkzN: $tDnAb = app()->config->get('SmsSenderProvider'); goto PMN1r; uURdm: return Response::generateSuccess(); goto rDW7_; CYEL6: $rhLXE = SmsSenderProvider::get($tDnAb)->send($I2nM5, $oqfDC, $nwAwA); goto hWSFh; hWSFh: BizException::throwsIfResponseError($rhLXE); goto uURdm; PMN1r: BizException::throwsIfEmpty('短信发送未设置', $tDnAb); goto CYEL6; rDW7_: } }