EOT
}
}
&disconDB($dbh_x);
}
# $sql = "select seq,title,attribute1,attribute2,type,another_flg from scenario where title is not null and option2 = 1 and reserve_close <= now() and replay_open_date is null and type != 5 and state = 0";
$sql = "select seq,title,attribute1,attribute2,type,another_flg from scenario where scenario_result = 1 and title is not null and option2 = 1 and reserve_close <= now() and (replay_result != 1 or replay_result is null) and type != 5 and state = 0";
# if ($uid ne 4){$sql .= " and msid != 'system' and msid != 'rexi'";}
$sql .= " order by reserve_close,seq;";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
foreach(@$ref) {
($seq,$title,$attribute1,$attribute2,$stype,$another_flg)=@{$_};
$data1 = "";
$data2 = "";
$data1_1 = "";
$data1_2 = "";
$data2_1 = "";
$data2_2 = "";
if ($stype eq 3 && $another_flg eq 1){
$sql2 = "select id from chat_control where scenario_seq = $seq and atb_limit = 0;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($id)=@{$ref2->[0]};
if ($id ne ''){
$data1 = "●総合室 ";
$sql2 = "select count(*),max(say_time) from chat_log where id = $id;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($lcnt,$say_time)=@{$ref2->[0]};
$say_time =~ s/\-/\//g;
$say_time = substr($say_time,2,17);
if ($say_time eq ''){$say_time = '―';}
$data1_1 = $lcnt;
$data1_2 = $say_time;
}
}
else{
# if ($uid eq 2 && $seq eq 585){&err("$stype,$another_flg");}
# if ($attribute1 > 0){
$sql2 = "select id from chat_control where scenario_seq = $seq and atb_limit = 1;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($id)=@{$ref2->[0]};
if ($id ne ''){
if ($attribute eq 1 || substr($pcid,0,2) eq 'jz'){
$data1 = "●ジャスティス室 ";
}
else{$data1 = "●ジャスティス室 ";}
$sql2 = "select count(*),max(say_time) from chat_log where id = $id;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($lcnt,$say_time)=@{$ref2->[0]};
$say_time =~ s/\-/\//g;
$say_time = substr($say_time,2,17);
if ($say_time eq ''){$say_time = '―';}
$data1_1 = $lcnt;
$data1_2 = $say_time;
}
# }
# if ($attribute2 > 0){
$sql2 = "select id from chat_control where scenario_seq = $seq and atb_limit = 2;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($id)=@{$ref2->[0]};
if ($id ne ''){
if ($attribute eq 2 || substr($pcid,0,2) eq 'jz'){
$data2 = "●ジョーカー室";
}
else{$data2 = "●ジョーカー室";}
$sql2 = "select count(*),max(say_time) from chat_log where id = $id;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($lcnt,$say_time)=@{$ref2->[0]};
$say_time =~ s/\-/\//g;
$say_time = substr($say_time,2,17);
if ($say_time eq ''){$say_time = '―';}
$data2_1 = $lcnt;
$data2_2 = $say_time;
}
# }
}
if ($mid eq ''){
$list{'scenario'} .=<<"EOT";