Your Name 1 month ago
parent
commit
e59c6b012a
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      application/api/controller/Diyajax.php

+ 20
- 0
application/api/controller/Diyajax.php View File

@@ -673,6 +673,22 @@ class Diyajax extends Base
673 673
         }
674 674
     }
675 675
 
676
+    public function  replaceSecondChineseCharWithAsterisk($string) {
677
+        $count = mb_strlen($string); // 获取字符串长度
678
+            if ($count < 2) {
679
+                return $string; // 如果长度小于2,则直接返回
680
+            }
681
+
682
+        $firstChar = mb_substr($string, 0, 1); // 获取第一个字符
683
+        $secondChar = mb_substr($string, 1, 1); // 获取第二个字符
684
+
685
+        // 如果第二个字符是中文,则替换为星号
686
+        if (strpos(mb_strcut($secondChar, 0, 3), '*') === false) {
687
+            $string = $firstChar . str_repeat('*', mb_strlen($secondChar)) . mb_substr($string, 2);
688
+        }
689
+
690
+        return $string;
691
+    }
676 692
     public function getFormList()
677 693
     {
678 694
         $list = Db::name('zc_form')
@@ -687,6 +703,10 @@ class Diyajax extends Base
687 703
         //var_dump($list);
688 704
         $is_tg_str = ['条件不符','符合条件'];
689 705
         foreach ($list as $key => $item) {
706
+
707
+            //处理用户姓名
708
+            $item['ch'] = $this->replaceSecondChineseCharWithAsterisk($item['ch']);
709
+
690 710
             $item['is_tg_n'] = $item['is_tg'];
691 711
             $extend_info = json_decode($item['extend'],true);
692 712
             $item['sbxx'] = $extend_info['sbdj'];

Loading…
Cancel
Save