commit | author | age
|
3e083b
|
1 |
<?php |
B |
2 |
|
|
3 |
/** |
|
4 |
* 支付响应页面 |
|
5 |
*/ |
|
6 |
|
|
7 |
define('IN_ECS', true); |
|
8 |
|
|
9 |
require(dirname(__FILE__) . '/includes/init.php'); |
|
10 |
require(ROOT_PATH . 'includes/lib_payment.php'); |
|
11 |
require(ROOT_PATH . 'includes/lib_order.php'); |
|
12 |
/* 支付方式代码 */ |
|
13 |
$pay_code = !empty($_REQUEST['code']) ? trim($_REQUEST['code']) : 'weixin'; |
|
14 |
|
|
15 |
//获取首信支付方式 |
|
16 |
if (empty($pay_code) && !empty($_REQUEST['v_pmode']) && !empty($_REQUEST['v_pstring'])) |
|
17 |
{ |
|
18 |
$pay_code = 'cappay'; |
|
19 |
} |
|
20 |
|
|
21 |
//获取快钱神州行支付方式 |
|
22 |
if (empty($pay_code) && ($_REQUEST['ext1'] == 'shenzhou') && ($_REQUEST['ext2'] == 'ecshop')) |
|
23 |
{ |
|
24 |
$pay_code = 'shenzhou'; |
|
25 |
} |
|
26 |
|
|
27 |
/* 参数是否为空 */ |
|
28 |
if (empty($pay_code)) |
|
29 |
{ |
|
30 |
$msg = $_LANG['pay_not_exist']; |
|
31 |
} |
|
32 |
else |
|
33 |
{ |
|
34 |
/* 检查code里面有没有问号 */ |
|
35 |
if (strpos($pay_code, '?') !== false) |
|
36 |
{ |
|
37 |
$arr1 = explode('?', $pay_code); |
|
38 |
$arr2 = explode('=', $arr1[1]); |
|
39 |
|
|
40 |
$_REQUEST['code'] = $arr1[0]; |
|
41 |
$_REQUEST[$arr2[0]] = $arr2[1]; |
|
42 |
$_GET['code'] = $arr1[0]; |
|
43 |
$_GET[$arr2[0]] = $arr2[1]; |
|
44 |
$pay_code = $arr1[0]; |
|
45 |
} |
|
46 |
|
|
47 |
/* 判断是否启用 */ |
|
48 |
$sql = "SELECT COUNT(*) FROM " . $ecs->table('payment') . " WHERE pay_code = '$pay_code' AND enabled = 1"; |
|
49 |
if ($db->getOne($sql) == 0) |
|
50 |
{ |
|
51 |
$msg = $_LANG['pay_disabled']; |
|
52 |
} |
|
53 |
else |
|
54 |
{ |
|
55 |
$plugin_file = ROOT_PATH.'includes/modules/payment/' . $pay_code . '.php'; |
|
56 |
|
|
57 |
/* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */ |
|
58 |
if (file_exists($plugin_file)) |
|
59 |
{ |
|
60 |
/* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */ |
|
61 |
include_once($plugin_file); |
|
62 |
|
|
63 |
$payment = new $pay_code(); |
|
64 |
$msg = (@$payment->respond()) ? $_LANG['pay_success'] : $_LANG['pay_fail']; |
|
65 |
} |
|
66 |
else |
|
67 |
{ |
|
68 |
$msg = $_LANG['pay_not_exist']; |
|
69 |
} |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
assign_template(); |
|
74 |
$position = assign_ur_here(); |
|
75 |
$smarty->assign('page_title', $position['title']); // 页面标题 |
|
76 |
$smarty->assign('ur_here', $position['ur_here']); // 当前位置 |
|
77 |
$smarty->assign('page_title', $position['title']); // 页面标题 |
|
78 |
$smarty->assign('ur_here', $position['ur_here']); // 当前位置 |
|
79 |
$smarty->assign('helps', get_shop_help()); // 网店帮助 |
|
80 |
|
|
81 |
$smarty->assign('message', $msg); |
|
82 |
$smarty->assign('shop_url', $ecs->url()); |
|
83 |
|
|
84 |
$smarty->display('respond.dwt'); |
|
85 |
|
|
86 |
?> |