1
This commit is contained in:
parent
d3d9561ca9
commit
4331033a9b
@ -236,7 +236,9 @@ CREATE TABLE `t_season` (
|
|||||||
`total_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季积分',
|
`total_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季积分',
|
||||||
`max_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高积分',
|
`max_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高积分',
|
||||||
`gift_state1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买状态 0:未购 1:已购',
|
`gift_state1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买状态 0:未购 1:已购',
|
||||||
|
`gift_buytime1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买时间',
|
||||||
`gift_state2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买状态 0:未购 1:已购',
|
`gift_state2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买状态 0:未购 1:已购',
|
||||||
|
`gift_buytime2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买时间',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
require_once('models/User.php');
|
require_once('models/User.php');
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
|
require_once('models/Season.php');
|
||||||
|
require_once('models/SeasonCard.php');
|
||||||
|
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
require_once('mt/Drop.php');
|
require_once('mt/Drop.php');
|
||||||
require_once('mt/Season.php');
|
require_once('mt/Season.php');
|
||||||
|
require_once('mt/SeasonCard.php');
|
||||||
|
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
require_once('services/SeasonService.php');
|
require_once('services/SeasonService.php');
|
||||||
@ -13,6 +16,8 @@ require_once('services/SeasonService.php');
|
|||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\User;
|
use models\User;
|
||||||
use models\Hero;
|
use models\Hero;
|
||||||
|
use models\Season;
|
||||||
|
use models\SeasonCard;
|
||||||
|
|
||||||
class SeasonCardController extends BaseAuthedController {
|
class SeasonCardController extends BaseAuthedController {
|
||||||
|
|
||||||
@ -38,6 +43,10 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
$this->userInfo = $this->_safeGetOrmUserInfo();
|
$this->userInfo = $this->_safeGetOrmUserInfo();
|
||||||
$this->propertyChgService->addUserChg();
|
$this->propertyChgService->addUserChg();
|
||||||
}
|
}
|
||||||
|
$this->seasonDb = Season::find($this->currSeasonMeta['id']);
|
||||||
|
if (!$this->seasonDb) {
|
||||||
|
$this->seasonDb = Season::find($this->currSeasonMeta['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function info()
|
public function info()
|
||||||
@ -80,6 +89,7 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
$this->_rspErr(2, '不能重复购买');
|
$this->_rspErr(2, '不能重复购买');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Season::updateGiftPackageState($this->currSeasonMeta['id'], $packageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getGiftPackages()
|
private function getGiftPackages()
|
||||||
|
@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
namespace models;
|
namespace models;
|
||||||
|
|
||||||
require_once('mt/Item.php');
|
require_once('mt/SeasonCard.php');
|
||||||
|
|
||||||
use mt;
|
use mt;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
class Season extends BaseModel {
|
class Season extends BaseModel {
|
||||||
|
|
||||||
public static function find($itemId)
|
public static function find($seasonId)
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getSelfMysql(),
|
||||||
't_bag',
|
't_season',
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'item_id' => $itemId,
|
'season_id' => $seasonId,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return $row;
|
return $row;
|
||||||
@ -25,9 +25,51 @@ class Season extends BaseModel {
|
|||||||
public static function toDto($row)
|
public static function toDto($row)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'item_id' => $row['item_id'],
|
|
||||||
'item_num' => $row['item_num'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function add($seasonId)
|
||||||
|
{
|
||||||
|
$initSeasonCard = mt\SeasonCard::getInitCard();
|
||||||
|
SqlHelper::upsert(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_season',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'season_id' => $seasonId,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'season_id' => $seasonId,
|
||||||
|
'card_lv' => $initSeasonCard ? $initSeasonCard['id'] : 1,
|
||||||
|
'card_exp' => $initSeasonCard ? $initSeasonCard['min_exp'] : 0,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateGiftPackageState($seasonId, $packageId)
|
||||||
|
{
|
||||||
|
if (in_array($packageId, array(
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
))) {
|
||||||
|
SqlHelper::update(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_season',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'season_id' => $seasonId,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
"gift_state${packageId}" => 1,
|
||||||
|
"gift_buytime${packageId}" => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
29
webapp/mt/SeasonCard.php
Normal file
29
webapp/mt/SeasonCard.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mt;
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
|
||||||
|
class SeasonCard {
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
|
{
|
||||||
|
return getXVal(self::getMetaList(), $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInitCard($id)
|
||||||
|
{
|
||||||
|
return self::get(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function getMetaList()
|
||||||
|
{
|
||||||
|
if (!self::$metaList) {
|
||||||
|
self::$metaList = getMetaTable('seasonCard@seasonCard.php');
|
||||||
|
}
|
||||||
|
return self::$metaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static $metaList;
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user