This commit is contained in:
songliang 2023-07-07 14:57:31 +08:00
parent 95bb04db25
commit 12ac97878c
2 changed files with 46 additions and 11 deletions

View File

@ -700,6 +700,41 @@ class ShopController extends BaseAuthedController
}
}
public function buyDiamond()
{
$num = getReqVal('num', 0);
$price = $this->normalizeWeb3Price($num);
$item_id = V_ITEM_DIAMOND;
$item_count = $num;
$response = services\BlockChainService::gameItemMallBuy(
Transaction::BUY_GOODS_ACTION_TYPE,
$price,
$item_id,
$item_count
);
BcOrder::upsert($response['trans_id'], array(
'item_id' => $item_id,
'item_num' => $item_count,
'order_type' => 1,
'ext_data' => json_encode(array(
'mode' => SHOP_BUY_MODE_NORMAL,
)),
));
$response['item_id'] = $item_id;
$response['item_num'] = $item_count;
error_log("buy diamond, item_id = " . $item_id . " item_count = " . $item_count . " num = " . $num . " price = " . $price . " response = " . json_encode($response));
$this->_rspData(
array(
"block_chain" => $response
)
);
}
public function buyGoodsDS()
{
$idx = getReqVal('idx', 0);

View File

@ -146,17 +146,17 @@ class BuyShopGoodsCbService
}
}
private function getAccountId($address){
private function getAccountId($address)
{
$row = SqlHelper::ormSelectOne
(myself()->_getMysql($address),
$row = SqlHelper::ormSelectOne(
myself()->_getMysql($address),
't_user',
array(
'address' => $address
'address' => $address
)
);
);
return $row['account_id'];
}
}
}