<?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($n16LT) { return ceil(mb_strlen($n16LT) / 67); } public static function parseContent($Aj5L2, $aFDel = array()) { goto Mrqx0; jICfd: $zjr2g = array(); goto eqerj; Mrqx0: $ux96N = array(); goto jICfd; eAZjB: return str_replace($ux96N, $zjr2g, $Aj5L2); goto TZJEi; eqerj: foreach ($aFDel as $kEhTf => $y2Ltn) { $ux96N[] = '{' . $kEhTf . '}'; $zjr2g[] = $y2Ltn; } goto eAZjB; TZJEi: } public static function parseTemplateParam($Aj5L2) { preg_match_all('/\\{(.*?)\\}/', $Aj5L2, $XeSWB); return $XeSWB[1]; } public static function replaceTemplate($Aj5L2, $BB8Tg = '#') { goto Kjc68; MuaE7: return $Aj5L2; goto nvCgl; McuG1: foreach ($qOrzw as $y2Ltn) { if (is_string($BB8Tg)) { $Aj5L2 = str_replace('{' . $y2Ltn . '}', $BB8Tg . $y2Ltn . $BB8Tg, $Aj5L2); } else { $Aj5L2 = str_replace('{' . $y2Ltn . '}', call_user_func($BB8Tg, $y2Ltn), $Aj5L2); } } goto MuaE7; Kjc68: $qOrzw = self::parseTemplateParam($Aj5L2); goto McuG1; nvCgl: } public static function templates() { $qie3s = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $qie3s; } public static function send($VaTf5, $Aj5L2, $QmY2j = array()) { goto xiiy4; yz_bx: BizException::throwsIfEmpty('短信发送未设置', $oMd7I); goto nziDK; xiiy4: $oMd7I = app()->config->get('SmsSenderProvider'); goto yz_bx; TU2xJ: return Response::generateSuccess(); goto d0ELc; nziDK: $Tbn6c = SmsSenderProvider::get($oMd7I)->send($VaTf5, $Aj5L2, $QmY2j); goto ZRE8z; ZRE8z: BizException::throwsIfResponseError($Tbn6c); goto TU2xJ; d0ELc: } }