Merge branch 'james' of git.kingsome.cn:server/game2006api into james

This commit is contained in:
hujiabin 2022-11-02 14:28:44 +08:00
commit 5e23cc455a
6 changed files with 52 additions and 105 deletions

View File

@ -18,6 +18,19 @@ class BlockChain(object):
['!transactions', [_common.NftTransaction()], '交易列表'] ['!transactions', [_common.NftTransaction()], '交易列表']
] ]
}, },
{
'name': 'reportResult',
'desc': '上报链调用结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
{ {
'name': 'active721Nft', 'name': 'active721Nft',
'desc': '激活721nft', 'desc': '激活721nft',
@ -47,19 +60,6 @@ class BlockChain(object):
['!params', [''], '合约参数列表'], ['!params', [''], '合约参数列表'],
] ]
}, },
{
'name': 'reportActiveResult',
'desc': '上报激活结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportActiveResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
{ {
'name': 'evolve721Nft', 'name': 'evolve721Nft',
'desc': 'nft进阶(英雄,武器)', 'desc': 'nft进阶(英雄,武器)',
@ -76,19 +76,6 @@ class BlockChain(object):
['!params', [''], '合约参数列表'], ['!params', [''], '合约参数列表'],
] ]
}, },
{
'name': 'reportEvolve721NftResult',
'desc': '上报nft进阶(英雄、武器)结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportEvolve721NftResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
{ {
'name': 'evolveChip', 'name': 'evolveChip',
'desc': '芯片进阶', 'desc': '芯片进阶',
@ -104,19 +91,6 @@ class BlockChain(object):
['!params', [''], '合约参数列表'], ['!params', [''], '合约参数列表'],
] ]
}, },
{
'name': 'reportEvolveChipResult',
'desc': '上报芯片进阶结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportEvolveChipResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
{ {
'name': 'mintShardBatchUser', 'name': 'mintShardBatchUser',
'desc': '碎片生成', 'desc': '碎片生成',
@ -131,19 +105,6 @@ class BlockChain(object):
['!params', [''], '合约参数列表'], ['!params', [''], '合约参数列表'],
] ]
}, },
{
'name': 'reportMintShardBatchUserResult',
'desc': '上报碎片生成结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportMintShardBatchUserResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
{ {
'name': 'shardMixByUser', 'name': 'shardMixByUser',
'desc': '碎片合成', 'desc': '碎片合成',
@ -158,18 +119,5 @@ class BlockChain(object):
['trans_id', '', '事务id'], ['trans_id', '', '事务id'],
['!params', [''], '合约参数列表'], ['!params', [''], '合约参数列表'],
] ]
}, }
{
'name': 'reportShardMixByUserUserResult',
'desc': '上报碎片合成结果',
'group': 'BlockChain',
'url': 'webapp/index.php?c=BlockChain&a=reportShardMixByUserResult',
'params': [
['trans_id', '', '事务id'],
['result', '', '合约返回值'],
],
'response': [
_common.RspHead(),
]
},
] ]

View File

@ -69,7 +69,7 @@ class Shop(object):
'name': 'getShopNames', 'name': 'getShopNames',
'desc': '获取商店名称', 'desc': '获取商店名称',
'group': 'Shop', 'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=getShowNames', 'url': 'webapp/index.php?c=Shop&a=getShopNames',
'params': [ 'params': [
_common.ReqHead() _common.ReqHead()
], ],

View File

@ -796,6 +796,7 @@ CREATE TABLE `t_transaction` (
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
`client_result` mediumblob COMMENT 'client_result',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),

View File

