Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f766061f
authored
Dec 05, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
脱敏方法兼容
parent
64669746
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/Admin/Controllers/PatientController.php
+2
-2
app/helpers.php
+3
-3
No files found.
app/Admin/Controllers/PatientController.php
View file @
f766061f
...
@@ -26,12 +26,12 @@ protected function grid()
...
@@ -26,12 +26,12 @@ protected function grid()
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'name'
);
$grid
->
column
(
'id_card'
)
->
display
(
function
(
$content
)
{
$grid
->
column
(
'id_card'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
??
''
,
'idcard'
);
return
data_masking
(
$content
,
'idcard'
);
});
});
$grid
->
column
(
'gender'
,
'性别'
)
->
using
(
PatientModel
::
SEX_MAP
);
$grid
->
column
(
'gender'
,
'性别'
)
->
using
(
PatientModel
::
SEX_MAP
);
$grid
->
column
(
'age'
,
'年龄'
);
$grid
->
column
(
'age'
,
'年龄'
);
$grid
->
column
(
'mobile'
)
->
display
(
function
(
$content
)
{
$grid
->
column
(
'mobile'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
??
''
,
'mobile'
);
return
data_masking
(
$content
,
'mobile'
);
});
});
$grid
->
column
(
'is_default'
)
->
using
(
PatientModel
::
IS_DEFAULT_MAP
)
->
dot
(
PatientModel
::
IS_DEFAULT_MAP_COLOR
);
$grid
->
column
(
'is_default'
)
->
using
(
PatientModel
::
IS_DEFAULT_MAP
)
->
dot
(
PatientModel
::
IS_DEFAULT_MAP_COLOR
);
$grid
->
column
(
'user.id'
,
'关联用户'
);
$grid
->
column
(
'user.id'
,
'关联用户'
);
...
...
app/helpers.php
View file @
f766061f
...
@@ -94,13 +94,13 @@ function getSexByIdCard($idCard)
...
@@ -94,13 +94,13 @@ function getSexByIdCard($idCard)
/**
/**
* 数据脱敏.
* 数据脱敏.
*
*
* @param string $strType 脱敏类型,姓名、生日、手机号……
* @param string
|null
$strType 脱敏类型,姓名、生日、手机号……
* @param string $str 被脱敏文本
* @param string $str 被脱敏文本
* @return string 脱敏后文本
* @return string 脱敏后文本
*/
*/
function
data_masking
(
string
$str
,
string
$strType
)
function
data_masking
(
$str
,
string
$strType
)
{
{
if
(
!
isset
(
$str
)
||
(
!
trim
(
$str
)
&&
trim
(
$str
)
==
''
)
)
{
if
(
is_null
(
$str
)
||
$str
===
''
||
trim
(
$str
)
===
''
)
{
return
$str
;
return
$str
;
}
}
switch
(
$strType
)
{
switch
(
$strType
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment