<?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($fKViA) { return ceil(mb_strlen($fKViA) / 67); } public static function parseContent($jULgk, $GMPEM = array()) { goto tHAGY; tHAGY: $zk3KY = array(); goto ENaF1; bMX0T: return str_replace($zk3KY, $qK5u3, $jULgk); goto X2w1A; tm8tM: foreach ($GMPEM as $d2HEV => $hf0nR) { $zk3KY[] = '{' . $d2HEV . '}'; $qK5u3[] = $hf0nR; } goto bMX0T; ENaF1: $qK5u3 = array(); goto tm8tM; X2w1A: } public static function parseTemplateParam($jULgk) { preg_match_all('/\\{(.*?)\\}/', $jULgk, $hfN7a); return $hfN7a[1]; } public static function replaceTemplate($jULgk, $OdOwm = '#') { goto WttQL; FrA42: foreach ($mzzZ3 as $hf0nR) { if (is_string($OdOwm)) { $jULgk = str_replace('{' . $hf0nR . '}', $OdOwm . $hf0nR . $OdOwm, $jULgk); } else { $jULgk = str_replace('{' . $hf0nR . '}', call_user_func($OdOwm, $hf0nR), $jULgk); } } goto fTL4h; WttQL: $mzzZ3 = self::parseTemplateParam($jULgk); goto FrA42; fTL4h: return $jULgk; goto VPLW1; VPLW1: } public static function templates() { $N2Vsm = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $N2Vsm; } public static function send($LBYcD, $jULgk, $DQ0aq = array()) { goto ulYZG; LMHcA: BizException::throwsIfEmpty('短信发送未设置', $tcA2a); goto uGR2C; ulYZG: $tcA2a = app()->config->get('SmsSenderProvider'); goto LMHcA; EfFuv: return Response::generateSuccess(); goto qWSgQ; uGR2C: $oHb9_ = SmsSenderProvider::get($tcA2a)->send($LBYcD, $jULgk, $DQ0aq); goto xOPj1; xOPj1: BizException::throwsIfResponseError($oHb9_); goto EfFuv; qWSgQ: } }