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
5348252e
authored
Nov 11, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
正则,通用方法
parent
cdbe321f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
8 deletions
+84
-8
app/Admin/Controllers/DoctorController.php
+1
-0
app/Admin/Controllers/PatientController.php
+1
-1
app/Admin/Controllers/PharmacistController.php
+6
-6
app/Admin/Controllers/PharmacyController.php
+1
-1
app/helpers.php
+75
-0
No files found.
app/Admin/Controllers/DoctorController.php
View file @
5348252e
...
...
@@ -100,6 +100,7 @@ protected function form()
$form
->
display
(
'id'
)
->
width
(
4
);
$form
->
text
(
'name'
)
->
width
(
4
);
$form
->
text
(
'id_card'
)
->
width
(
4
);
$form
->
mobile
(
'mobile'
)
->
width
(
4
)
->
rules
(
'required|regex:/^1[3456789]\d{9}$/'
);
$form
->
text
(
'license_no'
)
->
width
(
4
);
$form
->
image
(
'license_no_pic'
)
->
accept
(
'jpg,png,jpeg'
)
->
uniqueName
()
->
autoUpload
()
->
retainable
()
->
removable
(
false
)
->
width
(
4
);
$form
->
text
(
'license_no_period'
)
->
width
(
4
);
...
...
app/Admin/Controllers/PatientController.php
View file @
5348252e
...
...
@@ -94,7 +94,7 @@ protected function form()
$form
->
text
(
'name'
)
->
width
(
4
);
$form
->
text
(
'gender'
)
->
width
(
4
);
$form
->
text
(
'id_card'
)
->
width
(
4
);
$form
->
text
(
'mobile'
)
->
width
(
4
);
$form
->
mobile
(
'mobile'
)
->
width
(
4
);
$form
->
text
(
'miniapp_openid'
)
->
width
(
4
);
$form
->
text
(
'avatar'
)
->
width
(
4
);
$form
->
text
(
'nick_name'
)
->
width
(
4
);
...
...
app/Admin/Controllers/PharmacistController.php
View file @
5348252e
...
...
@@ -61,15 +61,15 @@ protected function grid()
$grid
->
model
()
->
orderBy
(
'id'
,
'desc'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'status'
)
->
switch
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'id_card'
);
$grid
->
column
(
'license_number'
);
$grid
->
column
(
'signed_pic'
)
->
image
(
''
,
50
,
50
);
$grid
->
column
(
'mobile'
);
$grid
->
column
(
'practicing_license'
)
->
image
(
''
,
50
,
50
);
$grid
->
column
(
'practicing_license_expired_time'
);
$grid
->
column
(
'physician_license'
)
->
image
(
''
,
50
,
50
);
$grid
->
column
(
'signed_pic'
);
$grid
->
column
(
'status'
);
// $grid->column('practicing_license')->image('', 50, 50);
// $grid->column('physician_license')->image('', 50, 50);
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
...
...
@@ -131,9 +131,9 @@ protected function form()
return
Form
::
make
(
new
PharmacistRepository
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
)
->
width
(
4
);
$form
->
text
(
'name'
)
->
width
(
4
);
$form
->
text
(
'id_card'
)
->
width
(
4
);
$form
->
text
(
'id_card'
)
->
width
(
4
)
->
required
()
;
$form
->
text
(
'license_number'
)
->
width
(
4
);
$form
->
text
(
'mobile'
)
->
width
(
4
);
$form
->
mobile
(
'mobile'
)
->
width
(
4
)
->
rules
(
'required|regex:/^1[3456789]\d{9}$/'
);
$form
->
image
(
'practicing_license'
)
->
accept
(
'jpg,png,jpeg'
)
->
uniqueName
()
->
autoUpload
()
->
retainable
()
->
removable
(
false
)
->
width
(
4
);
$form
->
date
(
'practicing_license_expired_time'
)
->
width
(
4
);
$form
->
image
(
'physician_license'
)
->
accept
(
'jpg,png,jpeg'
)
->
uniqueName
()
->
autoUpload
()
->
retainable
()
->
removable
(
false
)
->
width
(
4
);
...
...
app/Admin/Controllers/PharmacyController.php
View file @
5348252e
...
...
@@ -109,7 +109,7 @@ protected function form()
$form
->
image
(
'pre_packaged_food'
)
->
accept
(
'jpg,png,jpeg'
)
->
uniqueName
()
->
autoUpload
()
->
retainable
()
->
removable
(
false
)
->
width
(
4
);
$form
->
text
(
'area'
)
->
width
(
4
);
$form
->
text
(
'address'
)
->
width
(
4
);
$form
->
text
(
'mobile'
)
->
width
(
4
);
$form
->
mobile
(
'mobile'
)
->
width
(
4
);
$form
->
text
(
'business_hours'
)
->
width
(
4
);
$form
->
map
(
'lat'
,
'lng'
,
'经纬度坐标'
);
$form
->
switch
(
'status'
)
->
width
(
4
);
...
...
app/helpers.php
View file @
5348252e
...
...
@@ -169,3 +169,78 @@ function getSexByIdCard($idCard)
}
}
}
if
(
!
function_exists
(
'data_masking'
))
{
/**
* 数据脱敏.
*
* @param string $strType 脱敏类型,姓名、生日、手机号……
* @param string $str 被脱敏文本
* @return string 脱敏后文本
*/
function
data_masking
(
string
$strType
,
$str
=
''
)
{
if
(
!
isset
(
$str
)
||
(
!
trim
(
$str
)
&&
trim
(
$str
)
==
''
))
{
return
$str
;
}
switch
(
$strType
)
{
case
'uname'
:
// 如果是字符和就显示前后各一位,如果是手机号则展示前3位和后4位
if
(
preg_match
(
'/^1[3456789]{1}[0-9]{9}$/'
,
$str
))
{
$maskStr
=
substr_replace
(
$str
,
'****'
,
3
,
4
);
}
else
{
//普通账号不做脱敏展示
$maskStr
=
$str
;
//$maskStr = str_repeat("*", mb_strlen($str)-1) . mb_substr($str, -1, 1);
}
break
;
case
'truename'
:
// 只隐藏第一位,浙里办
$maskStr
=
'*'
.
mb_substr
(
$str
,
1
);
break
;
case
'truename2'
:
// 只隐藏第二位,其他
$len
=
mb_strlen
(
$str
);
if
(
$len
==
2
)
{
$maskStr
=
mb_substr
(
$str
,
0
,
1
)
.
'*'
;
}
if
(
$len
<
2
)
{
$maskStr
=
$str
;
}
if
(
$len
>
2
)
{
$maskStr
=
mb_substr
(
$str
,
0
,
1
)
.
str_repeat
(
'*'
,
mb_strlen
(
$str
)
-
2
)
.
mb_substr
(
$str
,
-
1
,
1
);
}
break
;
case
'birthday'
:
// 仅展示最后一位
$maskStr
=
'****-**-*'
.
substr
(
$str
,
-
1
,
1
);
break
;
case
'bankcard'
:
// 展示前4位和后3位
$maskStr
=
substr
(
$str
,
0
,
4
)
.
'************'
.
substr
(
$str
,
-
4
,
3
);
break
;
case
'idcard'
:
// 只展示第一位和最后一位
$maskStr
=
substr
(
$str
,
0
,
1
)
.
str_repeat
(
'*'
,
strlen
(
$str
)
-
2
)
.
substr
(
$str
,
-
1
,
1
);
break
;
case
'mobile'
:
// 展示前3位和后4位
$maskStr
=
substr_replace
(
$str
,
'****'
,
3
,
4
);
break
;
case
'email'
:
// 名字部分只展示首位和末位
$pos
=
stripos
(
$str
,
'@'
,
0
);
$maskStr
=
substr
(
$str
,
0
,
1
)
.
str_repeat
(
'*'
,
$pos
-
2
)
.
substr
(
$str
,
$pos
-
1
,
1
)
.
substr
(
$str
,
$pos
);
break
;
case
'address'
:
// 地址的详细地址部分
$maskStr
=
'******'
;
break
;
case
'detailedaddress'
://
详细地址
,
只展示前6位
$maskStr
=
mb_substr
(
$str
,
0
,
6
)
.
'******'
;
break
;
case
'image'
:
$maskStr
=
env
(
'DEFAULT_PIC'
);
break
;
case
'sex'
:
$maskStr
=
'*'
;
break
;
default
:
$maskStr
=
$str
;
break
;
}
return
$maskStr
;
}
}
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