- docker-compose.prod.yml:挂载 epay-ui.css/js/head.php 补丁到 staging(镜像升级不丢) - docker/nginx.conf:补丁静态资源 no-cache,改版立即生效 - patches/: - test.php 修复 paytype JSON 对象导致测试支付页空白 - epay-ui.css 后台全屏/侧栏加宽/导航两列布局覆盖 - epay-ui.js 去除页面容器宽度限制 + 侧栏当前菜单自动滚动 - head.php 资源 ?v= 版本号强制回源 - functions.php is_public_url 白名单等既有补丁 - plugins/ 支付插件源码 - .gitignore 排除 .env 等敏感与临时文件
51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
$nosession = true;
|
|
require './includes/common.php';
|
|
$act=isset($_GET['act'])?daddslashes($_GET['act']):null;
|
|
|
|
@header('Content-Type: application/json; charset=UTF-8');
|
|
|
|
if(!checkRefererHost())exit('{"code":403}');
|
|
|
|
switch($act){
|
|
case 'captcha_verify':
|
|
$pid=$_POST['pid'];
|
|
$trade_no=$_POST['trade_no'];
|
|
if(!$pid || !$trade_no)exit(json_encode(['code'=>-1, 'msg'=>'参数不完整']));
|
|
$captcha_result = verify_captcha4();
|
|
if($captcha_result !== true){
|
|
echo json_encode(['code'=>-1, 'msg'=>'验证失败,请重新验证']);
|
|
exit;
|
|
}
|
|
$key = time().getDefendKey($pid, $trade_no).random_int(111111,999999);
|
|
echo json_encode(['code'=>0, 'key'=>$key]);
|
|
break;
|
|
default:
|
|
$trade_no=isset($_GET['trade_no'])?daddslashes($_GET['trade_no']):exit('{"code":-2,"msg":"No trade_no!"}');
|
|
|
|
$row=$DB->getRow("SELECT * FROM pre_order WHERE trade_no=:trade_no limit 1", [':trade_no'=>$trade_no]);
|
|
|
|
// 异步回调延迟兜底:微信支付订单未入账时主动向微信查单(插件内10秒节流)
|
|
if($row && intval($row['status']) < 1 && intval($row['type']) == 2){
|
|
try{ \lib\Plugin::loadForPay('checkpaid/'.$trade_no.'/'); }catch(Throwable $e){}
|
|
$row=$DB->getRow("SELECT * FROM pre_order WHERE trade_no=:trade_no limit 1", [':trade_no'=>$trade_no]);
|
|
}
|
|
|
|
if($row['status']>=1){
|
|
// 支付完成5分钟后禁止跳转回网站
|
|
if(!empty($row['endtime']) && time() - strtotime($row['endtime']) > 300){
|
|
$jumpurl = '/payok.html';
|
|
}else{
|
|
$url=creat_callback($row);
|
|
$jumpurl = $url['return'];
|
|
}
|
|
if($row['status'] == 2){
|
|
$jumpurl = '/payerr.html';
|
|
}
|
|
echo json_encode(['code'=>1, 'msg'=>'付款成功', 'backurl'=>$jumpurl]);
|
|
}else{
|
|
echo json_encode(['code'=>-1, 'msg'=>'未付款']);
|
|
}
|
|
break;
|
|
}
|