Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh_internal_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
杨培培
wxh_internal_api
Commits
e13dd1e5
Commit
e13dd1e5
authored
Jun 28, 2017
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加多个API
Client 返回值判断优化
parent
36f8f41a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
15 deletions
+84
-15
code_medal.php
example/code_medal.php
+3
-3
xue_favorite.php
example/xue_favorite.php
+19
-0
Client.php
src/base/Client.php
+2
-2
client_config_dev.php
src/client_config_dev.php
+2
-2
Medal.php
src/code/Medal.php
+5
-8
Comment.php
src/xue/Comment.php
+26
-0
Favorite.php
src/xue/Favorite.php
+27
-0
No files found.
example/code_medal.php
View file @
e13dd1e5
...
@@ -10,7 +10,7 @@ use internalApi\code\Medal;
...
@@ -10,7 +10,7 @@ use internalApi\code\Medal;
require
__DIR__
.
'/_init.php'
;
require
__DIR__
.
'/_init.php'
;
Medal
::
setDebug
(
true
);
//
Medal::setDebug(true);
$ret
=
Medal
::
getUserMedals
(
10
);
$ret
=
Medal
::
countUserMedals
(
8
);
print_r
(
$ret
);
var_dump
(
$ret
);
\ No newline at end of file
\ No newline at end of file
example/xue_favorite.php
0 → 100644
View file @
e13dd1e5
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/28
* Time: 15:26
*/
use
internalApi\xue\Favorite
;
require
__DIR__
.
'/_init.php'
;
Favorite
::
setDebug
(
true
);
//$count = Favorite::countUserFavorites(8);
//var_dump($count);
$count
=
\internalApi\xue\Comment
::
getLikeMsgCount
(
8
);
var_dump
(
$count
);
\ No newline at end of file
src/base/Client.php
View file @
e13dd1e5
...
@@ -72,7 +72,7 @@ class Client
...
@@ -72,7 +72,7 @@ class Client
foreach
([
'clientId'
,
'clientSecret'
,
'apiUrl'
]
as
$prop
)
{
foreach
([
'clientId'
,
'clientSecret'
,
'apiUrl'
]
as
$prop
)
{
if
(
$this
->
$prop
===
null
)
{
if
(
$this
->
$prop
===
null
)
{
throw
new
ClientException
(
static
::
class
.
"
initialize failed,
\$
{
$prop
}
not set!"
);
throw
new
ClientException
(
"InternalApi
$name
initialize failed,
\$
{
$prop
}
not set!"
);
}
}
}
}
...
@@ -111,7 +111,7 @@ class Client
...
@@ -111,7 +111,7 @@ class Client
if
(
$httpCode
==
403
&&
substr
(
$response
,
0
,
6
)
===
'error:'
)
{
if
(
$httpCode
==
403
&&
substr
(
$response
,
0
,
6
)
===
'error:'
)
{
$message
=
substr
(
$response
,
6
);
$message
=
substr
(
$response
,
6
);
throw
new
ClientException
(
"接口
$api
调用失败: "
.
$message
);
throw
new
ClientException
(
"接口
$api
调用失败: "
.
$message
);
}
elseif
(
$httpCode
!=
200
||
!
$respon
se
)
{
}
elseif
(
$httpCode
!=
200
||
$response
===
fal
se
)
{
throw
new
ClientException
(
'接口请求异常'
,
$httpCode
);
throw
new
ClientException
(
'接口请求异常'
,
$httpCode
);
}
}
...
...
src/client_config_dev.php
View file @
e13dd1e5
...
@@ -13,9 +13,9 @@ return [
...
@@ -13,9 +13,9 @@ return [
'clientSecret'
=>
'Kuy2dVHKRWKAFRXX2l6k'
'clientSecret'
=>
'Kuy2dVHKRWKAFRXX2l6k'
],
],
'xue'
=>
[
'xue'
=>
[
'apiUrl'
=>
'http://
u.yunya.com/test/api-server
'
,
'apiUrl'
=>
'http://
ct.yunya.com/api
'
,
'clientId'
=>
'common'
,
'clientId'
=>
'common'
,
'clientSecret'
=>
'
Kuy2dVHKRWKAFRXX2l6k
'
'clientSecret'
=>
'
Z2oKgZYYc8mznesYMf1o
'
],
],
'code'
=>
[
'code'
=>
[
'apiUrl'
=>
'http://dev.wxherr.com/site/api-server'
,
'apiUrl'
=>
'http://dev.wxherr.com/site/api-server'
,
...
...
src/code/Medal.php
View file @
e13dd1e5
...
@@ -5,23 +5,20 @@ namespace internalApi\code;
...
@@ -5,23 +5,20 @@ namespace internalApi\code;
use
internalApi\base\Client
;
use
internalApi\base\Client
;
/**
/**
* Created by PhpStorm.
* 扳手快查勋章 API
* User: pader
* Date: 2017/6/28
* Time: 12:00
*/
*/
class
Medal
extends
Client
class
Medal
extends
Client
{
{
/**
/**
* 获取扳手快查用户
获得的勋章列表
* 获取扳手快查用户
拥有的勋章数量
*
*
* @param $uid
* @param $uid
* @return
array
* @return
int
*/
*/
public
static
function
ge
tUserMedals
(
$uid
)
public
static
function
coun
tUserMedals
(
$uid
)
{
{
return
self
::
call
(
'medal.
ge
tUserMedals'
,
compact
(
'uid'
));
return
self
::
call
(
'medal.
coun
tUserMedals'
,
compact
(
'uid'
));
}
}
}
}
\ No newline at end of file
src/xue/Comment.php
0 → 100644
View file @
e13dd1e5
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/28
* Time: 15:47
*/
namespace
internalApi\xue
;
use
internalApi\base\Client
;
class
Comment
extends
Client
{
public
static
function
getLikeMsgCount
(
$uid
)
{
return
self
::
call
(
'comment.getLikeMsgCount'
,
compact
(
'uid'
));
}
public
static
function
getReplyMsgCount
(
$uid
)
{
return
self
::
call
(
'comment.getReplyMsgCount'
,
compact
(
'uid'
));
}
}
\ No newline at end of file
src/xue/Favorite.php
0 → 100644
View file @
e13dd1e5
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/28
* Time: 15:24
*/
namespace
internalApi\xue
;
use
internalApi\base\Client
;
class
Favorite
extends
Client
{
/**
* 获取用户学院收藏数量
*
* @param $uid
* @return int
*/
public
static
function
countUserFavorites
(
$uid
)
{
return
self
::
call
(
'favorite.countUserFavorite'
,
compact
(
'uid'
));
}
}
\ No newline at end of file
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