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

This commit is contained in:
hujiabin 2022-11-02 11:35:11 +08:00
commit a5f1bad99b
8 changed files with 67 additions and 72 deletions

View File

@ -791,7 +791,9 @@ CREATE TABLE `t_transaction` (
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
`action` int(11) NOT NULL DEFAULT '0' COMMENT 'action',
`item_uniid` int(11) NOT NULL DEFAULT '0' COMMENT '道具uniid',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'token_type',
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
@ -801,44 +803,3 @@ CREATE TABLE `t_transaction` (
KEY `account_id` (`account_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_shop_names`
--
DROP TABLE IF EXISTS `t_shop_names`;
CREATE TABLE `t_shop_names` (
`shopid` int(11) NOT NULL DEFAULT '0',
`shopname` varchar(16) DEFAULT NULL,
`refresh_type` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`shopid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `t_shop_goods`
--
-- ----------------------------
-- Table structure for t_shop_goods
-- ----------------------------
DROP TABLE IF EXISTS `t_shop_goods`;
CREATE TABLE `t_shop_goods` (
`id` int(11) NOT NULL,
`shop_id` int(11) DEFAULT NULL,
`shopstage` int(11) DEFAULT NULL,
`goods_id` int(11) DEFAULT NULL,
`tag` varchar(32) DEFAULT NULL,
`recommend` int(11) DEFAULT NULL,
`token_type` varchar(32) DEFAULT NULL,
`max_amount` int(11) NOT NULL DEFAULT '1',
`price` varchar(32) DEFAULT NULL,
`discount` varchar(32) DEFAULT NULL,
`discount_begin` varchar(32) DEFAULT NULL,
`discount_end` varchar(32) DEFAULT NULL,
`limit_type` int(11) DEFAULT NULL,
`limit_num` int(11) DEFAULT NULL,
`buy_cond` varchar(255) DEFAULT NULL,
`buy_gift` varchar(255) DEFAULT NULL,
`normal_gift` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

2
third_party/j7 vendored

@ -1 +1 @@
Subproject commit f98d9e8dfb0575f3c42795163bfbaa5c807a5935
Subproject commit 7533a5e7ed287378d33cb1bc3244487d33de7951

@ -1 +1 @@
Subproject commit 571b6c46137597d3bede13989e284130a070bea0
Subproject commit 848e05c01f44622e52996bb04dfb6b344acce1b8

View File

@ -36,8 +36,8 @@ class BlockChainController extends BaseAuthedController {
array(
'trans_id' => $tran['trans_id'],
'item_id' => $tran['item_id'],
'action' => Transaction::getActionDesc($tran['action']),
'status' => Transaction::getActionDesc($tran['status']),
'action' => Transaction::getActionDesc($tran),
'status' => Transaction::getStatusDesc($tran),
'time' => $tran['createtime'],
)
);
@ -54,7 +54,7 @@ class BlockChainController extends BaseAuthedController {
switch ($type) {
case 1:
{
$heroDb = Hero::find($uuid);
$heroDb = Hero::find($uniid);
if (!$heroDb) {
myself()->_rspErr(1, 'hero not found');
return;
@ -154,8 +154,11 @@ class BlockChainController extends BaseAuthedController {
private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId)
{
$params = array(
'c' => 'BcService',
'a' => 'activate721Nft',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $tokenId,
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
@ -168,10 +171,11 @@ class BlockChainController extends BaseAuthedController {
($url,
$params,
$response)) {
phpcommon\sendError(500, 'server internal error');
myself()->_rspErr(500, 'server internal error');
die();
return;
}
error_log($response);
$rspObj = json_decode($response, true);
if ($rspObj['errcode'] == 0) {
$transId = $rspObj['trans_id'];
@ -188,10 +192,19 @@ class BlockChainController extends BaseAuthedController {
'params' => $rspObj['params']
));
} else {
phpcommon\sendError(500, 'server internal error');
myself()->_rspErr(500, 'server internal error');
return;
}
}
}
private static function getWeb3ServiceUrl()
{
if (SERVER_ENV == _TEST) {
return 'http://127.0.0.1:7672/webapp/index.php';
}
$web3ServiceCluster = require_once('../config/web3service.cluster.php');
return $web3ServiceCluster[rand() % count($web3ServiceCluster)];
}
}

View File

@ -45,25 +45,19 @@ class ShopController extends BaseAuthedController {
public function getGoodsList()
{
$row = SqlHelper::ormSelect(
$this->_getSelfMysql(),
't_shop_goods',
array()
);
$goodsList = mt\ShopGoods::all();
$this->_rspData(array(
'goods_list' => $row ? $row : array(),
'goods_list' => $goodsList ? $goodsList : array(),
));
}
public function getShopNames()
{
$row = SqlHelper::ormSelect(
$this->_getSelfMysql(),
't_shop_names',
array()
);
$shopList = mt\Shop::all();
$this->_rspData(array(
'shop_name_list' => $row ? $row : array(),
'shop_name_list' => $shopList ? $shopList : array(),
));
}

View File

@ -5,7 +5,7 @@ namespace models;
use mt;
use phpcommon\SqlHelper;
class Transactionxo extends BaseModel {
class Transaction extends BaseModel {
const MINT_721_ACTION_TYPE = 1;
const MINT_1155_ACTION_TYPE = 2;
@ -14,9 +14,9 @@ class Transactionxo extends BaseModel {
const MINT_SHARD_BATCH_ACTION_TYPE = 5;
const SHARD_MIX_BY_USER_ACTION_TYPE = 6;
const CREATED_STATS = 1;
const REPORTED_STATS = 2;
const COMPLETED_STATS = 3;
const CREATED_STATUS = 1;
const REPORTED_STATUS = 2;
const COMPLETED_STATUS = 3;
public static function all()
{
@ -27,13 +27,13 @@ class Transactionxo extends BaseModel {
'account_id' => myself()->_getAccountId()
)
);
return rows;
return $rows;
}
public static function find($transId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMarketMysql(),
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId(),
@ -46,6 +46,7 @@ class Transactionxo extends BaseModel {
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId)
{
SqlHelper::insert(
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId(),
@ -55,6 +56,7 @@ class Transactionxo extends BaseModel {
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
'item_id' => $itemId,
'status' => self::CREATED_STATUS
)
);
}
@ -95,16 +97,16 @@ class Transactionxo extends BaseModel {
}
}
public static function getStatsDesc($transDb)
public static function getStatusDesc($transDb)
{
switch ($transDb['status']) {
case self::CREATED_STATS:
case self::REPORTED_STATS:
case self::CREATED_STATUS:
case self::REPORTED_STATUS:
{
return 'Pending';
}
break;
case self::COMPLETED_STATS:
case self::COMPLETED_STATUS:
{
return 'Complete';
}

View File

@ -13,6 +13,18 @@ class Shop {
return getXVal(self::getMetaList(), $id);
}
public static function all()
{
if (!self::$shopNameList) {
self::$shopNameList = array();
foreach(self::getMetaList() as $meta) {
array_push(self::$shopNameList, $meta);
}
}
return self::$shopNameList;
}
protected static function getMetaList()
{
if (!self::$metaList) {
@ -20,7 +32,8 @@ class Shop {
}
return self::$metaList;
}
protected static $shopNameList;
protected static $metaList;
}

View File

@ -20,6 +20,17 @@ class ShopGoods {
}
return $shopData['goodsList'];
}
public static function all()
{
if (!self::$goodsList) {
self::$goodsList = array();
foreach(self::getMetaList() as $meta) {
array_push(self::$goodsList, $meta);
}
}
return self::$goodsList;
}
public static function getGoodsInfo($shopId, $goodsId)
{
@ -56,6 +67,7 @@ class ShopGoods {
return self::$metaList;
}
protected static $goodsList;
protected static $shopGoodsHash;
protected static $metaList;