Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
quxiu
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
quxiu
Commits
1123a6d0
Commit
1123a6d0
authored
Apr 23, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
faced26d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
22 deletions
+36
-22
wxpay/lib/WxPay.Config.php
+11
-11
wxpay/pay/notify_jsapi.php
+25
-11
No files found.
wxpay/lib/WxPay.Config.php
View file @
1123a6d0
...
...
@@ -10,23 +10,23 @@ class WxPayConfig
/**
* TODO: 修改这里配置为您自己申请的商户信息
* 微信公众号信息配置
*
*
* APPID:绑定支付的APPID(必须配置,开户邮件中可查看)
*
*
* MCHID:商户号(必须配置,开户邮件中可查看)
*
*
* KEY:商户支付密钥,参考开户邮件设置(必须配置,登录商户平台自行设置)
* 设置地址:https://pay.weixin.qq.com/index.php/account/api_cert
*
*
* APPSECRET:公众帐号secert(仅JSAPI支付的时候需要配置, 登录公众平台,进入开发者中心可设置),
* 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
* @var string
*/
const
APPID
=
'wx3
645f04b42fe43b
3'
;
const
MCHID
=
'15
600858
31'
;
const
KEY
=
'
mengyazhibo201900000000000000000
'
;
const
APPSECRET
=
'
4779b480b03c2fdad73073d10abd6b5f
'
;
const
APPID
=
'wx3
7327dbb9d7b33f
3'
;
const
MCHID
=
'15
874724
31'
;
const
KEY
=
'
hkLfAAmPx6TxsinuyciefzFivk6yE4r4
'
;
const
APPSECRET
=
'
7f8291af4e0795ee375f66487a721627
'
;
//=======【证书路径设置】=====================================
/**
* TODO:设置商户证书路径
...
...
@@ -36,7 +36,7 @@ class WxPayConfig
*/
const
SSLCERT_PATH
=
'../cert/apiclient_cert.pem'
;
const
SSLKEY_PATH
=
'../cert/apiclient_key.pem'
;
//=======【curl代理设置】===================================
/**
* TODO:这里设置代理机器,只有需要代理的时候才设置,不需要代理,请设置为0.0.0.0和0
...
...
@@ -46,7 +46,7 @@ class WxPayConfig
*/
const
CURL_PROXY_HOST
=
"0.0.0.0"
;
//"10.152.18.220";
const
CURL_PROXY_PORT
=
0
;
//8080;
//=======【上报信息配置】===================================
/**
* TODO:接口调用上报等级,默认紧错误上报(注意:上报超时间为【1s】,上报无论成败【永不抛出异常】,
...
...
wxpay/pay/notify_jsapi.php
View file @
1123a6d0
...
...
@@ -12,6 +12,19 @@ $log = Log::Init($logHandler, 15);
class
PayNotifyCallBack
extends
WxPayNotify
{
public
function
share
(
$link
,
$id
,
$coin
)
{
$userSql
=
mysqli_query
(
$link
,
"select * from cmf_users where id='
$id
' "
);
$user
=
mysqli_fetch_assoc
(
$userSql
);
if
(
$user
[
'pid'
]
>
0
)
{
$config
=
getConfig
(
$link
);
$invite_reward
=
!
empty
(
$config
[
'invite_reward'
])
?
$config
[
'invite_reward'
]
:
0
;
$coin2
=
(
$coin
*
$invite_reward
)
/
100
;
$c
=
(
int
)
$coin2
;
mysqli_query
(
$link
,
"update cmf_users set i_votes=i_votes+
{
$c
}
where id=
{
$user
[
'pid'
]
}
"
);
}
}
//查询订单
public
function
Queryorder
(
$transaction_id
)
{
...
...
@@ -41,14 +54,15 @@ class PayNotifyCallBack extends WxPayNotify
if
(
$row
){
$coin
=
$row
[
'coin'
]
+
$row
[
'coin_give'
];
$link
->
query
(
"update cmf_users set coin=coin+
{
$coin
}
where id='
$row[touid]
'"
);
$link
->
query
(
"update cmf_users_charge set status='1',trade_no='
{
$transaction_id
}
' where id=
{
$row
[
'id'
]
}
"
);
Log
::
DEBUG
(
"支付成功"
);
$link
->
query
(
"update cmf_users_charge set status='1',trade_no='
{
$transaction_id
}
' where id=
{
$row
[
'id'
]
}
"
);
share
(
$link
,
$row
[
'touid'
],
$coin
);
Log
::
DEBUG
(
"支付成功"
);
}
else
{
Log
::
DEBUG
(
$out_trade_no
.
' 订单信息不存在'
);
}
}
else
{
Log
::
DEBUG
(
"数据库链接失败"
);
}
}
}
else
{
$link
=
mysql_connect
(
"mysql"
,
"zhibo"
,
"Rni43v7RpkWUP9FD"
);
if
(
$link
){
...
...
@@ -61,29 +75,29 @@ class PayNotifyCallBack extends WxPayNotify
if
(
$row
){
$coin
=
$row
[
'coin'
]
+
$row
[
'coin_give'
];
mysql_query
(
"update cmf_users set coin=coin+
{
$coin
}
where id='
$row[touid]
'"
);
mysql_query
(
"update cmf_users_charge set status='1',trade_no='
{
$transaction_id
}
' where id=
{
$row
[
'id'
]
}
"
);
Log
::
DEBUG
(
"支付成功"
);
mysql_query
(
"update cmf_users_charge set status='1',trade_no='
{
$transaction_id
}
' where id=
{
$row
[
'id'
]
}
"
);
Log
::
DEBUG
(
"支付成功"
);
}
else
{
Log
::
DEBUG
(
$out_trade_no
.
' 订单信息不存在'
);
}
}
else
{
Log
::
DEBUG
(
"数据库链接失败"
);
}
}
}
return
true
;
}
return
false
;
}
//重写回调处理函数
public
function
NotifyProcess
(
$data
,
&
$msg
)
{
Log
::
DEBUG
(
"call back:"
.
json_encode
(
$data
));
$notfiyOutput
=
array
();
if
(
!
array_key_exists
(
"transaction_id"
,
$data
)){
$msg
=
"输入参数不正确"
;
return
false
;
...
...
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