Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ijianbo
rest Api To Miniprogram
提交
1e6d89a5
rest Api To Miniprogram
项目概览
ijianbo
/
rest Api To Miniprogram
通知
22
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
rest Api To Miniprogram
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1e6d89a5
编写于
4月 18, 2019
作者:
J
jianbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整支付代码,解决和其他插件使用腾讯官方支付示例代码引起的冲突。
上级
7bd4add3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
includes/api/ram-rest-payment-controller.php
includes/api/ram-rest-payment-controller.php
+11
-11
未找到文件。
includes/api/ram-rest-payment-controller.php
浏览文件 @
1e6d89a5
...
...
@@ -64,32 +64,32 @@ class RAW_REST_Payment_Controller extends WP_REST_Controller{
}
$appId
=
WxPayConfig
::
get_appid
();
$mchId
=
WxPayConfig
::
get_mchid
();
$key
=
WxPayConfig
::
get_key
();
$body
=
WxPayConfig
::
get_body
();
$appId
=
RAM_
WxPayConfig
::
get_appid
();
$mchId
=
RAM_
WxPayConfig
::
get_mchid
();
$key
=
RAM_
WxPayConfig
::
get_key
();
$body
=
RAM_
WxPayConfig
::
get_body
();
if
(
empty
(
$appId
)
||
empty
(
$mchId
)
||
empty
(
$key
)
||
empty
(
$body
))
{
return
new
WP_Error
(
'error'
,
"请填写AppID、商户号、商户支付密钥和支付描述"
,
array
(
'status'
=>
400
)
);
}
$tools
=
new
JsApiPay
();
$tools
=
new
RAM_
JsApiPay
();
//②、统一下单
$input
=
new
WxPayUnifiedOrder
();
$input
=
new
RAM_
WxPayUnifiedOrder
();
$input
->
SetBody
(
$body
);
$orderId
=
WxPayConfig
::
get_mchid
()
.
date
(
"YmdHis"
);
$orderId
=
RAM_
WxPayConfig
::
get_mchid
()
.
date
(
"YmdHis"
);
$input
->
SetOut_trade_no
(
$orderId
);
$input
->
SetTotal_fee
(
strval
(
$totalFee
*
100
));
//
$input->SetTotal_fee(strval($totalFee));
//
$input->SetTotal_fee(strval($totalFee*100));
$input
->
SetTotal_fee
(
strval
(
$totalFee
));
$input
->
SetTime_start
(
date
(
"YmdHis"
));
$input
->
SetTime_expire
(
date
(
"YmdHis"
,
time
()
+
600
));
$input
->
SetNotify_url
(
get_rest_url
(
null
,
$this
->
namespace
.
'/'
.
$this
->
resource_name
.
'/notify'
)
);
$input
->
SetTrade_type
(
'JSAPI'
);
$input
->
SetOpenid
(
$openId
);
$order
=
WxPayApi
::
unifiedOrder
(
$input
);
$order
=
RAM_
WxPayApi
::
unifiedOrder
(
$input
);
$jsApiParameters
=
$tools
->
GetJsApiParameters
(
$order
);
...
...
@@ -131,7 +131,7 @@ class RAW_REST_Payment_Controller extends WP_REST_Controller{
}
class
RAW_PayNotifyCallBack
extends
WxPayNotify
{
class
RAW_PayNotifyCallBack
extends
RAM_
WxPayNotify
{
// 重写回调处理函数
public
function
NotifyProcess
(
$data
,
&
$msg
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录