算力任务补充
This commit is contained in:
parent
a6dc020742
commit
6a8d0d5806
@ -18,7 +18,7 @@ class InGameMall(object):
|
||||
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
||||
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
||||
['price_filter', '', '价格过滤(用|分割)'],
|
||||
['type_filter', '', '类型过滤 1:英雄 2:芯片 3:英雄碎片 4:芯片碎片 5:其它'],
|
||||
['type_filter', '', '类型过滤 1:英雄皮肤 2:芯片 3:英雄碎片 11:其它(材料、宝箱)'],
|
||||
['item_filter', '', 'itemId过滤(用|分割)'],
|
||||
['quality_filter', '', '品质过滤'],
|
||||
],
|
||||
|
@ -22,8 +22,6 @@ define('V_ITEM_STAR', 10011); //星星
|
||||
define('V_ITEM_PASS', 10012); //通行证
|
||||
define('V_ITEM_RESET_CARD', 10013); //重置卡
|
||||
define('V_ITEM_REVIVE_COIN', 140001); //复活币
|
||||
define('V_ITEM_HERO_META', 100005); //英雄升级材料
|
||||
define('V_ITEM_GUN_META', 100006); //枪械升级材料
|
||||
define('V_ITEM_CHIP_META', 100007); //芯片升级材料
|
||||
define('V_ITEM_GOLD_BULLION_1W', 10017); //金砖1w
|
||||
define('V_ITEM_GOLD_BULLION_10W', 10018); //金砖10w
|
||||
@ -81,6 +79,16 @@ define('TN_WEEKLY_RECHARGE_UPGRADE_TIMES', 10004);
|
||||
define('TN_WEEKLY_SHARE_GAMES', 10005);
|
||||
define('TN_WEEKLY_END', 10005);
|
||||
|
||||
|
||||
|
||||
define('TN_HASH_RATE_DIAMOND_CONSUME', 50001);
|
||||
define('TN_HASH_RATE_GOLD_CONSUME', 50002);
|
||||
define('TN_HASH_RATE_SYN_HERO_TIMES', 50003);
|
||||
define('TN_HASH_RATE_SYN_CHIP_TIMES', 50004);
|
||||
define('TN_HASH_RATE_SYN_SKIN_TIMES', 50005);
|
||||
define('TN_HASH_RATE_UP_HERO_TIMES', 50006);
|
||||
define('TN_HASH_RATE_UP_CHIP_TIMES', 50007);
|
||||
|
||||
define('SHOP_BUY_MODE_NORMAL', 0);
|
||||
define('SHOP_BUY_MODE_DAILY_SELECTION', 1);
|
||||
define('MARKET_BUY_MODE_NORMAL', 2);
|
||||
|
@ -352,7 +352,6 @@ class BaseAuthedController extends BaseController {
|
||||
return "gold + ${itemNum}";
|
||||
}
|
||||
));
|
||||
$this->_incPeriodV(TN_TOTAL_GATHER_GOLD,0,$itemNum);
|
||||
}
|
||||
break;
|
||||
case V_ITEM_DIAMOND:
|
||||
@ -456,6 +455,7 @@ class BaseAuthedController extends BaseController {
|
||||
|
||||
$this->_updateUserInfo($fieldsKv);
|
||||
$this->_incDailyV(TN_DAILY_USED_GOLD_NUM, 0, $itemNum);
|
||||
$this->_incPeriodV(TN_HASH_RATE_GOLD_CONSUME, 0, $itemNum);
|
||||
}
|
||||
break;
|
||||
case V_ITEM_DIAMOND:
|
||||
|
@ -173,7 +173,7 @@ class ChipController extends BaseAuthedController
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
));
|
||||
}
|
||||
|
||||
$this->_incPeriodV(TN_HASH_RATE_UP_CHIP_TIMES, 0, 1);
|
||||
$propertyChgService->addChip();
|
||||
$hashChance = \mt\Manufacture::hashChance($manufactureMeta['chance']);
|
||||
$weight = $hashChance[0];
|
||||
@ -251,6 +251,7 @@ class ChipController extends BaseAuthedController
|
||||
$this->_addItems($items,$awardService,$propertyChgService);
|
||||
}
|
||||
$propertyChgService->addChip();
|
||||
$this->_incPeriodV(TN_HASH_RATE_SYN_CHIP_TIMES, 0, $number);
|
||||
$event = array(
|
||||
'ID' => 'chip',
|
||||
'SUB_ID' => 'synthesis',
|
||||
|
@ -154,10 +154,6 @@ class GunController extends BaseAuthedController {
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $nextLevelMeta['gold']
|
||||
),
|
||||
array(
|
||||
'item_id' => V_ITEM_GUN_META,
|
||||
'item_num' => $nextLevelMeta['stone']
|
||||
)
|
||||
);
|
||||
$metaList = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE);
|
||||
@ -221,12 +217,7 @@ class GunController extends BaseAuthedController {
|
||||
$this->_rspErr(3, "Lack of gun piece");
|
||||
return;
|
||||
}
|
||||
//校验枪械水晶数量
|
||||
$num = Bag::getItemCount(V_ITEM_GUN_META);
|
||||
if ($num < $nextLevelMeta['stone']){
|
||||
$this->_rspErr(3, "Lack of gun crystal");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//校验用户gold数量
|
||||
@ -247,7 +238,7 @@ class GunController extends BaseAuthedController {
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
Bag::decItem($piece_item_id,$nextLevelMeta['piece']);
|
||||
Bag::decItem(V_ITEM_GUN_META,$nextLevelMeta['stone']);
|
||||
|
||||
|
||||
$attrs = Gun::LvUpAddAttr($gunDb,1);
|
||||
Gun::update($gunUniId,
|
||||
|
@ -32,7 +32,7 @@ class HashRateController extends BaseAuthedController
|
||||
|
||||
if ($currentPeriod){
|
||||
foreach ($mateList as $mate) {
|
||||
$temp = $this->hashRateService->hashRateTaskDto($mate ,$currentPeriod);
|
||||
$temp = $this->hashRateService->hashRateTaskDto($mate);
|
||||
array_push($info['list'], $temp);
|
||||
}
|
||||
$obtain_start_time = strtotime($currentPeriod['obtain_start_time']);
|
||||
@ -53,4 +53,57 @@ class HashRateController extends BaseAuthedController
|
||||
$this->_rspData($info);
|
||||
}
|
||||
|
||||
public function taskList(){
|
||||
$type = getReqVal('type', 1);
|
||||
$taskDtoList1 = array();
|
||||
$taskDtoList2 = array();
|
||||
$obtain_start_time = 0;
|
||||
$obtain_end_time = 0;
|
||||
$income_start_time = 0;
|
||||
$income_end_time = 0;
|
||||
$state = 0;
|
||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||
if ($currentPeriod){
|
||||
$mateList = \mt\AchievementsPower::getCustomTypeMetaList($type,$this->hashRateService);
|
||||
foreach ($mateList as $mate) {
|
||||
$taskDb = HashRate::find($mate['id'],$currentPeriod['id']);
|
||||
$temp = $this->hashRateService->hashRateTaskDto($mate,$taskDb);
|
||||
array_push($taskDtoList1, $temp);
|
||||
}
|
||||
$mateList2 = \mt\AchievementsPower::getListByType(0);
|
||||
foreach ($mateList2 as $mate) {
|
||||
$taskDb = HashRate::find($mate['id'],$currentPeriod['id']);
|
||||
$temp = $this->hashRateService->hashRateTaskDto($mate,$taskDb);
|
||||
array_push($taskDtoList2, $temp);
|
||||
}
|
||||
$obtain_start_time = strtotime($currentPeriod['obtain_start_time']);
|
||||
$obtain_end_time = strtotime($currentPeriod['obtain_end_time']);
|
||||
$income_start_time = strtotime($currentPeriod['income_start_time']);
|
||||
$income_end_time = strtotime($currentPeriod['income_end_time']);
|
||||
if(myself()->_getNowTime() >= $obtain_start_time && myself()->_getNowTime() <= $obtain_end_time){
|
||||
$state = 1;
|
||||
}elseif (myself()->_getNowTime() >= $income_start_time && myself()->_getNowTime() <= $income_end_time){
|
||||
$state = 2;
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'task_list1' => $taskDtoList1,
|
||||
'task_list2' => $taskDtoList2,
|
||||
'obtain_start_time' => $obtain_start_time,
|
||||
'obtain_end_time' => $obtain_end_time,
|
||||
'income_start_time' => $income_start_time,
|
||||
'income_end_time' => $income_end_time,
|
||||
'state' => $state,
|
||||
));
|
||||
}
|
||||
|
||||
public function commitTask(){
|
||||
$taskId = getReqVal('task_id', 0);
|
||||
$taskMeta = \mt\AchievementsPower::find($taskId);
|
||||
if (!$taskMeta) {
|
||||
$this->_rspErr(1, 'task_id error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -110,6 +110,7 @@ class HeroController extends BaseAuthedController {
|
||||
Hero::addSyntheticHero($heroMeta,2);
|
||||
}
|
||||
$propertyChgService->addHeroChg();
|
||||
$this->_incPeriodV(TN_HASH_RATE_SYN_HERO_TIMES, 0, $number);
|
||||
$event = array(
|
||||
'ID' => 'hero',
|
||||
'SUB_ID' => 'synthesis',
|
||||
@ -139,10 +140,10 @@ class HeroController extends BaseAuthedController {
|
||||
$this->_rspErr(100, 'param hero_uniid error ');
|
||||
return;
|
||||
}
|
||||
if ($heroDb['quality'] ==1 ){
|
||||
$this->_rspErr(5, "This hero cannot level up");
|
||||
return;
|
||||
}
|
||||
// if ($heroDb['quality'] ==1 ){
|
||||
// $this->_rspErr(5, "This hero cannot level up");
|
||||
// return;
|
||||
// }
|
||||
if ($heroDb['quality'] == Hero::HERO_QUALITY_MAX){
|
||||
$this->_rspErr(5, "It's already the highest level");
|
||||
return;
|
||||
@ -186,6 +187,7 @@ class HeroController extends BaseAuthedController {
|
||||
}
|
||||
//消耗材料
|
||||
$this->_decItems($costItems);
|
||||
$this->_incPeriodV(TN_HASH_RATE_UP_HERO_TIMES, 0, 1);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addBagChg();
|
||||
$propertyChgService->addUserChg();
|
||||
|
@ -164,6 +164,7 @@ class HeroSkinController extends BaseAuthedController {
|
||||
HeroSkin::addSkin($skinMeta);
|
||||
}
|
||||
$propertyChgService->addHeroSkinChg();
|
||||
$this->_incPeriodV(TN_HASH_RATE_SYN_SKIN_TIMES, 0, $number);
|
||||
$event = array(
|
||||
'ID' => 'heroSkin',
|
||||
'SUB_ID' => 'synthesis',
|
||||
|
@ -10,7 +10,7 @@ require_once('models/BcOrder.php');
|
||||
require_once('models/Mall.php');
|
||||
require_once('models/InGameMall.php');
|
||||
require_once('models/OrderId.php');
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/HeroSkin.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/Bag.php');
|
||||
|
||||
@ -26,7 +26,7 @@ use models\BcOrder;
|
||||
use models\Mall;
|
||||
use models\InGameMall;
|
||||
use models\OrderId;
|
||||
use models\Hero;
|
||||
use models\HeroSkin;
|
||||
use models\Chip;
|
||||
use models\Bag;
|
||||
|
||||
@ -153,11 +153,11 @@ class InGameMallController extends BaseAuthedController {
|
||||
'ignore_empty' => true,
|
||||
'custom_func' => function () use ($queryData) {
|
||||
$typeFilter = $queryData['type_filter'];
|
||||
if ($typeFilter >= 5){
|
||||
return "AND (order_type >= 5)";
|
||||
}else{
|
||||
// if ($typeFilter >= 5){
|
||||
// return "AND (order_type >= 5)";
|
||||
// }else{
|
||||
return "AND (order_type = '${typeFilter}')";
|
||||
}
|
||||
// }
|
||||
}
|
||||
),
|
||||
)
|
||||
@ -165,8 +165,8 @@ class InGameMallController extends BaseAuthedController {
|
||||
'orderBy' => $orderBy,
|
||||
'handle' => function ($row) use(&$out) {
|
||||
switch ($row['order_type']){
|
||||
case InGameMall::HERO_TYPE :{
|
||||
$row['item_info'] = Hero::mallInfo(Hero::findEx($row['goods_uniid']));
|
||||
case InGameMall::HERO_SKIN_TYPE :{
|
||||
$row['item_info'] = HeroSkin::toDto(HeroSkin::findEx($row['goods_uniid']));
|
||||
}
|
||||
break;
|
||||
case InGameMall::CHIP_TYPE :{
|
||||
@ -202,17 +202,13 @@ class InGameMallController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
switch ($itemMeta['type']){
|
||||
case \mt\Item::HERO_TYPE : {
|
||||
$heroDb = Hero::find($goodsUniid);
|
||||
if (!$heroDb || !empty($heroDb['token_id']) || $heroDb['hero_id']!= $itemId){
|
||||
case \mt\Item::HERO_SKIN_TYPE : {
|
||||
$skinDb = HeroSkin::find($goodsUniid);
|
||||
if (!$skinDb || $skinDb['skin_state'] != HeroSkin::LOCK){
|
||||
$this->_rspErr(1, 'param goods_unnid error');
|
||||
return;
|
||||
}
|
||||
if ($heroDb['seal_type'] != 1){
|
||||
$this->_rspErr(1, 'Shelf heroes need to be packaged first');
|
||||
return;
|
||||
}
|
||||
$orderField = $heroDb['quality'];
|
||||
$orderField = $itemMeta['quality'];
|
||||
}
|
||||
break;
|
||||
case \mt\Item::CHIP_TYPE : {
|
||||
@ -224,19 +220,7 @@ class InGameMallController extends BaseAuthedController {
|
||||
$orderField = $chipDb['quality'];
|
||||
}
|
||||
break;
|
||||
// case \mt\Item::GOLD_SYN :{
|
||||
// $itemDb = Bag::findByUniId($goodsUniid);
|
||||
// if (!$itemDb || !empty($itemDb['token_id']) || $itemDb['item_id']!= $itemId){
|
||||
// $this->_rspErr(1, 'param goods_unnid error');
|
||||
// return;
|
||||
// }
|
||||
// if ($itemDb['item_num'] <= 0 || $amount > 1){
|
||||
// $this->_rspErr(1, 'amount not enough');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case \mt\Item::FRAGMENT_TYPE :{
|
||||
default : {
|
||||
$orderField = $itemMeta['quality'];
|
||||
}
|
||||
}
|
||||
@ -280,10 +264,10 @@ class InGameMallController extends BaseAuthedController {
|
||||
)
|
||||
);
|
||||
$propertyChgService->addChip();
|
||||
}elseif ($itemMeta['type'] == \mt\Item::HERO_TYPE){
|
||||
}elseif ($itemMeta['type'] == \mt\Item::HERO_SKIN_TYPE){
|
||||
SqlHelper::update
|
||||
(myself()->_getSelfMysql(),
|
||||
't_hero',
|
||||
't_hero_skin',
|
||||
array(
|
||||
'idx' => $goodsUniid,
|
||||
),
|
||||
@ -292,19 +276,7 @@ class InGameMallController extends BaseAuthedController {
|
||||
)
|
||||
);
|
||||
$propertyChgService->addHeroChg();
|
||||
}//elseif ($itemMeta['type'] == \mt\Item::GOLD_SYN){
|
||||
// SqlHelper::update
|
||||
// (myself()->_getSelfMysql(),
|
||||
// 't_bag',
|
||||
// array(
|
||||
// 'idx' => $goodsUniid,
|
||||
// ),
|
||||
// array(
|
||||
// 'account_id' => InGameMall::SYSTEM_MALL_ACCOUNT
|
||||
// )
|
||||
// );
|
||||
// $propertyChgService->addBagChg();
|
||||
// }
|
||||
}
|
||||
|
||||
$orderId = OrderId::gen();
|
||||
$orderType = $this->_getGoodsType($itemMeta);
|
||||
@ -370,10 +342,10 @@ class InGameMallController extends BaseAuthedController {
|
||||
$this->_decItems($costItems);
|
||||
|
||||
switch ($goods['order_type']){
|
||||
case InGameMall::HERO_TYPE :{
|
||||
case InGameMall::HERO_SKIN_TYPE :{
|
||||
SqlHelper::update
|
||||
(myself()->_getSelfMysql(),
|
||||
't_hero',
|
||||
't_hero_skin',
|
||||
array(
|
||||
'idx' => $goods['goods_uniid'],
|
||||
),
|
||||
@ -478,10 +450,10 @@ EOD;
|
||||
InGameMall::cancel($orderId);
|
||||
$propertyChgService = new PropertyChgService();
|
||||
switch ($goodsDb['order_type']){
|
||||
case InGameMall::HERO_TYPE :{
|
||||
case InGameMall::HERO_SKIN_TYPE :{
|
||||
SqlHelper::update
|
||||
(myself()->_getSelfMysql(),
|
||||
't_hero',
|
||||
't_hero_skin',
|
||||
array(
|
||||
'idx' => $goodsDb['goods_uniid'],
|
||||
),
|
||||
@ -506,20 +478,6 @@ EOD;
|
||||
$propertyChgService->addChip();
|
||||
}
|
||||
break;
|
||||
case InGameMall::GOLD_TYPE:{
|
||||
SqlHelper::update
|
||||
(myself()->_getSelfMysql(),
|
||||
't_bag',
|
||||
array(
|
||||
'idx' => $goodsDb['goods_uniid'],
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId()
|
||||
)
|
||||
);
|
||||
$propertyChgService->addBagChg();
|
||||
}
|
||||
break;
|
||||
default : {
|
||||
Bag::addItem($goodsDb['item_id'],$goodsDb['item_num']);
|
||||
$propertyChgService->addBagChg();
|
||||
@ -664,8 +622,8 @@ EOD;
|
||||
$orderDb = InGameMall::findByOrderId($orderId);
|
||||
if ($orderDb){
|
||||
switch ($orderDb['order_type']){
|
||||
case InGameMall::HERO_TYPE :{
|
||||
$orderDb['item_info'] = Hero::mallInfo(Hero::findEx($orderDb['goods_uniid']));
|
||||
case InGameMall::HERO_SKIN_TYPE :{
|
||||
$orderDb['item_info'] = HeroSkin::toDto(HeroSkin::findEx($orderDb['goods_uniid']));
|
||||
}
|
||||
break;
|
||||
case InGameMall::CHIP_TYPE :{
|
||||
@ -738,11 +696,11 @@ EOD;
|
||||
|
||||
private function _isGoodsType($type){
|
||||
if (in_array($type,array(
|
||||
// \mt\Item::HERO_TYPE,
|
||||
\mt\Item::CHIP_TYPE,
|
||||
\mt\Item::FRAGMENT_TYPE,
|
||||
\mt\Item::BATTLE_REWARD_BOX,
|
||||
// \mt\Item::GOLD_SYN,
|
||||
\mt\Item::HERO_SKIN_TYPE, //皮肤
|
||||
\mt\Item::CHIP_TYPE, //芯片
|
||||
\mt\Item::FRAGMENT_TYPE, //碎片
|
||||
\mt\Item::BATTLE_REWARD_BOX,//宝箱
|
||||
\mt\Item::MATERIAL_TYPE, //材料(芯片合成材料)
|
||||
))){
|
||||
return true;
|
||||
}else{
|
||||
@ -755,25 +713,21 @@ EOD;
|
||||
return ;
|
||||
}
|
||||
switch ($itemMeta['type']){
|
||||
// case \mt\Item::HERO_TYPE : {
|
||||
// return InGameMall::HERO_TYPE;
|
||||
// }
|
||||
case \mt\Item::HERO_SKIN_TYPE : {
|
||||
return InGameMall::HERO_SKIN_TYPE;
|
||||
}
|
||||
case \mt\Item::CHIP_TYPE : {
|
||||
return InGameMall::CHIP_TYPE;
|
||||
}
|
||||
case \mt\Item::FRAGMENT_TYPE : {
|
||||
if ($itemMeta['sub_type'] == \mt\Item::HERO_FRAGMENT_SUBTYPE){
|
||||
return InGameMall::HERO_FRAGMENT_TYPE;
|
||||
}else if ($itemMeta['sub_type'] == \mt\Item::CHIP_FRAGMENT_SUBTYPE){
|
||||
return InGameMall::CHIP_FRAGMENT_TYPE;
|
||||
}
|
||||
return InGameMall::HERO_FRAGMENT_TYPE;
|
||||
}
|
||||
case \mt\Item::BATTLE_REWARD_BOX : {
|
||||
return InGameMall::BOX_TYPE;
|
||||
return InGameMall::OTHER_TYPE;
|
||||
}
|
||||
case \mt\Item::MATERIAL_TYPE : {
|
||||
return InGameMall::OTHER_TYPE;
|
||||
}
|
||||
// case \mt\Item::GOLD_SYN : {
|
||||
// return InGameMall::GOLD_TYPE;
|
||||
// }
|
||||
default : {
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ class BigData extends BaseModel {
|
||||
|
||||
const OFFER_REWARD_MISSION_TYPE = 'offer.reward.missions';
|
||||
const DAILY_REWARD_MISSION_TYPE = 'daily.reward.missions';
|
||||
const OFFER_INTEGRAL_HASHRATE_TYPE = 'offer.integral.hashrate';
|
||||
|
||||
public static function getData($type)
|
||||
{
|
||||
|
@ -19,6 +19,34 @@ class HashRate extends BaseModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function all($period)
|
||||
{
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hash_rate',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'period' => $period,
|
||||
)
|
||||
);
|
||||
return array_map(function($row) {
|
||||
$nowDaySeconds = myself()->_getNowDaySeconds();
|
||||
$mondaySeconds = myself()->_getMondaySeconds();
|
||||
return $row;
|
||||
}, $rows);
|
||||
}
|
||||
|
||||
public static function allToHash($period)
|
||||
{
|
||||
$rows = self::all($period);
|
||||
$taskHash = array();
|
||||
array_walk($rows, function ($row) use(&$taskHash) {
|
||||
$taskHash[$row['task_id']] = $row;
|
||||
});
|
||||
return $taskHash;
|
||||
}
|
||||
|
||||
|
||||
public static function add($fieldKv){
|
||||
SqlHelper::insert(
|
||||
myself()->_getSelfMysql(),
|
||||
|
@ -60,6 +60,18 @@ class HeroSkin extends BaseModel {
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function findEx($uniid)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'idx' => $uniid,
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function findByAccountId($accountId, $uniid)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
|
@ -10,12 +10,10 @@ class InGameMall extends BaseModel {
|
||||
const BUY_OK_STATE = 1;
|
||||
const CANCEL_STATE = 2;
|
||||
|
||||
const HERO_TYPE = 1;
|
||||
const HERO_SKIN_TYPE = 1;
|
||||
const CHIP_TYPE = 2;
|
||||
const HERO_FRAGMENT_TYPE = 3;
|
||||
const CHIP_FRAGMENT_TYPE = 4;
|
||||
const BOX_TYPE = 5;
|
||||
const GOLD_TYPE = 6;
|
||||
const OTHER_TYPE = 11;
|
||||
|
||||
const SYSTEM_MALL_ACCOUNT = "kingsome";
|
||||
|
||||
|
@ -18,18 +18,44 @@ class AchievementsPower {
|
||||
const OWN_HERO_NFT_NUM = 11; //拥有英雄nft数
|
||||
const OWN_CHIP_NFT_NUM = 12; //拥有芯片nft数
|
||||
const OWN_GOLD_NUM = 13; //拥有金币数
|
||||
const TOP_UP_DIAMOND = 14; //充值钻石
|
||||
const SPEND_DIAMOND = 15; //花费钻石
|
||||
const SPEND_GOLD = 16; //消耗金币
|
||||
const SYN_HERO = 17; //合成英雄
|
||||
const SYN_CHIP = 18; //合成芯片
|
||||
const SYN_SKIN = 19; //合成皮肤
|
||||
const UP_HERO = 20; //升阶英雄
|
||||
const UP_CHIP = 21; //升阶芯片
|
||||
const SYN_GOLD_CARD = 22; //合成金币卡
|
||||
const TOTAL_COMPLETE_NUM = 23; //累计完成任务数
|
||||
|
||||
const MOBA_SCENE = 1;
|
||||
const PVP_SCENE = 2;
|
||||
|
||||
const TYPE1 = 1;
|
||||
const TYPE2 = 2;
|
||||
const TYPE3 = 3;
|
||||
const TYPE4 = 4;
|
||||
|
||||
public static function find($id){
|
||||
return getXVal(self::getMetaList(), $id, null);
|
||||
}
|
||||
|
||||
public static function getCustomTypeMetaList($type, $hashRateService){
|
||||
$metaList = array();
|
||||
foreach ($hashRateService->getHashRateTasks($type) as $task){
|
||||
$meta = self::find($task['task_id']);
|
||||
if ($meta) {
|
||||
array_push($metaList, $meta);
|
||||
}
|
||||
}
|
||||
return $metaList;
|
||||
}
|
||||
|
||||
public static function getListByType($type){
|
||||
$mateList = array();
|
||||
foreach (self::getMetaList() as $mate){
|
||||
if ($mate['type'] == $type){
|
||||
if ($mate['scene'] == $type){
|
||||
array_push($mateList,$mate);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ require_once('mt/AchievementsPower.php');
|
||||
require_once('mt/ServerTask.php');
|
||||
require_once('mt/ServerTaskTime.php');
|
||||
|
||||
require_once('models/BigData.php');
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/HashRate.php');
|
||||
require_once('models/HashRateBattleData.php');
|
||||
@ -16,11 +17,14 @@ use models\GlobalData;
|
||||
use models\HashRateBattleData;
|
||||
use models\HashRate;
|
||||
use models\Hero;
|
||||
use models\BigData;
|
||||
use mt\AchievementsPower;
|
||||
|
||||
class HashRateService extends BaseService
|
||||
{
|
||||
const FINISHED_STATE = 1;
|
||||
const NOT_FINISHED_STATE = 0;
|
||||
const RECEIVED_STATE = 2;
|
||||
|
||||
private $hisBattleData = array();
|
||||
private $hashRateData = array();
|
||||
@ -29,10 +33,11 @@ class HashRateService extends BaseService
|
||||
private $serverTaskData = array();
|
||||
private $battleDataServerTask = array();
|
||||
private $pvpBattleDataServerTask = array();
|
||||
private $hashRateTask = array();
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
//------------------------算力系统------------------------
|
||||
$this->hisBattleData = HashRateBattleData::getMyBattleData();
|
||||
$this->hashRateData = getXVal($this->hisBattleData, 'hash_rate_data', array());
|
||||
if (!$this->hashRateData){
|
||||
@ -54,7 +59,22 @@ class HashRateService extends BaseService
|
||||
}
|
||||
$this->pvpBattleData = $this->hashRateData['pvpData'];
|
||||
$this->mobaBattleData = $this->hashRateData['mobaData'];
|
||||
$this->hashRateTask = BigData::getData(BigData::OFFER_INTEGRAL_HASHRATE_TYPE);
|
||||
if (!$this->hashRateTask) {
|
||||
$this->hashRateTask = array(
|
||||
'task'.AchievementsPower::TYPE1 => array(),
|
||||
'task'.AchievementsPower::TYPE2 => array(),
|
||||
'task'.AchievementsPower::TYPE3 => array(),
|
||||
'task'.AchievementsPower::TYPE4 => array(),
|
||||
'currentPeriod' => 0,
|
||||
'initTime' => 0
|
||||
);
|
||||
}
|
||||
if ($currentPeriod && $currentPeriod['id'] != $this->hashRateTask['currentPeriod']){
|
||||
$this->initHashRateTask($currentPeriod['id']);
|
||||
}
|
||||
|
||||
//------------------------服务器大事件------------------------
|
||||
$serverDataDb = GlobalData::getServerTaskData();
|
||||
$this->serverTaskData = getXVal($serverDataDb, 'data', array());
|
||||
if (!$this->serverTaskData){
|
||||
@ -76,7 +96,7 @@ class HashRateService extends BaseService
|
||||
|
||||
|
||||
|
||||
public function hashRateTaskDto($taskMate ,$currentPeriod){
|
||||
public function hashRateTaskDto($taskMate, $taskDb){
|
||||
$taskDto = array(
|
||||
'task_id' => $taskMate['id'],
|
||||
'current' => 0,
|
||||
@ -84,6 +104,12 @@ class HashRateService extends BaseService
|
||||
'state' => self::NOT_FINISHED_STATE,
|
||||
);
|
||||
|
||||
if ($taskDb){
|
||||
$taskDto['current'] = $taskDto['target'];
|
||||
$taskDto['state'] = self::RECEIVED_STATE;
|
||||
return $taskDto;
|
||||
}
|
||||
|
||||
switch ($taskMate['Completion_type']){
|
||||
//吃鸡或4v4获得胜利
|
||||
case \mt\AchievementsPower::TOTAL_WINS_TIMES : {
|
||||
@ -153,7 +179,13 @@ class HashRateService extends BaseService
|
||||
break;
|
||||
//拥有英雄nft数
|
||||
case \mt\AchievementsPower::OWN_HERO_NFT_NUM : {
|
||||
//...../
|
||||
$heroNftCount = 0;
|
||||
Hero::getHeroList(function ($row) use (&$heroNftCount){
|
||||
if ($row['token_id']){
|
||||
$heroNftCount += 1;
|
||||
}
|
||||
});
|
||||
$taskDto['current'] = $heroNftCount;
|
||||
}
|
||||
break;
|
||||
//拥有芯片nft数
|
||||
@ -163,27 +195,78 @@ class HashRateService extends BaseService
|
||||
break;
|
||||
//拥有金币数
|
||||
case \mt\AchievementsPower::OWN_GOLD_NUM : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_TOTAL_GATHER_GOLD,0);
|
||||
$user = myself()->_getOrmUserInfo();
|
||||
$taskDto['current'] = $user['gold'];
|
||||
}
|
||||
break;
|
||||
//充值钻石数
|
||||
case \mt\AchievementsPower::TOP_UP_DIAMOND : {
|
||||
//.../
|
||||
}
|
||||
break;
|
||||
//花费钻石数
|
||||
case \mt\AchievementsPower::SPEND_DIAMOND : {
|
||||
//..
|
||||
}
|
||||
break;
|
||||
//消耗金币
|
||||
case \mt\AchievementsPower::SPEND_GOLD : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_GOLD_CONSUME, 0);
|
||||
}
|
||||
break;
|
||||
//合成英雄
|
||||
case \mt\AchievementsPower::SYN_HERO : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_SYN_HERO_TIMES, 0);
|
||||
}
|
||||
break;
|
||||
//合成芯片
|
||||
case \mt\AchievementsPower::SYN_CHIP : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_SYN_CHIP_TIMES, 0);
|
||||
}
|
||||
break;
|
||||
//合成皮肤
|
||||
case \mt\AchievementsPower::SYN_SKIN : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_SYN_SKIN_TIMES, 0);
|
||||
}
|
||||
break;
|
||||
//升阶英雄
|
||||
case \mt\AchievementsPower::UP_HERO : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_UP_HERO_TIMES, 0);
|
||||
}
|
||||
break;
|
||||
//升阶芯片
|
||||
case \mt\AchievementsPower::UP_CHIP : {
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_HASH_RATE_UP_CHIP_TIMES, 0);
|
||||
}
|
||||
break;
|
||||
//合成金币卡
|
||||
case \mt\AchievementsPower::SYN_GOLD_CARD : {
|
||||
//.........
|
||||
}
|
||||
break;
|
||||
//累计完成任务数
|
||||
case \mt\AchievementsPower::TOTAL_COMPLETE_NUM : {
|
||||
//..........
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($taskDto['current'] >= $taskDto['target']) {
|
||||
$taskDto['current'] = $taskDto['target'];
|
||||
$taskDto['state'] = self::FINISHED_STATE;
|
||||
if ($currentPeriod){
|
||||
$hashRateDb = HashRate::find($taskMate['id'],$currentPeriod['id']);
|
||||
if (!$hashRateDb){
|
||||
$fieldKv = array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'task_id' => $taskMate['id'],
|
||||
'period' => $currentPeriod['id'],
|
||||
'reward' => $taskMate['Reward_quantity'],
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
);
|
||||
HashRate::add($fieldKv);
|
||||
}
|
||||
}
|
||||
// if ($currentPeriod){
|
||||
// $hashRateDb = HashRate::find($taskMate['id'],$currentPeriod['id']);
|
||||
// if (!$hashRateDb){
|
||||
// $fieldKv = array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'task_id' => $taskMate['id'],
|
||||
// 'period' => $currentPeriod['id'],
|
||||
// 'reward' => $taskMate['Reward_quantity'],
|
||||
// 'createtime' => myself()->_getNowTime(),
|
||||
// 'modifytime' => myself()->_getNowTime()
|
||||
// );
|
||||
// HashRate::add($fieldKv);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return $taskDto;
|
||||
}
|
||||
@ -217,6 +300,45 @@ class HashRateService extends BaseService
|
||||
return $val;
|
||||
}
|
||||
|
||||
public function getHashRateTasks($type){
|
||||
return $this->hashRateTask['task'.$type];
|
||||
}
|
||||
|
||||
public function initHashRateTask($currentId){
|
||||
$this->randHashRateTaskList(AchievementsPower::TYPE1);
|
||||
$this->randHashRateTaskList(AchievementsPower::TYPE2);
|
||||
$this->randHashRateTaskList(AchievementsPower::TYPE3);
|
||||
$this->randHashRateTaskList(AchievementsPower::TYPE4);
|
||||
$this->hashRateTask['initTime'] = myself()->_getNowDaySeconds();
|
||||
$this->hashRateTask['currentPeriod'] = $currentId;
|
||||
$this->saveHashRateTask();
|
||||
}
|
||||
|
||||
private function randHashRateTaskList($type){
|
||||
$metas = AchievementsPower::getListByType($type);
|
||||
$this->hashRateTask['task'.$type] = array();
|
||||
foreach (array_rand($metas, 4) as $key) {
|
||||
$meta = $metas[$key];
|
||||
if (count($this->hashRateTask['task'.$type]) >=
|
||||
4) {
|
||||
break;
|
||||
}
|
||||
array_push($this->hashRateTask['task'.$type],
|
||||
array(
|
||||
'task_id' => $meta['id'],
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private function saveHashRateTask()
|
||||
{
|
||||
BigData::setData(BigData::OFFER_INTEGRAL_HASHRATE_TYPE,
|
||||
json_encode($this->hashRateTask));
|
||||
}
|
||||
|
||||
|
||||
public function serverTaskDto($taskMate){
|
||||
$taskDto = array(
|
||||
'task_id' => $taskMate['id'],
|
||||
|
@ -123,7 +123,6 @@ class BuyPassCbService
|
||||
)
|
||||
);
|
||||
$addItemService->addItem($order['address'],$piece_item_id,$piece);
|
||||
$addItemService->addItem($order['address'],V_ITEM_HERO_META,$serum);
|
||||
$addItemService->addItem($order['address'],V_ITEM_GOLD,$gold);
|
||||
$this->_updateDynData($order,TN_DAILY_RESET_HERO_LEVEL_STATE,json_decode($order['ext_data']));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user