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
49c1905c
Commit
49c1905c
authored
May 29, 2018
by
wangjj
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a3ed1c8b
a12d48f0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
1 deletion
+117
-1
ucenter_order.php
example/ucenter_order.php
+4
-0
ucenter_transfer.php
example/ucenter_transfer.php
+23
-0
Client.php
src/base/Client.php
+15
-1
Order.php
src/ucenter/Order.php
+23
-0
Transfer.php
src/ucenter/Transfer.php
+52
-0
No files found.
example/ucenter_order.php
View file @
49c1905c
...
@@ -18,4 +18,8 @@ $order = Order::getByOid('2018010818030671446574');
...
@@ -18,4 +18,8 @@ $order = Order::getByOid('2018010818030671446574');
//$order = Order::create(12, '0.01', 'http://xue.yunya.com/api/pay-notify', 'xue_test', 'xue_test_123',
//$order = Order::create(12, '0.01', 'http://xue.yunya.com/api/pay-notify', 'xue_test', 'xue_test_123',
// '学院测试订单', 'http://xue.yunya.com/home/course-info?courseId=123');
// '学院测试订单', 'http://xue.yunya.com/home/course-info?courseId=123');
$order
=
Order
::
createAndPayment
(
'wx_lite'
,
12
,
'0.01'
,
'http://xue.yunya.com/api/pay-notify'
,
'xue_test'
,
'xue_test_123'
,
'学院测试订单'
,
'http://xue.yunya.com/home/course-info?courseId=123'
,
array
(
'open_id'
=>
'1111111111'
));
print_r
(
$order
);
print_r
(
$order
);
\ No newline at end of file
example/ucenter_transfer.php
0 → 100644
View file @
49c1905c
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/1/8
* Time: 18:52
*/
use
internalApi\ucenter\Transfer
;
require
__DIR__
.
'/_init.php'
;
Transfer
::
setDebug
();
//try{
// $result = Transfer::create('12','kw','wx_lite',10,'123123123123123','http://u.yunya.com/test/tcallback');
//
//}catch (\internalApi\base\ApiException $e){
// echo 123123;
//}
$result
=
Transfer
::
verifyNotifyCode
(
1
,
2
);
print_r
(
$result
);
\ No newline at end of file
src/base/Client.php
View file @
49c1905c
...
@@ -184,6 +184,20 @@ class Client
...
@@ -184,6 +184,20 @@ class Client
CURLOPT_USERAGENT
=>
$userAgent
CURLOPT_USERAGENT
=>
$userAgent
]);
]);
//IP 透传
if
(
isset
(
$_SERVER
[
'REMOTE_ADDR'
]))
{
$clientIp
=
!
empty
(
$_SERVER
[
'HTTP_CLIENT_IP'
])
?
$_SERVER
[
'HTTP_CLIENT_IP'
]
:
$_SERVER
[
'REMOTE_ADDR'
];
$headers
[]
=
'Client-IP: '
.
$clientIp
;
$forwardedFor
=
!
empty
(
$_SERVER
[
'HTTP_X_FORWARDED_FOR'
])
?
$_SERVER
[
'HTTP_X_FORWARDED_FOR'
]
:
(
$_SERVER
[
'REMOTE_ADDR'
]
!=
$_SERVER
[
'SERVER_ADDR'
]
?
$_SERVER
[
'REMOTE_ADDR'
]
:
''
);
if
(
$forwardedFor
&&
$forwardedFor
!=
$clientIp
)
{
$forwardedFor
.=
','
.
$_SERVER
[
'SERVER_ADDR'
];
$headers
[]
=
'X-Forwarded-For: '
.
$forwardedFor
;
}
}
//POST 请求
//POST 请求
if
(
$post
)
{
if
(
$post
)
{
$body
=
is_array
(
$post
)
?
http_build_query
(
$post
)
:
$post
;
$body
=
is_array
(
$post
)
?
http_build_query
(
$post
)
:
$post
;
...
@@ -194,7 +208,7 @@ class Client
...
@@ -194,7 +208,7 @@ class Client
}
}
//优化
//优化
$headers
[]
=
'Expect:'
;
$headers
[]
=
'Expect:
'
;
curl_setopt_array
(
$ci
,
[
curl_setopt_array
(
$ci
,
[
CURLOPT_HTTPHEADER
=>
$headers
,
CURLOPT_HTTPHEADER
=>
$headers
,
...
...
src/ucenter/Order.php
View file @
49c1905c
...
@@ -37,6 +37,29 @@ class Order extends Client
...
@@ -37,6 +37,29 @@ class Order extends Client
return
self
::
call
(
'order.create'
,
compact
(
'uid'
,
'amount'
,
'callbackUrl'
,
'prefix'
,
'key'
,
'name'
,
'url'
,
'image'
,
'description'
));
return
self
::
call
(
'order.create'
,
compact
(
'uid'
,
'amount'
,
'callbackUrl'
,
'prefix'
,
'key'
,
'name'
,
'url'
,
'image'
,
'description'
));
}
}
/**
* 创建订单并发起支付返回charge对象
*
* @param string $type 付款类型
* @param int $uid 用户ID
* @param float $amount 订单金额
* @param string $callbackUrl 支付回调地址
* @param string $prefix 商品类型前缀
* @param string $key 商品在该平台唯一索引,如商品ID
* @param string $name 商品名称
* @param string $url 商品URL地址
* @param array $extra 扩展信息,详见 https://www.pingxx.com/api#%E6%94%AF%E4%BB%98%E6%B8%A0%E9%81%93-extra-%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E
* @param string $image 商品图片
* @param string $description 商品介绍
* @return array 对象信息
*/
public
static
function
createAndPayment
(
$type
,
$uid
,
$amount
,
$callbackUrl
,
$prefix
,
$key
,
$name
,
$url
,
$extra
,
$image
=
''
,
$description
=
''
)
{
return
self
::
call
(
'order.createAndPayment'
,
compact
(
'type'
,
'uid'
,
'amount'
,
'callbackUrl'
,
'prefix'
,
'key'
,
'name'
,
'url'
,
'extra'
,
'image'
,
'description'
));
}
/**
/**
* 发起指定订单的退款请求
* 发起指定订单的退款请求
*
*
...
...
src/ucenter/Transfer.php
0 → 100644
View file @
49c1905c
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 2018/5/8
* Time: 10:53 AM
*/
namespace
internalApi\ucenter
;
use
internalApi\base\Client
;
class
Transfer
extends
Client
{
/**
* 企业付款
* @param int $uid
* @param string $type 付款业务类型
* @param string $channel 付款渠道
* @param float $amount 付款金额,元为单位,支付小数点两位,最大 9999.99
* @param string $recipient 收款账号 支付宝账号或者使用微信企业付款到零钱时为用户在 wx 、 wx_pub 及 wx_lite 渠道下的 open_id
* @param string $callbackUrl 成功回调地址
* @param string $body 额外信息
* @param string $recipientName 收款姓名 微信相关渠道可以不传,传则进行校验
* @param string $description 描述 99 个英文和数字的组合或最多 33 个中文字符,不可以包含特殊字符;
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public
static
function
create
(
$uid
,
$type
,
$channel
,
$amount
,
$recipient
,
$callbackUrl
,
$body
=
''
,
$recipientName
=
''
,
$description
=
''
)
{
return
self
::
call
(
'transfer.create'
,
compact
(
'uid'
,
'type'
,
'channel'
,
'amount'
,
'recipient'
,
'callbackUrl'
,
'body'
,
'recipientName'
,
'description'
));
}
/**
* 验证企业付款回调码
*
* @param string $orderno
* @param string $code
* @return bool 返回true代表验证通过,返回false验证失败
*/
public
static
function
verifyNotifyCode
(
$orderno
,
$code
)
{
return
self
::
call
(
'transfer.verifyNotifyCode'
,
compact
(
'orderno'
,
'code'
));
}
}
\ 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