<?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($n16LT) { return ceil(mb_strlen($n16LT) / 67); } public static function parseContent($Aj5L2, $aFDel = array()) { goto CwxhQ; GFV0A: foreach ($aFDel as $kEhTf => $y2Ltn) { $ux96N[] = '{' . $kEhTf . '}'; $zjr2g[] = $y2Ltn; } goto s5NAH; CwxhQ: $ux96N = array(); goto BWV4C; s5NAH: return str_replace($ux96N, $zjr2g, $Aj5L2); goto AjBig; BWV4C: $zjr2g = array(); goto GFV0A; AjBig: } public static function parseTemplateParam($Aj5L2) { preg_match_all('/\\{(.*?)\\}/', $Aj5L2, $XeSWB); return $XeSWB[1]; } public static function replaceTemplate($Aj5L2, $BB8Tg = '#') { goto KL0p_; KL0p_: $qOrzw = self::parseTemplateParam($Aj5L2); goto rPygk; Cw7N6: return $Aj5L2; goto mPzzi; rPygk: 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 Cw7N6; mPzzi: } public static function templates() { $qie3s = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $qie3s; } public static function send($VaTf5, $Aj5L2, $QmY2j = array()) { goto AsOEP; QwDly: return Response::generateSuccess(); goto O0B4z; rRgRb: $Tbn6c = SmsSenderProvider::get($oMd7I)->send($VaTf5, $Aj5L2, $QmY2j); goto UWUvz; AsOEP: $oMd7I = app()->config->get('SmsSenderProvider'); goto h07cg; UWUvz: BizException::throwsIfResponseError($Tbn6c); goto QwDly; h07cg: BizException::throwsIfEmpty('短信发送未设置', $oMd7I); goto rRgRb; O0B4z: } }