<?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($OfwYj) { return ceil(mb_strlen($OfwYj) / 67); } public static function parseContent($sHXTa, $uA2kT = array()) { goto JDJBZ; h9azt: foreach ($uA2kT as $ynzcc => $nfRLq) { $XBR1_[] = '{' . $ynzcc . '}'; $dBSSL[] = $nfRLq; } goto PggdL; B_NVd: $dBSSL = array(); goto h9azt; PggdL: return str_replace($XBR1_, $dBSSL, $sHXTa); goto hKwMH; JDJBZ: $XBR1_ = array(); goto B_NVd; hKwMH: } public static function parseTemplateParam($sHXTa) { preg_match_all('/\\{(.*?)\\}/', $sHXTa, $QuDiu); return $QuDiu[1]; } public static function replaceTemplate($sHXTa, $ZOWC5 = '#') { goto OVr3s; OVr3s: $quZRe = self::parseTemplateParam($sHXTa); goto n89bi; n89bi: foreach ($quZRe as $nfRLq) { if (is_string($ZOWC5)) { $sHXTa = str_replace('{' . $nfRLq . '}', $ZOWC5 . $nfRLq . $ZOWC5, $sHXTa); } else { $sHXTa = str_replace('{' . $nfRLq . '}', call_user_func($ZOWC5, $nfRLq), $sHXTa); } } goto zNO9b; zNO9b: return $sHXTa; goto lNYG7; lNYG7: } public static function templates() { $e2gbd = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $e2gbd; } public static function send($G3YVc, $sHXTa, $CJiXs = array()) { goto LO2Sp; LO2Sp: $yzKqK = app()->config->get('SmsSenderProvider'); goto PeHwH; AcSU3: BizException::throwsIfResponseError($om_hh); goto v1Nxp; v1Nxp: return Response::generateSuccess(); goto yZzGQ; PeHwH: BizException::throwsIfEmpty('短信发送未设置', $yzKqK); goto dM8QK; dM8QK: $om_hh = SmsSenderProvider::get($yzKqK)->send($G3YVc, $sHXTa, $CJiXs); goto AcSU3; yZzGQ: } }