shopgoods

This commit is contained in:
aozhiwei 2022-11-02 11:25:21 +08:00
parent 8ca3847914
commit a3cf01b7b2
6 changed files with 44 additions and 63 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;

View File

@ -37,7 +37,7 @@ class BlockChainController extends BaseAuthedController {
'trans_id' => $tran['trans_id'],
'item_id' => $tran['item_id'],
'action' => Transaction::getActionDesc($tran['action']),
'status' => Transaction::getActionDesc($tran['status']),
'status' => Transaction::getStatusDesc($tran['status']),
'time' => $tran['createtime'],
)
);

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

@ -14,9 +14,9 @@ class Transaction 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()
{
@ -56,6 +56,7 @@ class Transaction extends BaseModel {
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
'item_id' => $itemId,
'status' => self::CREATED_STATUS
)
);
}
@ -96,16 +97,16 @@ class Transaction 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;