测试添加新用户芯片

This commit is contained in:
hujiabin 2022-08-31 19:41:23 +08:00
parent 4e78ab7e8b
commit bc2a2679d3
2 changed files with 63 additions and 2 deletions

View File

@ -151,7 +151,7 @@ CREATE TABLE `t_hero` (
`last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`chip_ids` varchar(100) NOT NULL DEFAULT '0' COMMENT '已镶嵌的芯片idx组',
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
`skill_common` varchar(255) NOT NULL DEFAULT '100100|100120|100140|100160|100180|100200|100220|100240|100260|100280' COMMENT '通用技能',
`skill_points` int(11) NOT NULL DEFAULT '0' COMMENT '技能点',
PRIMARY KEY (`idx`),
@ -269,7 +269,7 @@ CREATE TABLE `t_gun` (
`last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`chip_ids` varchar(100) NOT NULL DEFAULT '0' COMMENT '已镶嵌的芯片idx组',
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
PRIMARY KEY (`idx`),
UNIQUE KEY `token_id` (`token_id`),
KEY `account_id` (`account_id`)

View File

@ -3,12 +3,14 @@
require_once('models/User.php');
require_once('models/Hero.php');
require_once('models/Season.php');
require_once('models/Nft.php');
require_once('mt/Parameter.php');
require_once('mt/Drop.php');
require_once('mt/Season.php');
require_once('mt/Hero.php');
require_once('mt/Rank.php');
require_once('mt/Item.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
@ -19,6 +21,7 @@ use phpcommon\SqlHelper;
use models\User;
use models\Hero;
use models\Season;
use models\Nft;
class UserController extends BaseAuthedController {
@ -35,6 +38,9 @@ class UserController extends BaseAuthedController {
$userInfo = $this->_safeGetOrmUserInfo();
if (!$userInfo) {
$this->createNewUser($userName, $avatarUrl);
$this->addChip();
$userInfo = $this->_getOrmUserInfo();
}
if (!$this->loginCheck($userInfo)) {
@ -46,6 +52,61 @@ class UserController extends BaseAuthedController {
$this->_incDailyV(TN_DAILY_LOGINS, 0, 1);
}
private function addChip(){
$list1 = [130001,130002,130003,130004,130005,130006,130007,130008,130009,130010];
$list2 = [130011,130012,130013,130014,130015,130016,130017];
for ($i=1;$i<=15;$i++){
$itemId1 = $list1[rand(0,9)];
$itemMeta = mt\Item::get($itemId1);
if ($itemMeta) {
$tokenType = Nft::getTokenType($itemMeta);
if ($tokenType == Nft::NONE_TYPE) {
// myself()->_rspErr(1, 'param item_id error');
return;
} else {
SqlHelper::insert(
myself()->_getMarketMysql(),
't_nft',
array(
'token_id' => myself()->_getNowTime()+$i+5,
'token_type' => $tokenType,
'game_id' => 2006,
'item_id' => $itemId1,
'owner_address' => myself()->_getOpenId(),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
}
}
for ($i=16;$i<=30;$i++){
$itemId = $list2[rand(0,7)];
$itemMeta = mt\Item::get($itemId);
if ($itemMeta) {
$tokenType = Nft::getTokenType($itemMeta);
if ($tokenType == Nft::NONE_TYPE) {
// myself()->_rspErr(1, 'param item_id error');
return;
} else {
SqlHelper::insert(
myself()->_getMarketMysql(),
't_nft',
array(
'token_id' => myself()->_getNowTime()+$i+5,
'token_type' => $tokenType,
'game_id' => 2006,
'item_id' => $itemId,
'owner_address' => myself()->_getOpenId(),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
}
}
}
private function loginCheck($userInfo)
{
$seasonService = new services\SeasonService();