...
This commit is contained in:
parent
ab4bcf3ad2
commit
0b5a86dd32
@ -997,19 +997,19 @@ class ShopController extends BaseAuthedController
|
||||
$this->internalAddItem($propertyChgService, $itemMeta, $goods_count, 1);
|
||||
$this->_rspOk();
|
||||
} else {
|
||||
error_log("buy normal 1, need_price = ". $need_price . " goods_num = " . $goods_num);
|
||||
error_log("buy normal 1, need_price = " . $need_price . " goods_num = " . $goods_num);
|
||||
$price = $this->normalizeWeb3Price($goods_num * $need_price);
|
||||
error_log("buy normal 2, price = " . $price);
|
||||
$item_id = $row['goods_id'];
|
||||
$item_count = $goods_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,
|
||||
@ -1020,11 +1020,11 @@ class ShopController extends BaseAuthedController
|
||||
'id' => $id,
|
||||
)),
|
||||
));
|
||||
|
||||
|
||||
$response['item_id'] = $item_id;
|
||||
$response['item_num'] = $item_count;
|
||||
$this->_rspData(
|
||||
array(
|
||||
array(
|
||||
"block_chain" => $response
|
||||
)
|
||||
);
|
||||
@ -1098,15 +1098,16 @@ class ShopController extends BaseAuthedController
|
||||
$price = $this->normalizeWeb3Price($goods['price'] * $count);
|
||||
$item_id = $goods['goods_id'];
|
||||
$item_count = $goods['goods_num'] * $count;
|
||||
error_log("buyGoodsDS start " . json_encode(array(
|
||||
'idx' => $idx,
|
||||
'grid' => $grid,
|
||||
'count' => $count,
|
||||
'goodPrice' => $goods['price'],
|
||||
'price' => $price,
|
||||
'item_id' => $item_id,
|
||||
'item_count' => $item_count,
|
||||
)
|
||||
error_log("buyGoodsDS start " . json_encode(
|
||||
array(
|
||||
'idx' => $idx,
|
||||
'grid' => $grid,
|
||||
'count' => $count,
|
||||
'goodPrice' => $goods['price'],
|
||||
'price' => $price,
|
||||
'item_id' => $item_id,
|
||||
'item_count' => $item_count,
|
||||
)
|
||||
));
|
||||
$response = services\BlockChainService::gameItemMallBuy(
|
||||
Transaction::BUY_GOODS_ACTION_TYPE,
|
||||
@ -1127,12 +1128,13 @@ class ShopController extends BaseAuthedController
|
||||
)),
|
||||
));
|
||||
|
||||
error_log("buyGoodsDS start " . json_encode(array(
|
||||
'idx' => $idx,
|
||||
'grid' => $grid,
|
||||
'count' => $count,
|
||||
'block_chain' => $response,
|
||||
)
|
||||
error_log("buyGoodsDS start " . json_encode(
|
||||
array(
|
||||
'idx' => $idx,
|
||||
'grid' => $grid,
|
||||
'count' => $count,
|
||||
'block_chain' => $response,
|
||||
)
|
||||
));
|
||||
|
||||
$this->_rspData(
|
||||
@ -1168,7 +1170,7 @@ class ShopController extends BaseAuthedController
|
||||
$itemStore = mt\ShopChest::getRandomItemListByChestType($recommend);
|
||||
|
||||
$result = array();
|
||||
for ($i=0; $i<$num; $i++) {
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$record = array();
|
||||
foreach ($itemStore as $key => $value) {
|
||||
$item = $this->weighted_random($value);
|
||||
@ -1181,16 +1183,16 @@ class ShopController extends BaseAuthedController
|
||||
$this->internalAddItem($propertyChgService, $itemMeta, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$record[$key] = array( "item_id" => $item['item_id'], "item_num" => $item['num'] );
|
||||
$record[$key] = array("item_id" => $item['item_id'], "item_num" => $item['num']);
|
||||
array_push($result, $record[$key]);
|
||||
}
|
||||
array_push($result, $record);
|
||||
}
|
||||
|
||||
error_log("buyBlindBox start " . json_encode(array(
|
||||
'account' => $account,
|
||||
'itemListStore' => $result,
|
||||
)
|
||||
error_log("buyBlindBox start " . json_encode(
|
||||
array(
|
||||
'account' => $account,
|
||||
'itemListStore' => $result,
|
||||
)
|
||||
));
|
||||
|
||||
$this->_rspData(
|
||||
@ -1544,7 +1546,7 @@ class ShopController extends BaseAuthedController
|
||||
$this->_addVirtualItem($itemMeta['id'], $count, null, $propertyChgService);
|
||||
$propertyChgService->addUserChg();
|
||||
// 充值就尝试开启首充活动
|
||||
if ($sysAdd!=1) {
|
||||
if ($sysAdd != 1) {
|
||||
if ($itemMeta['id'] == 10001) {
|
||||
$this->beginFirstTupop();
|
||||
}
|
||||
@ -1645,50 +1647,48 @@ class ShopController extends BaseAuthedController
|
||||
return phpcommon\bnToStr($ret_price);
|
||||
}
|
||||
|
||||
private function countFreeBuyTimes($goods) {
|
||||
private function countFreeBuyTimes($goods)
|
||||
{
|
||||
$conn = myself()->_getMysql('');
|
||||
$account = myself()->_getAccountId();
|
||||
|
||||
switch($goods['free_type'])
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
$dayTime = myself()->_getNowDaySeconds();
|
||||
$sql = 'SELECT COUNT(*) as cnt FROM t_shop_free_record WHERE account_id = ? AND `id` = ? AND goods_id = ? AND createtime >= ?';
|
||||
$row = $conn->execQueryOne($sql, array($account, $goods['id'], $goods['goods_id'], $dayTime));
|
||||
return $row['cnt'];
|
||||
}
|
||||
break;
|
||||
|
||||
switch ($goods['free_type']) {
|
||||
case 1: {
|
||||
$dayTime = myself()->_getNowDaySeconds();
|
||||
$sql = 'SELECT COUNT(*) as cnt FROM t_shop_free_record WHERE account_id = ? AND `id` = ? AND goods_id = ? AND createtime >= ?';
|
||||
$row = $conn->execQueryOne($sql, array($account, $goods['id'], $goods['goods_id'], $dayTime));
|
||||
return $row['cnt'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function addFreeBuyRecord($goods) {
|
||||
private function addFreeBuyRecord($goods)
|
||||
{
|
||||
$conn = myself()->_getMysql('');
|
||||
$account = myself()->_getAccountId();
|
||||
|
||||
switch($goods['free_type'])
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
$dayTime = myself()->_getNowTime();
|
||||
SqlHelper::insert(
|
||||
$conn,
|
||||
't_shop_free_record',
|
||||
array(
|
||||
'account_id' => $account,
|
||||
'shop_id' => $goods['shop_id'],
|
||||
'id' => $goods['id'],
|
||||
'goods_id' => $goods['goods_id'],
|
||||
'goods_num' => $goods['goods_num'],
|
||||
'free_type' => $goods['free_type'],
|
||||
'free_num' => $goods['free_num'],
|
||||
'createtime' => $dayTime,
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
switch ($goods['free_type']) {
|
||||
case 1: {
|
||||
$dayTime = myself()->_getNowTime();
|
||||
SqlHelper::insert(
|
||||
$conn,
|
||||
't_shop_free_record',
|
||||
array(
|
||||
'account_id' => $account,
|
||||
'shop_id' => $goods['shop_id'],
|
||||
'id' => $goods['id'],
|
||||
'goods_id' => $goods['goods_id'],
|
||||
'goods_num' => $goods['goods_num'],
|
||||
'free_type' => $goods['free_type'],
|
||||
'free_num' => $goods['free_num'],
|
||||
'createtime' => $dayTime,
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user