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
5cc32256
Commit
5cc32256
authored
Apr 20, 2018
by
wangjj
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
00a1232e
dc221dc7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
151 additions
and
2 deletions
+151
-2
bbs_express.php
example/bbs_express.php
+20
-0
ApiException.php
src/base/ApiException.php
+28
-0
Client.php
src/base/Client.php
+1
-1
Server.php
src/base/Server.php
+1
-1
Express.php
src/ucenter/Express.php
+46
-0
Wallet.php
src/ucenter/Wallet.php
+55
-0
No files found.
example/bbs_express.php
0 → 100644
View file @
5cc32256
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/28
* Time: 10:23
*/
use
internalApi\ucenter\Express
;
require
__DIR__
.
'/_init.php'
;
//Express::setDebug();
$info
=
Express
::
query
(
'70191547363252'
,
'huitongkuaidi'
);
// $info = Member::getInfoByMobile('15395081586');
//$info = Member::getSyncByMobile('13000000002');
//$info = Member::getSyncByUid(514);
print_r
(
$info
);
src/base/ApiException.php
View file @
5cc32256
...
@@ -18,4 +18,32 @@ namespace internalApi\base;
...
@@ -18,4 +18,32 @@ namespace internalApi\base;
*/
*/
class
ApiException
extends
\Exception
class
ApiException
extends
\Exception
{
{
protected
$remote
;
public
function
__construct
(
$message
=
""
,
$code
=
0
,
array
$remote
=
null
,
\Throwable
$previous
=
NULL
)
{
parent
::
__construct
(
$message
,
$code
,
$previous
);
$this
->
remote
=
$remote
;
}
public
function
getRemoteClass
()
{
return
$this
->
remote
[
'class'
];
}
public
function
getRemoteLine
()
{
return
$this
->
remote
[
'line'
];
}
public
function
getRemoteFile
()
{
return
$this
->
remote
[
'file'
];
}
public
function
getRemoteTraceString
()
{
return
$this
->
remote
[
'traceString'
];
}
}
}
\ No newline at end of file
src/base/Client.php
View file @
5cc32256
...
@@ -125,7 +125,7 @@ class Client
...
@@ -125,7 +125,7 @@ class Client
if
(
$httpCode
==
500
&&
substr
(
$response
,
0
,
10
)
===
'exception:'
)
{
if
(
$httpCode
==
500
&&
substr
(
$response
,
0
,
10
)
===
'exception:'
)
{
$e
=
substr
(
$response
,
10
);
$e
=
substr
(
$response
,
10
);
$e
=
json_decode
(
$e
,
true
);
$e
=
json_decode
(
$e
,
true
);
throw
new
ApiException
(
"
{
$e
[
'class'
]
}
:
{
$e
[
'message'
]
}
"
,
$e
[
'code'
]
);
throw
new
ApiException
(
$e
[
'message'
],
$e
[
'code'
],
$e
);
}
}
if
(
$httpCode
==
0
)
{
if
(
$httpCode
==
0
)
{
...
...
src/base/Server.php
View file @
5cc32256
...
@@ -118,7 +118,7 @@ class Server
...
@@ -118,7 +118,7 @@ class Server
'class'
=>
get_class
(
$e
),
'class'
=>
get_class
(
$e
),
'code'
=>
$e
->
getCode
(),
'code'
=>
$e
->
getCode
(),
'message'
=>
$e
->
getMessage
(),
'message'
=>
$e
->
getMessage
(),
'line'
=>
$e
->
get
Fil
e
(),
'line'
=>
$e
->
get
Lin
e
(),
'file'
=>
$e
->
getFile
(),
'file'
=>
$e
->
getFile
(),
'traceString'
=>
$e
->
getTraceAsString
()
'traceString'
=>
$e
->
getTraceAsString
()
];
];
...
...
src/ucenter/Express.php
0 → 100644
View file @
5cc32256
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/30
* Time: 15:08
*/
namespace
internalApi\ucenter
;
use
internalApi\base\Client
;
/**
* 用户中心消息服务
*
* @package internalApi\ucenter
*/
class
Express
extends
Client
{
/**
* 获取物流信息
*
* @param string $nu 快递单号
* @param string $com 快递公司代码
* @return array
*/
public
static
function
query
(
$nu
,
$com
)
{
return
self
::
call
(
'express.query'
,
compact
(
'nu'
,
'com'
));
}
/**
* 获取支持的快递公司代码列表
*
* @param boolean $all false:只获取常用的,true:获取所有快递公司
* @return array
*/
public
static
function
company
(
$all
=
false
)
{
return
self
::
call
(
'express.company'
,
compact
(
'all'
));
}
}
src/ucenter/Wallet.php
0 → 100644
View file @
5cc32256
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/4/13
* Time: 14:58
*/
namespace
internalApi\ucenter
;
use
internalApi\base\Client
;
/**
* 用户钱包
* @package internalApi\ucenter
*/
class
Wallet
extends
Client
{
const
TURNOVER_TYPE_INCOME
=
'income'
;
//收入
const
TURNOVER_TYPE_EXPEND
=
'disbursement'
;
//支出
const
TURNOVER_TYPE_FREEZE
=
'freeze'
;
//冻结
const
TURNOVER_TYPE_UNFREEZE
=
'unfreeze'
;
//解冻
/**
* 获取用户钱包信息
*
* @param int $uid
* @return array|false 查询失败则返回false
*/
public
static
function
queryWallet
(
$uid
)
{
return
self
::
call
(
'wallet.queryWallet'
,
compact
(
'uid'
));
}
/**
* 创建钱包流水
*
* 输入对应操作类型 $type 参数即可操作用户钱包,将直接影响到余额
*
* @param int $uid
* @param string $type 流水类型,使用 Wallet::TURNOVER_TYPE_ 前缀常量
* @param float $amount 金额,单位:元。可精确到小数点后两位数,即分
* @param string $busNumber 业务关联编号,自定义
* @param int $busId 业务关联ID
* @param string $busRemark 业务流水备注
* @param int $busTypeId 业务类型ID,保留默认
* @return int|false 交易成功返回流水ID,失败返回 false
*/
public
static
function
turnover
(
$uid
,
$type
,
$amount
,
$busNumber
=
null
,
$busId
=
null
,
$busRemark
=
null
,
$busTypeId
=
15522201
)
{
return
self
::
call
(
'wallet.turnover'
,
compact
(
'uid'
,
'type'
,
'amount'
,
'amount'
,
'busNumber'
,
'busId'
,
'busRemark'
,
'busTypeId'
));
}
}
\ 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