@ -106,9 +106,12 @@ class BlockChainController extends BaseAuthedController {
} }
public function reportActiveResult() public function reportResult()
{ {
$transId = getReqVal('trans_id', '');
$result = getReqVal('result', '');
Transaction::reportResult($transId, $result);
myself()->_rspOk();
} }
public function evolve721Nft() public function evolve721Nft()
@ -116,41 +119,21 @@ class BlockChainController extends BaseAuthedController {
} }
public function reportEvolve721NftResult()
{
}
public function evolveChip() public function evolveChip()
{ {
} }
public function reportEvolveChipResult()
{
}
public function mintShardBatchUser() public function mintShardBatchUser()
{ {
} }
public function reportMintShardBatchUserResult()
{
}
public function shardMixByUser() public function shardMixByUser()
{ {
} }
public function reportShardMixByUserResult()
{
}
private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId)
{ {
$params = array( $params = array(

View File

@ -67,13 +67,7 @@ class ShopController extends BaseAuthedController {
$token_type = getReqVal('token_type', ''); $token_type = getReqVal('token_type', '');
$goods_num = getReqVal('goods_num', 0); $goods_num = getReqVal('goods_num', 0);
$row = SqlHelper::ormSelectOne( $row = mt\ShopGoods::get($id);
$this->_getSelfMysql(),
't_shop_goods',
array(
'id' => $id,
)
);
$desired_token_type = $row['token_type']; $desired_token_type = $row['token_type'];
$check_token_type = splitStr1($desired_token_type); $check_token_type = splitStr1($desired_token_type);
@ -93,9 +87,7 @@ class ShopController extends BaseAuthedController {
switch ($row['limit_type']) { switch ($row['limit_type']) {
case ShopController::DAILY_BUY_LIMIT: case ShopController::DAILY_BUY_LIMIT:
{ {
$buyRecord = getXVal($buyRecordHash, $id); $buyRecord = getXVal($buyRecordHash, $id);
echo "===========".json_encode($buyRecord)."-------".$row['limit_num']."..".getXVal($buyRecord, 'this_day_buy_times', 0);
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1; $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1;
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) { if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) {
$this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today');
@ -147,10 +139,20 @@ class ShopController extends BaseAuthedController {
$need_price = $price_array[$token_pos]; $need_price = $price_array[$token_pos];
$discount = $discount_array[$token_pos]; $discount = $discount_array[$token_pos];
$discount_begin = strtotime($row['discount_begin'].' UTC');
$discount_end = strtotime($row['discount_end'].' UTC');
$nowTime = $this->_getNowTime();
if ($nowTime>=$discount_begin && $nowTime<$discount_end) {
$need_price = ceil($need_price * ($discount / 100.0));
}
$costItemId = $this->getCostItemIdByTokenType($token_type); $costItemId = $this->getCostItemIdByTokenType($token_type);
switch($token_type) { switch($token_type) {
case ShopController::TOKEN_TYPE_CEG: case ShopController::TOKEN_TYPE_CEG:
case ShopController::TOKEN_TYPE_CEC:
$costItems = $this->makeCostItems($costItemId, $goods_num*$need_price); $costItems = $this->makeCostItems($costItemId, $goods_num*$need_price);
$lackItem = null; $lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) { if (!$this->_hasEnoughItems($costItems, $lackItem)) {
@ -193,11 +195,6 @@ class ShopController extends BaseAuthedController {
)); ));
break; break;
case ShopController::TOKEN_TYPE_CEC:
echo "token type: {$token_type} {$need_price} {$discount}";
break;
case ShopController::TOKEN_TYPE_BCEG: case ShopController::TOKEN_TYPE_BCEG:
break; break;

View File

@ -56,7 +56,9 @@ class Transaction extends BaseModel {
'token_type' => $tokenType, 'token_type' => $tokenType,
'item_uniid' => $itemUniId, 'item_uniid' => $itemUniId,
'item_id' => $itemId, 'item_id' => $itemId,
'status' => self::CREATED_STATUS 'status' => self::CREATED_STATUS,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
) )
); );
} }
@ -118,4 +120,20 @@ class Transaction extends BaseModel {
} }
} }
public static function reportResult($transId, $result)
{
SqlHelper::update(
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId(),
'trans_id' => $transId
),
array(
'client_result' => $result,
'modifytime' => myself()->_getNowTime()
)
);
}
} }