This commit is contained in:
songliang 2023-07-13 17:16:50 +08:00
parent 6b56380ec0
commit de8e9722e6
6 changed files with 73 additions and 9 deletions

View File

@ -204,13 +204,15 @@ class ShopController extends BaseAuthedController
$this->_rspErr(1, 'goods_num is invalid'); $this->_rspErr(1, 'goods_num is invalid');
} }
$conn = myself()->_getMysql(''); $conn = myself()->_getSelfMysql();
$address = myself()->_getAddress(); $address = myself()->_getAddress();
if (!$address) { if (!$address) {
$this->_rspErr(1, 'address is empty'); $this->_rspErr(1, 'address is empty');
} }
error_log("address: {$address}, id: {$id}, token_type: {$token_type}, goods_num: {$goods_num} " . $goods['goods_id'], json_encode($goods));
$chk = SqlHelper::insert( $chk = SqlHelper::insert(
$conn, $conn,
't_shop_buy_order', 't_shop_buy_order',

View File

@ -1,8 +1,14 @@
<?php <?php
namespace services; namespace services;
require_once('MarketCallbackBase.php');
class MarketBuyOrderOk use services\MarketCallbackBase;
use phpcommon\SqlHelper;
class MarketBuyOrderOk extends MarketCallbackBase
{ {
public function process() public function process()
{ {
@ -33,7 +39,7 @@ class MarketBuyOrderOk
) )
); );
$conn = myself()->_getSelfMysql(); $conn = myself()->_getMysql('');
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status', 'idx', 'c_name', 'token_type'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status', 'idx', 'c_name', 'token_type'), array('o_link' => $orderId));

View File

@ -0,0 +1,44 @@
<?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']);
}
}
}

View File

@ -1,8 +1,12 @@
<?php <?php
namespace services; namespace services;
require_once('MarketCallbackBase.php');
class MarketCancelOrderOk use services\MarketCallbackBase;
use phpcommon\SqlHelper;
class MarketCancelOrderOk extends MarketCallbackBase
{ {
public function process() public function process()
{ {
@ -22,7 +26,7 @@ class MarketCancelOrderOk
) )
); );
$conn = myself()->_getSelfMysql(); $conn = myself()->_getMysql('');
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));

View File

@ -1,8 +1,12 @@
<?php <?php
namespace services; namespace services;
require_once('MarketCallbackBase.php');
class MarketPriceUpdateOrderOk use services\MarketCallbackBase;
use phpcommon\SqlHelper;
class MarketPriceUpdateOrderOk extends MarketCallbackBase
{ {
public function process() public function process()
{ {
@ -26,7 +30,7 @@ class MarketPriceUpdateOrderOk
) )
); );
$conn = myself()->_getSelfMysql(); $conn = myself()->_getMysql('');
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));

View File

@ -1,8 +1,12 @@
<?php <?php
namespace services; namespace services;
require_once('MarketCallbackBase.php');
class MarketSellOrderOk use services\MarketCallbackBase;
use phpcommon\SqlHelper;
class MarketSellOrderOk extends MarketCallbackBase
{ {
public function process() public function process()
{ {
@ -31,7 +35,7 @@ class MarketSellOrderOk
) )
); );
$conn = myself()->_getSelfMysql(); $conn = myself()->_getMysql('');
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));