1
This commit is contained in:
parent
3a06683610
commit
43771c8e67
@ -39,6 +39,7 @@ define('TN_TOTAL_STAR_NUM', 8014);
|
||||
define('TN_TOTAL_RANK_NUM', 8015);
|
||||
define('TN_TOTAL_DIAMOND_CONSUME', 8016);//钻石消耗
|
||||
define('TN_TOTAL_CEG_CONSUME', 8017);//ceg消耗
|
||||
define('TN_TOTAL_GATHER_GOLD', 8018);//收集金币
|
||||
|
||||
define('TN_DAILY_BEGIN', 9001);
|
||||
define('TN_DAILY_LOGINS', 9001);
|
||||
|
@ -24,6 +24,7 @@ require_once('mt/Task.php');
|
||||
require_once('mt/Drop.php');
|
||||
require_once('mt/StarLevel.php');
|
||||
require_once('mt/BattlePass.php');
|
||||
require_once('mt/AchievementsCycle.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\Bag;
|
||||
@ -344,6 +345,7 @@ class BaseAuthedController extends BaseController {
|
||||
return "gold + ${itemNum}";
|
||||
}
|
||||
));
|
||||
$this->_incPeriodV(TN_TOTAL_GATHER_GOLD,0,$itemNum);
|
||||
}
|
||||
break;
|
||||
case V_ITEM_DIAMOND:
|
||||
@ -804,4 +806,16 @@ class BaseAuthedController extends BaseController {
|
||||
DynData::decWeeklyV($x, $y, $decVal);
|
||||
}
|
||||
|
||||
public function _incPeriodV($x, $y, $incVal){
|
||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||
if ($currentPeriod && strtotime($currentPeriod['obtain_end_time']) > myself()->_getNowTime()){
|
||||
DynData::incPeriodV($x, $y,strtotime($currentPeriod['obtain_start_time']), $incVal);
|
||||
}
|
||||
}
|
||||
|
||||
public function _getPeriodV($x, $y, $decVal = 0){
|
||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||
return DynData::getPeriodV($x, $y,strtotime($currentPeriod['obtain_start_time']), $decVal);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -176,6 +176,20 @@ class DynData extends BaseModel {
|
||||
$key = $low32 + ($high32 << 32);
|
||||
return $key;
|
||||
}
|
||||
public static function getPeriodV($x, $y,$time, $defVal = 0)
|
||||
{
|
||||
$valData = self::internalGetV($x, $y, $defVal);
|
||||
if (myself()->_getDaySeconds($valData['modifytime']) < myself()->_getDaySeconds($time)) {
|
||||
$valData['val'] = $defVal;
|
||||
}
|
||||
return $valData['val'];
|
||||
}
|
||||
|
||||
public static function incPeriodV($x, $y, $time, $val){
|
||||
$key = self::calcKey($x, $y);
|
||||
$oldVal = self::getPeriodV($x, $y, $time);
|
||||
self::internalSetV($x, $y, $oldVal + $val);
|
||||
}
|
||||
|
||||
private static function internalSetV($x, $y, $val)
|
||||
{
|
||||
|
@ -11,34 +11,6 @@ use mt\RankSeason;
|
||||
use phpcommon\SqlHelper;
|
||||
class HashRateTask extends BaseModel
|
||||
{
|
||||
const KILL_TYPE = 10001;
|
||||
const STAR_TYPE = 10002;
|
||||
const RANK_TYPE = 10003;
|
||||
const BATTLE_TIME_TYPE = 10004;
|
||||
const BATTLE_WIN_TYPE = 10005;
|
||||
const VS_FOUR_BATTLE_WIN_TYPE = 10006;
|
||||
const DAMAGE_TYPE = 10007;
|
||||
|
||||
const MOBA_WIN_ID = 1;
|
||||
const MOBA_KILL_ID = 2;
|
||||
const MOBA_GATHER_GRENADE_ID = 3;
|
||||
const MOBA_GATHER_BURNING_ID = 4;
|
||||
const MOBA_GATHER_BLOOD_ID = 5;
|
||||
const MOBA_BATTLE_END_ID =6;
|
||||
const MOBA_FAST_UP_ID =7;
|
||||
const MOBA_BATTLE_TIMES_ID =8;
|
||||
const PVP_WIN_ID =9;
|
||||
const PVP_LAST_RUNNER_ID =10;
|
||||
const PVP_KILL_ID =11;
|
||||
const PVP_GATHER_GRENADE_ID =12;
|
||||
const PVP_GATHER_BURNING_ID =13;
|
||||
const PVP_GATHER_BLOOD_ID =14;
|
||||
const PVP_WALKING_DISTANCE_ID =16;
|
||||
const PVP_BATTLE_TIMES_ID =17;
|
||||
const HERO_UP_QUALITY_ID =18;
|
||||
const OWN_HERO_NFT_ID =19;
|
||||
const OWN_CHIP_NFT_ID =20;
|
||||
const OWN_GOLD_ID =21;
|
||||
|
||||
public static function find(){
|
||||
$rows = SqlHelper::ormSelect(
|
||||
|
@ -137,12 +137,13 @@ class HashRateService extends BaseService
|
||||
break;
|
||||
//拥有金币数
|
||||
case AchievementsPower::OWN_GOLD_NUM : {
|
||||
//......./
|
||||
$taskDto['current'] = myself()->_getPeriodV(TN_TOTAL_GATHER_GOLD,0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($taskDto['current'] >= $taskDto['target']) {
|
||||
$taskDto['current'] = $taskDto['target'];
|
||||
$taskDto['state'] = self::FINISHED_STATE;
|
||||
}
|
||||
return $taskDto;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user