112 lines
3.4 KiB
PHP
112 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace services;
|
|
|
|
require_once('mt/CircuitTime.php');
|
|
|
|
use mt;
|
|
use phpcommon\SqlHelper;
|
|
|
|
class CircuitRankingService extends BaseService {
|
|
|
|
public static function fillPhaseRanking($currentCircuitMeta, $currentStageMeta)
|
|
{
|
|
$rows = myself()->_callModelStatic('Circuit', 'getCircuitPhaseList',
|
|
$currentStageMeta['circuit_season'],
|
|
$currentStageMeta['circuit_phase']);
|
|
if (count($rows) < 100) {
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
public static function fillRanking($currentCircuitMeta)
|
|
{
|
|
$rows = myself()->_callModelStatic('Circuit', 'getCircuitList',
|
|
$currentCircuitMeta['circuit_season']);
|
|
if (count($rows) < 100) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
public static function repairPhaseRanking($currentCircuitMeta)
|
|
{
|
|
$rows = myself()->_callModelStatic('Circuit', 'getCircuitPhaseList',
|
|
$currentStageMeta['circuit_season'],
|
|
$currentStageMeta['circuit_phase']);
|
|
$androidHash = array();
|
|
foreach ($rows as $row) {
|
|
$androidHash[$row['account_id']] = $row;
|
|
}
|
|
$androidHashDb = self::getAndroidHashDb($androidHash);
|
|
if (count($androidHash) < 100) {
|
|
for ($i = count($androidHash); $i < 100; $i++) {
|
|
if (!empty($androidHashDb)) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function getAndroidHashDb($alreadyAndroidHash)
|
|
{
|
|
$androidHash = array();
|
|
$rows = SqlHelper::ormSelectOne
|
|
($this->_getMysql(''),
|
|
't_android',
|
|
array(
|
|
'used' => 0
|
|
)
|
|
);
|
|
foreach ($rows as $row) {
|
|
if (!array_key_exists($row['robot_id'], $alreadyAndroidHash)) {
|
|
$androidHash[$row['robot_id']] = $row;
|
|
}
|
|
}
|
|
return $androidHash;
|
|
}
|
|
|
|
public static function repairRanking($currentCircuitMeta)
|
|
{
|
|
$rows = myself()->_callModelStatic('Circuit', 'getCircuitList',
|
|
$currentCircuitMeta['circuit_season']);
|
|
if (count($rows) < 100) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
public static function genAndroidData()
|
|
{
|
|
$currentStageMeta = mt\CircuitTime::getCurrentStage();
|
|
if (empty($currentStageMeta)) {
|
|
myself()->_rspErr(1, 'currentStageMeta Is empty');
|
|
return;
|
|
}
|
|
$rows = SqlHelper::ormSelect
|
|
(myself()->_getMysql(''),
|
|
't_android',
|
|
array(
|
|
'used' => 0
|
|
)
|
|
);
|
|
foreach ($rows as $row) {
|
|
SqlHelper::upsert
|
|
(myself()->_getMysql(''),
|
|
't_circuit_battle_phase',
|
|
array(
|
|
'account_id' => $row['robot_id'],
|
|
),
|
|
array(),
|
|
array(
|
|
'account_id' => $row['robot_id'],
|
|
'is_android' => 1,
|
|
'cumulative_score' => 10,
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime(),
|
|
)
|
|
);
|
|
}
|
|
myself()->_rspOk();
|
|
}
|
|
|
|
}
|