1
This commit is contained in:
parent
cb47c75760
commit
2e8588f155
@ -537,4 +537,97 @@ CREATE TABLE `gun_skin` (
|
||||
UNIQUE KEY `accountid_gun_id_skin_id` (`accountid`, `gun_id`,`skin_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_user`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_user`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_user` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`name` tinyblob COMMENT '用户名字',
|
||||
`sex` int(11) NOT NULL DEFAULT '0' COMMENT '性别',
|
||||
`head_id` int(11) NOT NULL DEFAULT '0' COMMENT '头像id',
|
||||
`head_frame` int(11) NOT NULL DEFAULT '0' COMMENT '头像框id',
|
||||
`level` int(11) NOT NULL DEFAULT '0' COMMENT '等级',
|
||||
`exp` int(11) NOT NULL DEFAULT '0' COMMENT '经验',
|
||||
`gold` int(11) NOT NULL DEFAULT '0' COMMENT '金币',
|
||||
`diamond` int(11) NOT NULL DEFAULT '0' COMMENT '钻石',
|
||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
|
||||
`first_fight` 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 `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_hero`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_hero`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_hero` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid',
|
||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
|
||||
`hero_lv` int(11) NOT NULL DEFAULT '0' COMMENT '英雄等级',
|
||||
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤id',
|
||||
`skill1_lv1` int(11) NOT NULL DEFAULT '1' COMMENT '必杀技等级',
|
||||
`skill1_lv2` int(11) NOT NULL DEFAULT '1' COMMENT '躲避技能等级',
|
||||
`yoke_exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前羁绊等级的经验',
|
||||
`yoke_total_exp` 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 `accountid_hero_id` (`accountid`, `hero_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_hero_skin`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_hero_skin`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_hero_skin` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid',
|
||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
|
||||
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id',
|
||||
`skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=已经购,1 = 试用状态',
|
||||
`get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买',
|
||||
`consume_num` int(11) NOT NULL DEFAULT '0' COMMENT '消耗货币的具体数量',
|
||||
`trytime` 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 `accountid_heroid_skinid` (`accountid`, `hero_id`, `skin_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_bag`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_bag`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_bag` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`color_id` int(11) NOT NULL DEFAULT '0' COMMENT '颜色id',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:上阵中,1:已获得,2:未获得)',
|
||||
`active_time` varchar(50) NOT NULL DEFAULT '' COMMENT '有效时间(体验时间)',
|
||||
`item_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 `item_uuid` (`accountid`, `item_id`),
|
||||
KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
@ -225,45 +225,44 @@ class BaseAuthedController extends BaseController {
|
||||
}
|
||||
return $isVirtualItem;
|
||||
}
|
||||
|
||||
protected function addItem($items)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
error_log("准备添加道具======".json_encode($items));
|
||||
if ($this->isVirtualItem($item['item_id'])) {
|
||||
if ($item['item_id'] == $this->goldID) {
|
||||
$this->addGold($item['item_num']);
|
||||
error_log("添加金币=====".$item['item_num']);
|
||||
}
|
||||
else if ($item['item_id'] == $this->lotteryID){
|
||||
$this->addLottery($item['item_num']);
|
||||
error_log("添加奖券=====".$item['item_num']);
|
||||
}
|
||||
} else {
|
||||
phpcommon\SqlHelper::insertOrUpdate
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'bag',
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $item['item_id']
|
||||
'item_id' => $item['item_id']
|
||||
),
|
||||
array(
|
||||
'item_num' => function () use($item) { return "item_num + {$item['item_num']}";},
|
||||
'modifytime' => $this->getNowTime()
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $item['item_id'],
|
||||
'item_id' => $item['item_id'],
|
||||
'color_id' => 0,
|
||||
'status' =>1,
|
||||
'active_time' => '',
|
||||
'num' => $item['item_num'],
|
||||
'create_time' => $this->getNowTime(),
|
||||
'modify_time' => $this->getNowTime()
|
||||
),
|
||||
array(
|
||||
'num' => function () use($item) { return "num + {$item['item_num']}";},
|
||||
'modify_time' => $this->getNowTime()
|
||||
'status' => 1,
|
||||
'active_time' => 0,
|
||||
'item_num' => $item['item_num'],
|
||||
'createtime' => $this->getNowTime(),
|
||||
'modifytime' => $this->getNowTime()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function decItem($items)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
@ -530,6 +529,22 @@ class BaseAuthedController extends BaseController {
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDtoUser($userInfo)
|
||||
{
|
||||
return array(
|
||||
'name' => $userInfo['user_name'],
|
||||
'sex' => $userInfo['sex'],
|
||||
'head_id' => $userInfo['hi_id'],
|
||||
'head_frame' => $userInfo['head_kuang_id'],
|
||||
'level' => $userInfo['lv'],
|
||||
'exp' => $userInfo['lv_exp'],
|
||||
'gold' => $userInfo['coin_num'],
|
||||
'diamond' => $userInfo['diamond_num'],
|
||||
'hero_id' => $userInfo['hero_id'],
|
||||
'first_fight' => $userInfo['first_fight'],
|
||||
);
|
||||
}
|
||||
|
||||
protected function addHero($heroMeta)
|
||||
{
|
||||
if (!$heroMeta) {
|
||||
@ -537,22 +552,22 @@ class BaseAuthedController extends BaseController {
|
||||
}
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'hero',
|
||||
't_hero',
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $heroId
|
||||
'hero_id' => $heroMeta['id']
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $heroMeta['id'],
|
||||
'lv' => 1,
|
||||
'skinid' => $heroMeta['skin_id'],
|
||||
'hero_id' => $heroMeta['id'],
|
||||
'hero_lv' => 1,
|
||||
'skin_id' => $heroMeta['skin_id'],
|
||||
'skill1_lv1' => 1,
|
||||
'skill1_lv2' => 1,
|
||||
'yokeexp' => 0,
|
||||
'yoketotalexp' => 0,
|
||||
'yoke_exp' => 0,
|
||||
'yoke_total_exp' => 0,
|
||||
'createtime' => $this->getNowTime(),
|
||||
'modifytime' => $this->getNowTime()
|
||||
)
|
||||
@ -567,7 +582,7 @@ class BaseAuthedController extends BaseController {
|
||||
{
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'hero_skin',
|
||||
't_hero_skin',
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'hero_id' => $heroId,
|
||||
|
@ -50,7 +50,7 @@ class BaseController {
|
||||
));
|
||||
}
|
||||
|
||||
protected function rspData($data)
|
||||
protected function rspDataOld($data)
|
||||
{
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
@ -59,6 +59,18 @@ class BaseController {
|
||||
));
|
||||
}
|
||||
|
||||
protected function rspData($data)
|
||||
{
|
||||
$rawData = array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
);
|
||||
foreach ($data as $key => $val) {
|
||||
$rawData[$key] = $val;
|
||||
}
|
||||
echo json_encode($rawData);
|
||||
}
|
||||
|
||||
protected function rspRawData($rawData)
|
||||
{
|
||||
echo json_encode($rawData);
|
||||
|
@ -28,7 +28,7 @@ class GunController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
);
|
||||
$this->rspData($data);
|
||||
$this->rspDataOld($data);
|
||||
}
|
||||
|
||||
public function skillLvUp()
|
||||
|
@ -19,55 +19,33 @@ class UserController extends BaseAuthedController {
|
||||
{
|
||||
//$user_name = $_REQUEST['name'];
|
||||
//$avatar_url = $_REQUEST['avatar_url'];
|
||||
$user_name = '极乐玩家';
|
||||
$avatar_url = '18003';
|
||||
$userName = '极乐玩家';
|
||||
$avatarUrl = '18003';
|
||||
|
||||
$userInfo = $this->safeGetOrmUserInfo();
|
||||
if (!$userInfo) {
|
||||
$this->createNewUser();
|
||||
$this->createNewUser($userName, $avatarUrl);
|
||||
$userInfo = $this->getOrmUserInfo();
|
||||
}
|
||||
if ($this->loginCheck($userInfo)) {
|
||||
if (!$this->loginCheck($userInfo)) {
|
||||
$userInfo = $this->getOrmUserInfo();
|
||||
}
|
||||
$dtoUser = $this->getDtoUserInfo($userInfo);
|
||||
$dtoUser['errcode'] = 0;
|
||||
$dtoUser['errmsg'] = '';
|
||||
$this->rspRawData($dtoUser);
|
||||
$dtoUser = $this->getDtoUser($userInfo);
|
||||
$this->rspData(array(
|
||||
'info' => $dtoUser
|
||||
));
|
||||
}
|
||||
|
||||
private function loginCheck($userInfo)
|
||||
{
|
||||
$fieldsKv = array();
|
||||
if ($userInfo['vip_score'] >= 5 && $userInfo['act_ad_status'] != 2) {
|
||||
$fieldsKv['act_ad_status'] = 1;
|
||||
}
|
||||
if (($this->getNowDaySeconds() - phpcommon\getDaySeconds($userInfo['update_time']) > 0)) {
|
||||
if ($userInfo['new_second_equip'] == 2 && $userInfo['new_first_equip'] == 1) {
|
||||
$fieldsKv['new_second_equip'] = 1;
|
||||
}
|
||||
$fieldsKv['daily_first_login'] = 0;
|
||||
$fieldsKv['free_box'] = 0;
|
||||
$fieldsKv['kefu_status'] = 0;
|
||||
$fieldsKv['coin_times'] = 0;
|
||||
$fieldsKv['first_day_ad'] = 0;
|
||||
$fieldsKv['share_video_times'] = 0;
|
||||
$fieldsKv['daily_max_single'] = 0;
|
||||
$fieldsKv['daily_score'] = 0;
|
||||
$fieldsKv['daily_offline'] = 0;
|
||||
}
|
||||
if (count($fieldsKv) > 0) {
|
||||
$fieldsKv['modify_time'] = $this->getNowTime();
|
||||
$this->updateUserInfo($fieldsKv);
|
||||
}
|
||||
return count($fieldsKv) > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function createNewUser()
|
||||
private function createNewUser($userName, $avatarUrl)
|
||||
{
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'user',
|
||||
't_user',
|
||||
array(
|
||||
'accountid' => $this->getAccountId()
|
||||
),
|
||||
@ -75,22 +53,21 @@ class UserController extends BaseAuthedController {
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'user_name' => $user_name,
|
||||
'avatar_url' => $avatar_url,
|
||||
'coin_num' => 10000,
|
||||
'season_status' => 1,
|
||||
'newInfo' => '',
|
||||
'new_second_equip' => 2,
|
||||
'head_kuang_id' => 19003,
|
||||
'name' => $userName,
|
||||
#'avatar_url' => $avatar_url,
|
||||
'gold' => 10000,
|
||||
#'season_status' => 1,
|
||||
#'newInfo' => '',
|
||||
#'new_second_equip' => 2,
|
||||
'head_frame' => 19003,
|
||||
'sex' => 2,
|
||||
'hi_id' => 18001,
|
||||
'head_id' => 18001,
|
||||
'hero_id' => 30100,
|
||||
'integral' => 0,
|
||||
'season_time' => mt\Season::getCurrSeasonTime(),
|
||||
'team_name' => '',
|
||||
'create_time' => phpcommon\getNowTime(),
|
||||
'modify_time' => phpcommon\getNowTime(),
|
||||
'update_time' => phpcommon\getNowTime(),
|
||||
#'integral' => 0,
|
||||
#'season_time' => mt\Season::getCurrSeasonTime(),
|
||||
#'team_name' => '',
|
||||
'create_time' => $this->getNowTime(),
|
||||
'modify_time' => $this->getNowTime(),
|
||||
)
|
||||
);
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user