...
This commit is contained in:
parent
95bb04db25
commit
12ac97878c
@ -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()
|
public function buyGoodsDS()
|
||||||
{
|
{
|
||||||
$idx = getReqVal('idx', 0);
|
$idx = getReqVal('idx', 0);
|
||||||
@ -760,7 +795,7 @@ class ShopController extends BaseAuthedController
|
|||||||
|
|
||||||
$sql = "UPDATE t_shop_dailyselection SET count_$grid = count_$grid - $count WHERE idx = $idx";
|
$sql = "UPDATE t_shop_dailyselection SET count_$grid = count_$grid - $count WHERE idx = $idx";
|
||||||
$chk = $conn->execScript($sql);
|
$chk = $conn->execScript($sql);
|
||||||
|
|
||||||
$itemMeta = mt\Item::get($item_id);
|
$itemMeta = mt\Item::get($item_id);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
@ -132,12 +132,12 @@ class BuyShopGoodsCbService
|
|||||||
$itemService = new ShopAddItemService();
|
$itemService = new ShopAddItemService();
|
||||||
$item_id = $goods['goods_id'];
|
$item_id = $goods['goods_id'];
|
||||||
$goods_num = $goods['goods_num'];
|
$goods_num = $goods['goods_num'];
|
||||||
|
|
||||||
$id = null;
|
$id = null;
|
||||||
if ($goods['id']) {
|
if ($goods['id']) {
|
||||||
$id = $goods['id'];
|
$id = $goods['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log(json_encode($goods));
|
error_log(json_encode($goods));
|
||||||
error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id);
|
error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id);
|
||||||
$itemService->addItem($address, $item_id, $goods_num);
|
$itemService->addItem($address, $item_id, $goods_num);
|
||||||
@ -146,17 +146,17 @@ class BuyShopGoodsCbService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAccountId($address){
|
private function getAccountId($address)
|
||||||
|
{
|
||||||
|
|
||||||
$row = SqlHelper::ormSelectOne
|
$row = SqlHelper::ormSelectOne(
|
||||||
(myself()->_getMysql($address),
|
myself()->_getMysql($address),
|
||||||
't_user',
|
't_user',
|
||||||
array(
|
array(
|
||||||
'address' => $address
|
'address' => $address
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $row['account_id'];
|
return $row['account_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user