Files
2026-03-15 01:27:05 +08:00

55 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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;
}