Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zehong_sms
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯超鹏
zehong_sms
Commits
5556bdc8
Commit
5556bdc8
authored
Nov 27, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
0a346240
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
ExampleJob.php
app/Job/ExampleJob.php
+17
-17
No files found.
app/Job/ExampleJob.php
View file @
5556bdc8
...
...
@@ -41,23 +41,23 @@ class ExampleJob extends Job
$container
=
$caturt
->
getContainer
();
$this
->
redisClient
=
$container
->
get
(
\Redis
::
class
);
// 判断redis是否有当前已发送信息
//
if (!$this->redisClient->get($data['typedevicenum'])) {
//
$template_param = ['cphone' => $data['phone'], 'position' => '您的设备尾号为' . $data['devicenum'], 'alarm' => '离线'];
//
$params = array(
//
'SignName' => '泽宏云',
//
'AccessKeyId' => 'LTAI2xiZNF3iV2aV',
//
'TemplateCode' => 'SMS_169897307',
//
'PhoneNumbers' => $data['phone'],
//
'TemplateParam' => json_encode($template_param, JSON_UNESCAPED_UNICODE),
//
'RegionId' => 'cn-beijing',
//
);
//
$accessKeySecret = 'bprEWwn1M0xgglRQCQEMYSPiYctDk4';
//
$response = $sms->sendSms($accessKeySecret, $params);
//
if ($response['Message'] == 'OK' && $response['Code'] == 'OK') {
//
$redisdata = ['data'=>$data,'sendSms'=>$response,'time'=>time()];
//
$this->redisClient->set($data['typedevicenum'], json_encode($redisdata));
//
}
//
}
if
(
!
$this
->
redisClient
->
get
(
$data
[
'typedevicenum'
]))
{
$template_param
=
[
'cphone'
=>
$data
[
'phone'
],
'position'
=>
'您的设备尾号为'
.
$data
[
'devicenum'
],
'alarm'
=>
'离线'
];
$params
=
array
(
'SignName'
=>
'泽宏云'
,
'AccessKeyId'
=>
'LTAI2xiZNF3iV2aV'
,
'TemplateCode'
=>
'SMS_169897307'
,
'PhoneNumbers'
=>
$data
[
'phone'
],
'TemplateParam'
=>
json_encode
(
$template_param
,
JSON_UNESCAPED_UNICODE
),
'RegionId'
=>
'cn-beijing'
,
);
$accessKeySecret
=
'bprEWwn1M0xgglRQCQEMYSPiYctDk4'
;
$response
=
$sms
->
sendSms
(
$accessKeySecret
,
$params
);
if
(
$response
[
'Message'
]
==
'OK'
&&
$response
[
'Code'
]
==
'OK'
)
{
$redisdata
=
[
'data'
=>
$data
,
'sendSms'
=>
$response
,
'time'
=>
time
()];
$this
->
redisClient
->
set
(
$data
[
'typedevicenum'
],
json_encode
(
$redisdata
));
}
}
}
...
...
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