<?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($Ral1i) { return ceil(mb_strlen($Ral1i) / 67); } public static function parseContent($eMuYk, $TkA_y = array()) { goto f26eL; QHTog: $YGfF6 = array(); goto eB6HW; eB6HW: foreach ($TkA_y as $F4wee => $SxG_W) { $GKMz3[] = '{' . $F4wee . '}'; $YGfF6[] = $SxG_W; } goto R8ErH; f26eL: $GKMz3 = array(); goto QHTog; R8ErH: return str_replace($GKMz3, $YGfF6, $eMuYk); goto je50y; je50y: } public static function parseTemplateParam($eMuYk) { preg_match_all('/\\{(.*?)\\}/', $eMuYk, $oxpiO); return $oxpiO[1]; } public static function replaceTemplate($eMuYk, $jBTUb = '#') { goto uW74p; zGtBa: return $eMuYk; goto b3Rpr; uW74p: $FRVtF = self::parseTemplateParam($eMuYk); goto FUR3Z; FUR3Z: foreach ($FRVtF as $SxG_W) { if (is_string($jBTUb)) { $eMuYk = str_replace('{' . $SxG_W . '}', $jBTUb . $SxG_W . $jBTUb, $eMuYk); } else { $eMuYk = str_replace('{' . $SxG_W . '}', call_user_func($jBTUb, $SxG_W), $eMuYk); } } goto zGtBa; b3Rpr: } public static function templates() { $QJ4Ed = array(array('name' => 'verify', 'title' => '验证码', 'desc' => '验证码模板变量为 code')); return $QJ4Ed; } public static function send($xnZh3, $eMuYk, $EIJx6 = array()) { goto WKonc; OF2tj: BizException::throwsIfEmpty('短信发送未设置', $pXrNS); goto qD91Y; V8fH6: return Response::generateSuccess(); goto l5XCt; rB3qV: BizException::throwsIfResponseError($gMg9x); goto V8fH6; WKonc: $pXrNS = app()->config->get('SmsSenderProvider'); goto OF2tj; qD91Y: $gMg9x = SmsSenderProvider::get($pXrNS)->send($xnZh3, $eMuYk, $EIJx6); goto rB3qV; l5XCt: } }