<?php
declare(strict_types=1);
function activityOracle(array $rows,string $method):array {
 if(getenv('ACT_LANE')==='C'){foreach($rows as &$row)foreach(['register_start','register_end','start_time','end_time','create_time']as $key){$v=$row[$key]??null;if(!is_string($v)||!preg_match('/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\.0{1,6}$/D',$v,$m))continue;$d=DateTime::createFromFormat('!Y-m-d H:i:s',$m[1]);if($d&&$d->format('Y-m-d H:i:s')===$m[1]&&(int)substr($m[1],0,4)>=1000)$row[$key]=$m[1];}unset($row);}
 if($method==='info'){if(count($rows)!==1)throw new RuntimeException('One info oracle row');$row=$rows[0];$row['activity_status']='未开始';$row['participants']=0;return ['code'=>0,'message'=>'信息获取成功','data'=>$row];}
 if($method==='lists'){foreach($rows as &$row)$row['activity_status']='未开始';unset($row);return ['code'=>0,'message'=>'请求成功','data'=>['rows'=>$rows,'total'=>count($rows)]];}
 $messages=['add'=>'新增活动成功','update'=>'编辑活动成功','able'=>'更改状态成功','delete'=>'删除活动成功'];return ['code'=>0,'message'=>$messages[$method],'data'=>[]];
}
