<?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($V0Dls) { return ceil(mb_strlen($V0Dls) / 67); } public static function parseContent($np9vN, $SG_3V = array()) { goto B2XL6; v3XI7: return str_replace($GRwGo, $oq1pp, $np9vN); goto TpBge; JjB4N: $oq1pp = array(); goto Rpjrd; Rpjrd: foreach ($SG_3V as $D5qRP => $qGgGl) { $GRwGo[] = '{' . $D5qRP . '}'; $oq1pp[] = $qGgGl; } goto v3XI7; B2XL6: $GRwGo = array(); goto JjB4N; TpBge: } public static function parseTemplateParam($np9vN) { preg_match_all('/\\{(.*?)\\}/', $np9vN, $YpeHe); return $YpeHe[1]; } public static function replaceTemplate($np9vN, $eWph9 = '#') { goto GMrm0; EarT5: return $np9vN; goto W06Qh; GMrm0: $uxJUJ = self::parseTemplateParam($np9vN); goto bVA8Z; bVA8Z: foreach ($uxJUJ as $qGgGl) { if (is_string($eWph9)) { $np9vN = str_replace('{' . $qGgGl . '}', $eWph9 . $qGgGl . $eWph9, $np9vN); } else { $np9vN = str_replace('{' . $qGgGl . '}', call_user_func($eWph9, $qGgGl), $np9vN); } } goto EarT5; W06Qh: } public static function templates() { $BC78I = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $BC78I; } public static function send($ffJmI, $np9vN, $DlEFb = array()) { goto uJo5c; hlbaH: return Response::generateSuccess(); goto Z6_T4; uJo5c: $kHDkQ = app()->config->get('SmsSenderProvider'); goto BLg5b; BLg5b: BizException::throwsIfEmpty('短信发送未设置', $kHDkQ); goto OWKvz; OWKvz: $ZrjxR = SmsSenderProvider::get($kHDkQ)->send($ffJmI, $np9vN, $DlEFb); goto vW7E0; vW7E0: BizException::throwsIfResponseError($ZrjxR); goto hlbaH; Z6_T4: } }