From a4b758d33b51ad771a11237fb72bc856dd9059b2 Mon Sep 17 00:00:00 2001 From: chengkun <chengkun@ishangstudy.com> Date: Thu, 29 May 2025 18:22:55 +0800 Subject: [PATCH] 短信开发 --- app/include/public.function.php | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/include/public.function.php b/app/include/public.function.php index d0a1255..1a3f722 100644 --- a/app/include/public.function.php +++ b/app/include/public.function.php @@ -16,6 +16,11 @@ } } +/** + * @desc 检测用户名格式 + * @param $str + * @return bool + */ function CheckRegUser($str) { if (!preg_match("/^[\x{4e00}-\x{9fa5}A-Za-z0-9\-@#.\$_!]+$/u", $str)) { return FALSE; @@ -24,6 +29,11 @@ } } +/** + * 检测电话号码 + * @param $str + * @return bool + */ function CheckTell($str) { if (preg_match("/^[0-9-]+?$/", $str) == 0) { return FALSE; @@ -1508,13 +1518,15 @@ return $str; } +/** + * @desc 判断短信功能是否开启 + * @param $config + * @return bool + */ function checkMsgOpen($config) { - - if ($config["sy_msg_appkey"] == "" || $config["sy_msg_appsecret"] == "" || $config['sy_msg_isopen'] != '1') { - + if ($config["sy_sms_secret_id"] == "" || $config["sy_sms_secret_key"] == "" || $config['sy_sms_sdk_app_id'] == '') { return FALSE; } else { - return TRUE; } } @@ -1545,12 +1557,7 @@ */ function avgToYm($long) { if ($long >= 12) { - if (bcmod($long, 12) > 0) { - $return = floor($long / 12) . '年' . bcmod($long, 12); - } else { - $return = floor($long / 12) . '年'; - } - + $return = floor($long / 12) . '年'; } else { $return = $long; } -- Gitblit v1.9.0