This commit is contained in:
aozhiwei 2020-10-19 10:09:11 +08:00
parent 77366f1e23
commit 9cf4e6ad49
2 changed files with 39 additions and 32 deletions

View File

@ -1,20 +1,47 @@
<?php
require 'phpcommon/tglog.php';
class PayController {
protected function getMysql($accountid)
public function preOrder()
{
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$channel = phpcommon\extractChannel($_REQUEST['account_id']);
if (!empty($_REQUEST['poly_sdk_channel'])) {
$channel = $_REQUEST['poly_sdk_channel'];
}
if (!empty($_REQUEST['unified_channel'])) {
$channel = $_REQUEST['unified_channel'];
}
$sdk = sdkwarpper\createSdkByChannel($channel);
if (!$sdk) {
echo 'is null';
} else {
$sdk->preOrder();
}
}
public function payNotify()
{
error_log(json_encode($_REQUEST));
$channel = '';
if (isset($_REQUEST['_poly_sdk_channel'])) {
$channel = $_REQUEST['_poly_sdk_channel'];
} else {
$channel = $_REQUEST['_channel'];
}
$sdk = sdkwarpper\createSdkByChannel($channel);
if (!$sdk) {
echo 'is null';
} else {
$sdk->payNotify();
}
}
public function queryOrderInfo()
{
$mysql_conf = getMysqlConfig(crc32($accountid));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => 'paydb'
));
return $conn;
}
}

View File

@ -1,20 +0,0 @@
<?php
require 'phpcommon/tglog.php';
class PayNotifyController {
protected function getMysql($accountid)
{
$mysql_conf = getMysqlConfig(crc32($accountid));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => 'paydb'
));
return $conn;
}
}