<?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($Ral1i) { return ceil(mb_strlen($Ral1i) / 67); } public static function parseContent($eMuYk, $TkA_y = array()) { goto TfgSZ; TfgSZ: $GKMz3 = array(); goto T2Lf6; StSSu: return str_replace($GKMz3, $YGfF6, $eMuYk); goto jEw63; T2Lf6: $YGfF6 = array(); goto u4YjD; u4YjD: foreach ($TkA_y as $F4wee => $SxG_W) { $GKMz3[] = '{' . $F4wee . '}'; $YGfF6[] = $SxG_W; } goto StSSu; jEw63: } public static function parseTemplateParam($eMuYk) { preg_match_all('/\\{(.*?)\\}/', $eMuYk, $oxpiO); return $oxpiO[1]; } public static function replaceTemplate($eMuYk, $jBTUb = '#') { goto skJ3X; S8xP3: foreach ($FRVtF as $SxG_W) { if (is_string($jBTUb)) { $eMuYk = str_replace('{' . $SxG_W . '}', $jBTUb . $SxG_W . $jBTUb, $eMuYk); } else { $eMuYk = str_replace('{' . $SxG_W . '}', call_user_func($jBTUb, $SxG_W), $eMuYk); } } goto voVe_; skJ3X: $FRVtF = self::parseTemplateParam($eMuYk); goto S8xP3; voVe_: return $eMuYk; goto cWFqH; cWFqH: } public static function templates() { $QJ4Ed = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $QJ4Ed; } public static function send($xnZh3, $eMuYk, $EIJx6 = array()) { goto Ept8a; jNy5t: BizException::throwsIfResponseError($gMg9x); goto zf5Vp; EsX2N: $gMg9x = SmsSenderProvider::get($pXrNS)->send($xnZh3, $eMuYk, $EIJx6); goto jNy5t; Ept8a: $pXrNS = app()->config->get('SmsSenderProvider'); goto VHKgc; VHKgc: BizException::throwsIfEmpty('短信发送未设置', $pXrNS); goto EsX2N; zf5Vp: return Response::generateSuccess(); goto GVQxw; GVQxw: } }