添加后台代理代码

This commit is contained in:
2026-03-15 01:27:05 +08:00
parent 11f9ac4dc1
commit ea08c9366a
5254 changed files with 721042 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
header('Access-Control-Allow-Origin:*');// 指定允许其他域名访问
header('Access-Control-Allow-Methods:POST');// 响应类型
header('Access-Control-Allow-Headers:x-requested-with,content-type');
use phprs\util\Verify;
use phprs\util\exceptions\Forbidden;
use phprs\util\Logger;
use phprs\util\exceptions\NotFound;
use phprs\ezsql\Sql;
use phprs\util\exceptions\BadRequest;
/**
*
* 测试接口
* @path("/test")
*/
class Test extends apiBase{
/**
* 支付回调
* @route({"POST","/pay_notify"})
* @throws({"phprs\util\exceptions\Forbidden","res", "403 Forbidden",{"error":"Forbidden"}}) cookie不可用
*/
public function payNotify() {
$input = file_get_contents('php://input');
if ( !empty($input) ){
$data = json_decode($input,true);
file_put_contents("C:\\pay_test2.txt", count($data));
file_put_contents("C:\\pay_test.txt", "接收到的参数为:".$data['orderNo']."===".$data['signkey']);
$result = array();
// 处理业务逻辑 begin
// 比如修改订单状态
// 处理业务逻辑 end
// 返回0表示已经完成了逻辑的处理
// 如果不返回0则系统会重新发起请求连续8次
$result["error"] = 0;
echo json_encode($result);
} else {
file_put_contents("C:\\pay_test1.txt", "接收到的内容为空");
$result["1"] = 0;
echo json_encode($result);
}
}
/** @inject("ioc_factory") */
private $factory;
/**
* @property({"default":"@db"})
* @var PDO
*/
public $db;
}