1
This commit is contained in:
commit
125d48b51e
@ -2194,7 +2194,7 @@ CREATE TABLE `t_rookie_task_value` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `t_hashrate_shop_buy_record`
|
||||
--
|
||||
|
||||
@ -2219,3 +2219,39 @@ CREATE TABLE `t_hashrate_shop_buy_record` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_lucky_symbol`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_lucky_symbol`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_lucky_symbol` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`in_use_num` int(11) NOT NULL DEFAULT '0' COMMENT '使用中数量',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE 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_lucky_symbol_record`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_lucky_symbol_record`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_lucky_symbol_record` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_uuid',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `uk_room_uuid_account_id` (`room_uuid`, `account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -62,6 +62,7 @@ CREATE TABLE `t_hashrate_shop_buy_record` (
|
||||
UNIQUE KEY `account_id_goods_id` (`account_id`, `goods_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
CREATE TABLE `t_circuit_task_value` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
@ -73,6 +74,27 @@ CREATE TABLE `t_circuit_task_value` (
|
||||
UNIQUE KEY `account_id_task` (`account_id`, `task_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `t_lucky_symbol` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`in_use_num` int(11) NOT NULL DEFAULT '0' COMMENT '使用中数量',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `account_id` (`account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `t_lucky_symbol_record` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_uuid',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `uk_room_uuid_account_id` (`room_uuid`, `account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
insert into version (version) values(2024092401);
|
||||
|
||||
commit;
|
||||
|
@ -15,7 +15,7 @@ require_once('models/User.php');
|
||||
require_once('models/RealtimeData.php');
|
||||
require_once('models/ChipPage.php');
|
||||
require_once('models/Chip.php');
|
||||
|
||||
require_once('models/LuckySymbol.php');
|
||||
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
@ -31,6 +31,7 @@ use models\User;
|
||||
use models\RealtimeData;
|
||||
use models\ChipPage;
|
||||
use models\Chip;
|
||||
use models\LuckySymbol;
|
||||
use services\LogService;
|
||||
|
||||
class BagController extends BaseAuthedController {
|
||||
@ -134,6 +135,11 @@ class BagController extends BaseAuthedController {
|
||||
$this->useSealDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
|
||||
}
|
||||
break;
|
||||
case mt\Item::LUCKY_SYMBOL_SUBTYPE:
|
||||
{
|
||||
$this->useSymbol($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
$this->_rspErr(4, 'The prop function has not been realized yet');
|
||||
@ -880,4 +886,24 @@ class BagController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
private function useSymbol($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3)
|
||||
{
|
||||
if (LuckySymbol::hasLuckySymbol()) {
|
||||
$this->_rspErr(201, "alreay use");
|
||||
return ;
|
||||
}
|
||||
$this->_decItems(array(
|
||||
array(
|
||||
'item_id' => $itemMeta['id'],
|
||||
'item_num' => 1
|
||||
)
|
||||
));
|
||||
LuckySymbol::add();
|
||||
$this->propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'award' => $this->awardService->toDto(),
|
||||
'property_chg' => $this->propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -986,12 +986,33 @@ class BattleController extends BaseAuthedController {
|
||||
{
|
||||
$data = array();
|
||||
foreach ($member['battle_items'] as $item) {
|
||||
$itemMeta = mt\Item::get($item['item_id']);
|
||||
if ($itemMeta['type'] == mt\Item::FUNC_TYPE &&
|
||||
$itemMeta['sub_type'] == mt\Item::LUCKY_SYMBOL_SUBTYPE) {
|
||||
$luckyRecord = myself()->_callModelStatic('LuckySymbolRecord', 'find', $roomUuid);
|
||||
if (empty($luckyRecord)) {
|
||||
if (myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol')) {
|
||||
myself()->_callModelStatic('LuckySymbol', 'dec');
|
||||
myself()->_callModelStatic('LuckySymbolRecord', 'add', $roomUuid);
|
||||
array_push($data, array(
|
||||
'item_id' => $item['item_id'],
|
||||
'item_num' => 1,
|
||||
));
|
||||
}
|
||||
} else {
|
||||
array_push($data, array(
|
||||
'item_id' => $item['item_id'],
|
||||
'item_num' => 1,
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$itemCount = Bag::getItemCount($item['item_id']);
|
||||
array_push($data, array(
|
||||
'item_id' => $item['item_id'],
|
||||
'item_num' => $item['item_num'],
|
||||
));
|
||||
}
|
||||
}
|
||||
$info['items'] = $data;
|
||||
}
|
||||
|
||||
|
@ -377,6 +377,7 @@ class UserController extends BaseAuthedController {
|
||||
$userInfo['total_lucky'] = Hero::getAccountLuckyTemp();
|
||||
$userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo);
|
||||
$userInfo['circuit_score'] = myself()->_callModelStatic('Circuit', 'getCurrentMyScore');
|
||||
$userInfo['has_lucky_symbol'] = myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol');
|
||||
}
|
||||
$heroDb = Hero::findByAccountId(myself()->_getAccountId(), $userInfo['hero_uniid']);
|
||||
if (!$heroDb) {
|
||||
@ -416,6 +417,7 @@ class UserController extends BaseAuthedController {
|
||||
$userInfo['total_lucky'] = Hero::getAccountLuckyTemp();
|
||||
$userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo);
|
||||
$userInfo['circuit_score'] = myself()->_callModelStatic('Circuit', 'getCurrentMyScore');
|
||||
$userInfo['has_lucky_symbol'] = myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol');
|
||||
}
|
||||
$heroDb = Hero::findByAccountId(myself()->_getAccountId(), $userInfo['hero_uniid']);
|
||||
if (!$heroDb) {
|
||||
@ -456,6 +458,7 @@ class UserController extends BaseAuthedController {
|
||||
$userInfo['total_lucky'] = Hero::getAccountLuckyTemp();
|
||||
$userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo);
|
||||
$userInfo['circuit_score'] = myself()->_callModelStatic('Circuit', 'getCurrentMyScore');
|
||||
$userInfo['has_lucky_symbol'] = myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol');
|
||||
}
|
||||
$heroDb = Hero::findByAccountId(myself()->_getAccountId(), $heroUniId);
|
||||
if (!$heroDb) {
|
||||
|
59
webapp/models/LuckySymbol.php
Normal file
59
webapp/models/LuckySymbol.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class LuckySymbol extends BaseModel {
|
||||
|
||||
public static function hasLuckySymbol()
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_lucky_symbol',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
)
|
||||
);
|
||||
$has = empty($row) ? false : $row['in_use_num'] > 0;
|
||||
return $has ? 1 : 0;
|
||||
}
|
||||
|
||||
public static function dec()
|
||||
{
|
||||
SqlHelper::update
|
||||
(myself()->_getSelfMysql(),
|
||||
't_lucky_symbol',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
),
|
||||
array(
|
||||
'in_use_num' => 0,
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function add()
|
||||
{
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
't_lucky_symbol',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
),
|
||||
array(
|
||||
'in_use_num' => function () { return "in_use_num + 1";},
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'in_use_num' => 1,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
43
webapp/models/LuckySymbolRecord.php
Normal file
43
webapp/models/LuckySymbolRecord.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class LuckySymbolRecord extends BaseModel {
|
||||
|
||||
public static function find($roomUuid)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_lucky_symbol_record',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'room_uuid' => $roomUuid,
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function add($roomUuid)
|
||||
{
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
't_lucky_symbol_record',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'room_uuid' => $roomUuid,
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'room_uuid' => $roomUuid,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,7 @@ class StakingVipService extends BaseService
|
||||
myself()->_getMarketMysql(),
|
||||
't_vip_user',
|
||||
array(
|
||||
'account_address' => $accountAddr,
|
||||
'account_address' => strtolower($accountAddr),
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user