-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpay.php
143 lines (130 loc) · 5.7 KB
/
pay.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
define('IN_SMT', true);
define('IN_MYMPS', true);
define('CURSCRIPT','pay');
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once dirname(__FILE__)."/include/global.php";
require_once MYMPS_DATA."/config.php";
require_once MYMPS_DATA."/config.db.php";
require_once MYMPS_INC."/db.class.php";
$act = empty($act) ? 'pay' : $act;
if ($act == 'pay' && !empty($payid)) {
require_once MYMPS_INC."/member.class.php";
if(!$log = $member_log->chk_in()) write_msg("","../".$mymps_global['cfg_member_logfile']."?url=".urlencode(GetUrl()));
$uid = $db -> getOne("SELECT id FROM `{$db_mymps}member` WHERE userid='{$s_uid}'");
$pay_config = $db->getRow("SELECT * FROM `{$db_mymps}payapi` WHERE payid={$payid} AND isclose=0");
if (empty($pay_config)) {
die();
}
if ($pay_config['paytype'] == 'wxpay') {
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$row = $db->getRow("SELECT * FROM `{$db_mymps}property` WHERE id={$id}");
if ($row['status'] == 'Y') {
write_msg('헝蕎路릿連마', '?m=property&status=Y');
}
$money = floatval($row['manage_fee']+$row['water_fee']+$row['electric_fee']+$row['other_fee']);
if (!empty($id) && !empty($money)) {
require_once MYMPS_INC.'/payment/wxpay/lib/WxPay.Api.php';
require_once MYMPS_INC.'/payment/wxpay/code/WxPay.NativePay.php';
require_once MYMPS_INC.'/payment/wxpay/code/log.php';
$notify = new NativePay();
$input = new WxPayUnifiedOrder();
$body = iconv('gbk', 'utf-8', '膠撚심롤');
$out_trade_no = date("YmdHis").uniqid();
$input->SetBody($body);
$input->SetAttach($body);
$input->SetOut_trade_no($out_trade_no);
$input->SetTotal_fee($money * 100);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
//$input->SetGoods_tag($body);
$input->SetNotify_url("http://www.cs0663.cn/notify.php");
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($id);
$result = $notify->GetPayUrl($input);
$url = $result["code_url"];
if (!empty($url)) {
include_once MYMPS_INC.'/pay.fun.php';
topaymoney($money,$out_trade_no,$uid,$s_uid,'wxpay', $id);//畇흙된덤連마션쩌
}
$data = array(
'no' => $out_trade_no,
'url' => 'http://'.$_SERVER['HTTP_HOST'].'/pay.php?act=qr&url='.$url,
);
echo json_encode($data);exit;
}
} elseif ($pay_config['paytype'] == 'alipay_new') {
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
if(!empty($id)){
$payr = $pay_config;
$row = $db->getRow("SELECT * FROM {$db_mymps}property WHERE id={$id}");
if ($row['status'] == 'Y') {
write_msg('헝蕎路릿連마', '?m=property&status=Y');
}
$money = floatval($row['manage_fee']+$row['water_fee']+$row['electric_fee']+$row['other_fee']);
$relation_id = $id;
$productname = '膠撚심롤';
include MYMPS_INC.'/pay.fun.php';
msetcookie("pay_type",$pay_type,0);
//럿쀼뒈囹품留
$PayReturnUrlQz=$mymps_global['SiteUrl'];
if($charset=='utf-8'){
@header('Content-Type: text/html; charset=utf-8');
}
include MYMPS_INC.'/payment/'.$payr['paytype'].'/to_pay.php';
}
}
} elseif ($act == 'return') {
$type = isset($_GET['type'])?trim($_GET['type']):null;
if ($type == 'ant') {
require_once MYMPS_INC . '/payment/alipay_new/return_url.php';
} elseif($type == 'wx') {
require_once MYMPS_ROOT."/m/common.fun.php";
$out_trade_no = isset($_GET['out_trade_no'])?trim($_GET['out_trade_no']):null;
if (empty($out_trade_no)) {
redirectmsg('連마呵겨', $mymps_global['SiteUrl']."/m/index.php?mod=member");
}
$id = $db->getOne("SELECT relation_id FROM {$db_mymps}payrecord WHERE orderid='{$out_trade_no}'");
if (empty($id)) {
redirectmsg('連마呵겨', $mymps_global['SiteUrl']."/m/index.php?mod=member");
}
$row = $db->getRow("SELECT * FROM {$db_mymps}property WHERE id={$id}");
if ($row['status'] == 'Y') {
redirectmsg('連마냥묘', $mymps_global['SiteUrl']."/m/index.php?mod=member");
} else {
redirectmsg('連마呵겨', $mymps_global['SiteUrl']."/m/index.php?mod=member");
}
}
} elseif ($act == 'qr') {
$url = isset($_GET['url'])?urldecode(trim($_GET['url'])):null;
if (!empty($url)) {
require_once MYMPS_INC.'/payment/wxpay/code/phpqrcode/phpqrcode.php';
QRcode::png($url);
exit();
}
} elseif ($act == 'order') {
require_once MYMPS_INC."/member.class.php";
$log = $member_log->chk_in();
$uid = $db -> getOne("SELECT id FROM `{$db_mymps}member` WHERE userid='{$s_uid}'");
if(!$log) {
echo 'error';exit;
}
$id = isset($_GET['id'])?intval($_GET['id']):0;
if (empty($id)) {
echo 'error';exit;
}
include_once MYMPS_INC.'/pay.fun.php';
$out_trade_no = 'wap_' . date('YmdHis') . uniqid();
$row = $db->getRow("SELECT * FROM ".$db_mymps."property WHERE id={$id}");
if (empty($row)) {
echo 'error';exit;
}
$money = $row['manage_fee'] + $row['water_fee'] + $row['electric_fee'] + $row['other_fee'];
topaymoney($money,$out_trade_no,$uid,$s_uid,'wxpay', $id);
echo $out_trade_no;exit;
}
is_object($db) && $db->Close();
$cachetime && $cachepages->caching();
$city = $maincity = $advertisement =NULL;
unset($city,$maincity,$advertisement);