_getNowTime() < strtotime($nextCircuitMeta['task_open_time'])){ return false; } $season = $nextCircuitMeta['circuit_season']; $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_circuit_task_value', array( 'account_id' => myself()->_getAccountId(), 'circuit_season' => $season, 'task_type' => mt\CircuitTask::LOGIN_TIMES_END, ) ); if ($row){ if (myself()->_getDaySeconds($row['modifytime']) >= myself()->_getNowDaySeconds()){ return false; } } return true; } public static function incTaskVal($taskType,$value){ $circuitCircuitMeta = mt\CircuitTime::getCurrentCircuit(); $nextCircuitMeta = mt\CircuitTime::getNextCircuit(); if ($circuitCircuitMeta || !$nextCircuitMeta){ return; } if (myself()->_getNowTime() < strtotime($nextCircuitMeta['task_open_time'])){ return; } $season = $nextCircuitMeta['circuit_season']; SqlHelper::upsert( myself()->_getSelfMysql(), 't_circuit_task_value', array( 'account_id' => myself()->_getAccountId(), 'circuit_season' => $season, 'task_type' => $taskType, ), array( 'value' => function () use ($value){ return "value + ${value}"; }, 'modifytime' => myself()->_getNowTime(), ), array( 'account_id' => myself()->_getAccountId(), 'circuit_season' => $season, 'task_type' => $taskType, 'value' => $value, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); } public static function getCurrentVal($season,$taskType){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_circuit_task_value', array( 'account_id' => myself()->_getAccountId(), 'circuit_season' => $season, 'task_type' => $taskType, ) ); return $row ? $row['value'] : 0; } }