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
7c2c14ce
authored
Nov 28, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
验证码清空
parent
72e0b6c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
app/Api/Controllers/DrugController.php
+2
-1
app/Api/Controllers/UserController.php
+4
-2
No files found.
app/Api/Controllers/DrugController.php
View file @
7c2c14ce
...
@@ -117,7 +117,8 @@ public function drugLimit(Request $request)
...
@@ -117,7 +117,8 @@ public function drugLimit(Request $request)
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
where
(
'is_voided'
,
PrescriptionModel
::
IS_VOIDED_FALSE
)
# 未作废的处方
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
#
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
->
get
();
->
get
();
...
...
app/Api/Controllers/UserController.php
View file @
7c2c14ce
...
@@ -106,7 +106,7 @@ public function smsCode(Request $request)
...
@@ -106,7 +106,7 @@ public function smsCode(Request $request)
$verificationCode
=
rand
(
100000
,
999999
);
// 生成6位随机验证码
$verificationCode
=
rand
(
100000
,
999999
);
// 生成6位随机验证码
// 存储验证码和有效期(10分钟)
// 存储验证码和有效期(10分钟)
cache
()
->
put
(
"sms_verification_code_
{
$mobile
}
"
,
$verificationCode
,
60
0
);
// 600秒 = 10分钟
cache
()
->
put
(
"sms_verification_code_
{
$mobile
}
"
,
$verificationCode
,
60
);
// 600秒 = 10分钟
// cache()->put($smsCountKey, $smsCount + 1, strtotime('tomorrow') - time());
// cache()->put($smsCountKey, $smsCount + 1, strtotime('tomorrow') - time());
cache
()
->
put
(
$lastSendTimeKey
,
$currentTime
,
60
);
cache
()
->
put
(
$lastSendTimeKey
,
$currentTime
,
60
);
...
@@ -144,7 +144,7 @@ public function bindRole(Request $request)
...
@@ -144,7 +144,7 @@ public function bindRole(Request $request)
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
if
(
$verificationCode
!=
$code
)
{
if
(
$verificationCode
!=
$code
)
{
return
$this
->
failed
(
'验证码错误'
);
return
$this
->
failed
(
'验证码错误
,请重新获取!
'
);
}
}
// 验证手机号是否存在
// 验证手机号是否存在
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
...
@@ -180,6 +180,8 @@ public function bindRole(Request $request)
...
@@ -180,6 +180,8 @@ public function bindRole(Request $request)
$doctor
->
user_id
=
$authInfo
->
id
;
$doctor
->
user_id
=
$authInfo
->
id
;
$doctor
->
save
();
$doctor
->
save
();
# 清除验证码
cache
()
->
put
(
"sms_verification_code_
{
$mobile
}
"
,
"0"
,
60
);
}
else
{
}
else
{
return
$this
->
failed
(
'登录类型错误'
);
return
$this
->
failed
(
'登录类型错误'
);
}
}
...
...
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