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
f7272b17
authored
Nov 23, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信
parent
b51aad00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
app/Admin/Controllers/AuthController.php
+3
-1
app/Api/Controllers/UserController.php
+17
-5
No files found.
app/Admin/Controllers/AuthController.php
View file @
f7272b17
...
...
@@ -176,15 +176,17 @@ public function getLoginSmsCode(Request $request)
$templateData
=
[
'code'
=>
$verificationCode
];
$smsService
=
new
SmsService
();
$response
=
$smsService
->
sendSms
(
$phone
,
$templateName
,
$templateData
);
Log
::
info
(
json_encode
(
$response
));
}
elseif
(
env
(
'SMS_CHANNEL'
)
==
'qcloud'
)
{
// 腾讯短信
$easySms
=
new
EasySms
(
config
(
'easysms'
));
$easySms
->
send
(
$phone
,
[
$
response
=
$
easySms
->
send
(
$phone
,
[
'content'
=>
"您的验证码为:
{
$verificationCode
}
,请勿泄露于他人!"
,
'template'
=>
'2311645'
,
'data'
=>
[
'code'
=>
$verificationCode
,
],
]);
Log
::
info
(
json_encode
(
$response
));
}
return
response
()
->
json
([
'success'
=>
true
,
'message'
=>
'验证码已发送'
]);
...
...
app/Api/Controllers/UserController.php
View file @
f7272b17
...
...
@@ -109,11 +109,23 @@ public function smsCode(Request $request)
// cache()->put($smsCountKey, $smsCount + 1, strtotime('tomorrow') - time());
cache
()
->
put
(
$lastSendTimeKey
,
$currentTime
,
60
);
$templateName
=
'verification_code'
;
$templateData
=
[
'code'
=>
$verificationCode
];
$smsService
=
new
SmsService
();
$response
=
$smsService
->
sendSms
(
$mobile
,
$templateName
,
$templateData
);
Log
::
info
(
json_encode
(
$response
));
if
(
env
(
'SMS_CHANNEL'
)
==
'chengliye'
)
{
$templateName
=
'verification_code'
;
$templateData
=
[
'code'
=>
$verificationCode
];
$smsService
=
new
SmsService
();
$response
=
$smsService
->
sendSms
(
$mobile
,
$templateName
,
$templateData
);
Log
::
info
(
json_encode
(
$response
));
}
elseif
(
env
(
'SMS_CHANNEL'
)
==
'qcloud'
)
{
// 腾讯短信
$easySms
=
new
EasySms
(
config
(
'easysms'
));
$response
=
$easySms
->
send
(
$mobile
,
[
'content'
=>
"您的验证码为:
{
$verificationCode
}
,请勿泄露于他人!"
,
'template'
=>
'2311645'
,
'data'
=>
[
'code'
=>
$verificationCode
,
],
]);
Log
::
info
(
json_encode
(
$response
));
}
return
$this
->
success
(
'验证码已发送'
);
}
...
...
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