Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-api
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
朱招明
third-api
Commits
7f75b8ef
Commit
7f75b8ef
authored
Oct 14, 2023
by
朱招明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d94aa816
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
8 deletions
+26
-8
wike.php
config/wike.php
+3
-2
example.php
example.php
+1
-1
ThirdApiServiceProvider.php
src/ThirdApiServiceProvider.php
+12
-2
Base.php
src/WeiKe/Base.php
+8
-2
Power.php
src/WeiKe/Rest/Power.php
+2
-1
No files found.
config/wike.php
View file @
7f75b8ef
<?php
return
[
'app_key'
=>
'
1085616747
'
,
'app_secret'
=>
'
6fc630bcedc5e65a3fc37363d7dd2e4f
'
,
'app_key'
=>
'
app_key
'
,
'app_secret'
=>
'
app_secret
'
,
];
\ No newline at end of file
example.php
View file @
7f75b8ef
...
...
@@ -12,5 +12,5 @@ $params = [
'change'
=>
0
,
];
$result
=
$Power
->
pushOrder
(
$params
);
var_dump
(
json_decode
(
$result
)
);
var_dump
(
$result
);
src/ThirdApiServiceProvider.php
View file @
7f75b8ef
...
...
@@ -13,6 +13,18 @@ use Illuminate\Support\ServiceProvider;
class
ThirdApiServiceProvider
extends
ServiceProvider
{
/**
* 在注册后进行服务的启动。
*
* @return void
*/
public
function
boot
()
{
if
(
$this
->
app
->
runningInConsole
())
{
$this
->
publishes
([
__DIR__
.
'/../config'
=>
config_path
()],
'third-api'
);
}
}
/**
* 在服务容器里注册
*
* @return void
...
...
@@ -20,6 +32,5 @@ class ThirdApiServiceProvider extends ServiceProvider
public
function
register
()
{
$this
->
mergeConfigFrom
(
realpath
(
__DIR__
.
'/../config/wike.php'
),
'wike'
);
}
}
\ No newline at end of file
src/WeiKe/Base.php
View file @
7f75b8ef
...
...
@@ -8,14 +8,20 @@
namespace
SMG\ThirdApi\WeiKe
;
use
SMG\ThirdApi\WeiKe\Rest\Power
;
class
Base
{
protected
$base_uri
=
'https://router.wikeyun.cn/'
;
protected
$config
=
[];
public
function
__construct
()
{
public
function
__construct
(
$config
=
null
)
{
if
(
$config
){
$this
->
config
=
$config
;
}
else
{
$this
->
config
=
config
(
'wike'
);
}
if
(
empty
(
$this
->
config
[
'app_key'
])){
throw
new
\Exception
(
"缺少 app_key"
);
}
...
...
@@ -35,7 +41,7 @@ class Base
* @since 2023/10/14
* @modify
*/
p
ublic
function
getSign
(
$params
){
p
rotected
function
getSign
(
$params
){
$str
=
''
;
#首字母以ASCII方式升序排列
...
...
src/WeiKe/Rest/Power.php
View file @
7f75b8ef
...
...
@@ -48,7 +48,8 @@ class Power extends Base
'form_params'
=>
$params
,
]);
if
(
$response
->
getStatusCode
()
===
200
)
{
return
$response
->
getBody
()
->
getContents
();
$body
=
$response
->
getBody
()
->
getContents
();
return
json_decode
(
$body
);
}
else
{
throw
new
\Exception
(
"请求失败,状态码:
{
$response
->
getStatusCode
()
}
"
);
}
...
...
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