1
This commit is contained in:
parent
effbf3122e
commit
83fb821a14
@ -102,6 +102,7 @@ class BlockChain(object):
|
|||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['trans_id', '', '事务id'],
|
['trans_id', '', '事务id'],
|
||||||
|
['order_id', '', '订单id'],
|
||||||
['!params', [''], '合约参数列表'],
|
['!params', [''], '合约参数列表'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@ use models\BcOrder;
|
|||||||
use models\Mall;
|
use models\Mall;
|
||||||
use models\TransactionPrefee;
|
use models\TransactionPrefee;
|
||||||
|
|
||||||
use services\BlockChainService;
|
use BlockChainService;
|
||||||
|
|
||||||
class BlockChainController extends BaseAuthedController {
|
class BlockChainController extends BaseAuthedController {
|
||||||
|
|
||||||
@ -396,22 +396,21 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rspObj = services\BlockChainService::gameItemMarketBuy(
|
$rspObj = BlockChainService::gameItemMarketBuy(
|
||||||
Transaction::BUY_GOODS_FROM_MARKET_ACTION_TYPE,
|
Transaction::BUY_GOODS_FROM_MARKET_ACTION_TYPE,
|
||||||
$goods['seller_address'],
|
$goodsDb['seller_address'],
|
||||||
$goods['currency'],
|
$goodsDb['currency'],
|
||||||
$goods['price'],
|
$goodsDb['price'],
|
||||||
$goods['item_id'],
|
$goodsDb['item_id'],
|
||||||
$goods['item_num']
|
$goodsDb['item_num'],
|
||||||
|
$goodsDb['order_id']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$this->markOrderBuyStatus($idx)) {
|
Mall::buy($goodsUuid, $address);
|
||||||
myself()-_rspErr(1, 'buy failed, update order status failed, idx:' . $idx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'trans_id' => $rspObj['trans_id'],
|
'trans_id' => $rspObj['trans_id'],
|
||||||
|
'order_id' => $goodsDb['order_id'],
|
||||||
'params' => $rspObj['params'],
|
'params' => $rspObj['params'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,21 @@ class Mall extends BaseModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function buy($goodsUuid, $buyer)
|
||||||
|
{
|
||||||
|
SqlHelper::update
|
||||||
|
(myself()->_getMysql(''),
|
||||||
|
't_mall',
|
||||||
|
array(
|
||||||
|
'goods_uuid' => $goodsUuid
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'last_buyer' => $buyer,
|
||||||
|
'last_buy_time' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function toDto($row)
|
public static function toDto($row)
|
||||||
{
|
{
|
||||||
$cancelCd = -1;
|
$cancelCd = -1;
|
||||||
|
@ -103,7 +103,7 @@ class BlockChainService {
|
|||||||
c
|
c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function gameItemMarketBuy($actionType, $owner_address, $currency, $price, $itemId, $itemNum)
|
public static function gameItemMarketBuy($actionType, $owner_address, $currency, $price, $itemId, $itemNum, $orderId)
|
||||||
{
|
{
|
||||||
if (!($actionType > Transaction::BUY_BEGIN_ACTION_TYPE &&
|
if (!($actionType > Transaction::BUY_BEGIN_ACTION_TYPE &&
|
||||||
$actionType < Transaction::BUY_END_ACTION_TYPE)) {
|
$actionType < Transaction::BUY_END_ACTION_TYPE)) {
|
||||||
@ -126,6 +126,7 @@ class BlockChainService {
|
|||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'seller' => $owner_address,
|
'seller' => $owner_address,
|
||||||
|
'order_id' => $orderId,
|
||||||
'net_id' => NET_ID
|
'net_id' => NET_ID
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user