-
Notifications
You must be signed in to change notification settings - Fork 33
/
wxpay_notify_url.php
30 lines (27 loc) · 929 Bytes
/
wxpay_notify_url.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/*
* 付费阅读异步回调
*/
include '../../../config.inc.php';
require_once 'libs/payjs.php';
date_default_timezone_set('Asia/Shanghai');
$db = Typecho_Db::get();
$options = Typecho_Widget::widget('Widget_Options');
$option=$options->plugin('TeePay');
$data = $_POST;
if($data['return_code'] == 1){
$payjs = new Payjs("","",$option->payjs_wxpay_key,"");
$sign_verify = $data['sign'];
unset($data['sign']);
if($payjs->sign($data) == $sign_verify&&$data['total_fee']==$data['attach']*100){
$updateItem = $db->update('table.teepay_fees')->rows(array('feestatus'=>1))->where('feeid=?',$data["out_trade_no"]);
$updateItemRows= $db->query($updateItem);
echo 'success';exit();
}else{
$db = Typecho_Db::get();
$updateItem = $db->update('table.teepay_fees')->rows(array('feestatus'=>2))->where('feeid=?',$_POST['out_trade_no']);
$updateItemRows= $db->query($updateItem);
echo 'fail';exit();
}
}
?>