<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Sms; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\Response; use Module\Vendor\Provider\SmsSender\SmsSenderProvider; use Module\Vendor\SoftApi\SoftApi; class SmsUtil { public static function calcNumber($ZA40Q) { return ceil(mb_strlen($ZA40Q) / 67); } public static function parseContent($IulMt, $FKL3p = array()) { goto Y_VOK; M3sWz: foreach ($FKL3p as $QBy8K => $cG5OI) { $yMDzQ[] = '{' . $QBy8K . '}'; $Lw5ua[] = $cG5OI; } goto IrQcg; IrQcg: return str_replace($yMDzQ, $Lw5ua, $IulMt); goto Dvhky; NfkIh: $Lw5ua = array(); goto M3sWz; Y_VOK: $yMDzQ = array(); goto NfkIh; Dvhky: } public static function parseTemplateParam($IulMt) { preg_match_all('/\\{(.*?)\\}/', $IulMt, $okKGo); return $okKGo[1]; } public static function replaceTemplate($IulMt, $R0N0o = '#') { goto JVsI1; NUvVb: foreach ($f_HcG as $cG5OI) { if (is_string($R0N0o)) { $IulMt = str_replace('{' . $cG5OI . '}', $R0N0o . $cG5OI . $R0N0o, $IulMt); } else { $IulMt = str_replace('{' . $cG5OI . '}', call_user_func($R0N0o, $cG5OI), $IulMt); } } goto RUWcd; JVsI1: $f_HcG = self::parseTemplateParam($IulMt); goto NUvVb; RUWcd: return $IulMt; goto w1HQs; w1HQs: } public static function templates() { $cZHv2 = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $cZHv2; } public static function send($Z_ag6, $IulMt, $AIfUa = array()) { goto LG4ZB; EHlJU: BizException::throwsIfResponseError($yCUD1); goto rxdNu; gJmWW: $yCUD1 = SmsSenderProvider::get($ugwYT)->send($Z_ag6, $IulMt, $AIfUa); goto EHlJU; LG4ZB: $ugwYT = app()->config->get('SmsSenderProvider'); goto hKT2_; rxdNu: return Response::generateSuccess(); goto mNEHy; hKT2_: BizException::throwsIfEmpty('短信发送未设置', $ugwYT); goto gJmWW; mNEHy: } }