45 lines
796 B
PHP
45 lines
796 B
PHP
<?php
|
|
|
|
namespace services;
|
|
|
|
use phpcommon\SqlHelper;
|
|
|
|
class MarketCallbackBase
|
|
{
|
|
public function _rspOk()
|
|
{
|
|
echo json_encode(array(
|
|
'errcode' => 0,
|
|
'errmsg' => "callback success",
|
|
));
|
|
}
|
|
|
|
public function _rspErr($errcode, $errmsg)
|
|
{
|
|
if (SERVER_ENV != _ONLINE) {
|
|
error_log(json_encode(array(
|
|
'errcode' => $errcode,
|
|
'errmsg' => $errmsg,
|
|
)));
|
|
}
|
|
echo json_encode(array(
|
|
'errcode' => $errcode,
|
|
'errmsg' => $errmsg,
|
|
));
|
|
}
|
|
|
|
protected function addTransactionRecord($record)
|
|
{
|
|
$conn = myself()->_getMysql('');
|
|
|
|
$r = SqlHelper::insert(
|
|
$conn,
|
|
't_market_transaction_record',
|
|
$record
|
|
);
|
|
if (!$r) {
|
|
$this->_rspErr(2, 'unknown error, orderId=' . $record['orderid']);
|
|
}
|
|
}
|
|
}
|