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
337a7bb4
...
337a7bb47a5568a586197b138c43b144de2ac479
authored
2021-08-23 16:35:33 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
*
1 parent
d43bc50f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
0 deletions
app/Helper/Http.php
app/Http/Requests/Musician/MusicianWithdrawReceiptByNameRequest.php
config/musician.php
app/Helper/Http.php
0 → 100644
View file @
337a7bb
<?php
namespace
App\Helper
;
use
GuzzleHttp\Client
;
use
Illuminate\Support\Facades\Log
;
/**
* Class Response
* @package App\Helper
*/
class
Http
{
const
METHOD_POST
=
'POST'
;
const
METHOD_GET
=
'GET'
;
/**
* @param $url
* @param array $params
* @return array|mixed
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
static
function
post
(
$uri
,
$params
=
[])
{
$url
=
self
::
formatUrl
(
$uri
);
try
{
$response
=
(
new
Client
())
->
request
(
self
::
METHOD_POST
,
$url
,
[
'json'
=>
$params
]);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
Log
::
info
(
__METHOD__
,
[
'url'
=>
$url
,
'params'
=>
$params
,
'data'
=>
$data
]);
return
$data
;
}
catch
(
\Exception
$e
)
{
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
[];
}
}
/**
* @param $url
* @return array|mixed
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
static
function
get
(
$uri
)
{
$url
=
self
::
formatUrl
(
$uri
);
try
{
$response
=
(
new
Client
())
->
request
(
self
::
METHOD_POST
,
$url
);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
Log
::
info
(
__METHOD__
,
[
'url'
=>
$url
,
'data'
=>
$data
]);
return
$data
;
}
catch
(
\Exception
$e
)
{
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
[];
}
}
/**
* @param $uri
* @return string
*/
public
static
function
formatUrl
(
$uri
)
{
return
env
(
'musician_url'
)
.
$uri
;
}
}
app/Http/Requests/Musician/MusicianWithdrawReceiptByNameRequest.php
0 → 100644
View file @
337a7bb
<?php
namespace
App\Http\Requests\Musician
;
use
Illuminate\Foundation\Http\FormRequest
;
class
MusicianWithdrawReceiptByNameRequest
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'name'
=>
[
'required'
,
'bail'
,
'string'
],
];
}
/**
* @return string[]
*/
public
function
messages
()
:
array
{
return
[
'name.required'
=>
'请提供发票单位名称'
,
];
}
}
config/musician.php
0 → 100644
View file @
337a7bb
<?php
return
[
//提现
'wallet'
=>
[
'addIncome'
=>
'/api/wallet/addIncome'
,
//同步数据
],
];
Please
register
or
sign in
to post a comment