Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
e73e4a4e
...
e73e4a4eb5f20b29a03a3cb303315294d49f0b57
authored
2022-12-05 20:35:12 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
文件上传cos
1 parent
3e213fd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
app/Services/PropertyTrackService.php
app/Services/PropertyTrackService.php
View file @
e73e4a4
...
...
@@ -2,6 +2,7 @@
namespace
App\Services
;
use
App\Helper\AesEncrypt
;
use
App\Helper\CosHelper
;
use
App\Helper\ErrorCode
;
use
App\Helper\RedisClient
;
...
...
@@ -303,7 +304,32 @@ class PropertyTrackService extends Service
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$throwable
->
getMessage
()]);
return
Response
::
error
();
}
}
/**
* @return \Illuminate\Http\JsonResponse|mixed
*/
public
function
getCosToken
()
{
$client
=
new
\GuzzleHttp\Client
([
'base_uri'
=>
env
(
'resource_url'
),
'timeout'
=>
3.0
,
]);
try
{
$response
=
$client
->
post
(
$this
->
request
->
getRequestUri
(),
[
'json'
=>
$this
->
request
->
only
([
'dir'
,
'material'
]),
]);
$respArr
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
$respArr
[
'msg'
]
=
$respArr
[
'message'
];
unset
(
$respArr
[
'message'
]);
return
response
()
->
json
(
$respArr
,
200
);
}
catch
(
\Throwable
$throwable
)
{
return
Response
::
error
(
ErrorCode
::
SERVER_ERROR
,
$throwable
->
getMessage
());
}
}
}
...
...
Please
register
or
sign in
to post a comment