Commit 7c2c14ce by 赵增煜

验证码清空

parent 72e0b6c0
...@@ -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();
......
...@@ -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, 600); // 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('登录类型错误');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment