<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Util; 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 r2Fuv; ryb3M: return str_replace($L2mWa, $G4P70, $oqfDC); goto v_6m1; r2Fuv: $L2mWa = array(); goto TegGI; TegGI: $G4P70 = array(); goto sl63h; sl63h: foreach ($YPKfi as $KAKiA => $Iim2u) { $L2mWa[] = '{' . $KAKiA . '}'; $G4P70[] = $Iim2u; } goto ryb3M; v_6m1: } public static function parseTemplateParam($oqfDC) { preg_match_all('/\\{(.*?)\\}/', $oqfDC, $hId04); return $hId04[1]; } public static function replaceTemplate($oqfDC, $aaDEN = '#') { goto fV7Y0; gERag: return $oqfDC; goto p2nXs; fV7Y0: $w6bW5 = self::parseTemplateParam($oqfDC); goto JeNwG; JeNwG: 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 gERag; p2nXs: } public static function templates() { $P42I2 = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $P42I2; } public static function send($I2nM5, $oqfDC, $nwAwA = array()) { goto Hvbnz; FflMC: return Response::generateSuccess(); goto KD44X; bVuYR: BizException::throwsIfEmpty('短信发送未设置', $tDnAb); goto ywxxo; ywxxo: $rhLXE = SmsSenderProvider::get($tDnAb)->send($I2nM5, $oqfDC, $nwAwA); goto sCOrm; sCOrm: BizException::throwsIfResponseError($rhLXE); goto FflMC; Hvbnz: $tDnAb = app()->config->get('SmsSenderProvider'); goto bVuYR; KD44X: } }