<?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($fKViA) { return ceil(mb_strlen($fKViA) / 67); } public static function parseContent($jULgk, $GMPEM = array()) { goto BFyzW; R9r7_: $qK5u3 = array(); goto RQR2l; RQR2l: foreach ($GMPEM as $d2HEV => $hf0nR) { $zk3KY[] = '{' . $d2HEV . '}'; $qK5u3[] = $hf0nR; } goto Swmu6; BFyzW: $zk3KY = array(); goto R9r7_; Swmu6: return str_replace($zk3KY, $qK5u3, $jULgk); goto sZvJ3; sZvJ3: } public static function parseTemplateParam($jULgk) { preg_match_all('/\\{(.*?)\\}/', $jULgk, $hfN7a); return $hfN7a[1]; } public static function replaceTemplate($jULgk, $OdOwm = '#') { goto j_JHW; j_JHW: $mzzZ3 = self::parseTemplateParam($jULgk); goto Q9BT2; Q9BT2: 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 y7LHW; y7LHW: return $jULgk; goto z1YPO; z1YPO: } public static function templates() { $N2Vsm = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $N2Vsm; } public static function send($LBYcD, $jULgk, $DQ0aq = array()) { goto VIsgy; BJmGn: $oHb9_ = SmsSenderProvider::get($tcA2a)->send($LBYcD, $jULgk, $DQ0aq); goto ufU9P; SR9jN: return Response::generateSuccess(); goto Ml4Jy; ufU9P: BizException::throwsIfResponseError($oHb9_); goto SR9jN; L3MQs: BizException::throwsIfEmpty('短信发送未设置', $tcA2a); goto BJmGn; VIsgy: $tcA2a = app()->config->get('SmsSenderProvider'); goto L3MQs; Ml4Jy: } }