<?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($MPmfx) { return ceil(mb_strlen($MPmfx) / 67); } public static function parseContent($XPQ0m, $Zrrbp = array()) { goto FWuVJ; nnGc_: $pYc6B = array(); goto GM2xb; GM2xb: foreach ($Zrrbp as $MFVkb => $YxV2x) { $OeEXH[] = '{' . $MFVkb . '}'; $pYc6B[] = $YxV2x; } goto uyUpW; uyUpW: return str_replace($OeEXH, $pYc6B, $XPQ0m); goto VWrgg; FWuVJ: $OeEXH = array(); goto nnGc_; VWrgg: } public static function parseTemplateParam($XPQ0m) { preg_match_all('/\\{(.*?)\\}/', $XPQ0m, $Uy2Nw); return $Uy2Nw[1]; } public static function replaceTemplate($XPQ0m, $iM85V = '#') { goto eHaAI; eHaAI: $EPwwc = self::parseTemplateParam($XPQ0m); goto J6dCE; J6dCE: foreach ($EPwwc as $YxV2x) { if (is_string($iM85V)) { $XPQ0m = str_replace('{' . $YxV2x . '}', $iM85V . $YxV2x . $iM85V, $XPQ0m); } else { $XPQ0m = str_replace('{' . $YxV2x . '}', call_user_func($iM85V, $YxV2x), $XPQ0m); } } goto cDWKW; cDWKW: return $XPQ0m; goto x0Xhm; x0Xhm: } public static function templates() { $mtgPx = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $mtgPx; } public static function send($cz6lT, $XPQ0m, $YxsLg = array()) { goto ruJml; kDCKK: $Ecj99 = SmsSenderProvider::get($O9Vtg)->send($cz6lT, $XPQ0m, $YxsLg); goto JEZN5; vDKJ6: BizException::throwsIfEmpty('短信发送未设置', $O9Vtg); goto kDCKK; JEZN5: BizException::throwsIfResponseError($Ecj99); goto iVHGO; ruJml: $O9Vtg = app()->config->get('SmsSenderProvider'); goto vDKJ6; iVHGO: return Response::generateSuccess(); goto GqkUS; GqkUS: } }