q("SELECT MAX(`rank`) AS m FROM `dramas`"); $nextRank = ((int)($maxRank[0]['m'] ?? 0)) + 1; $data = [ 'title' => trim($_POST['title'] ?? ''), 'type' => $type, 'platform' => $_POST['platform'] ?? '其他', 'watch_url' => trim($_POST['watch_url'] ?? ''), 'current_season' => max(1, (int)($_POST['current_season'] ?? 1)), 'current_episode' => max(0, (int)($_POST['current_episode'] ?? 0)), 'current_position' => trim($_POST['current_position'] ?? ''), 'progress_note' => trim($_POST['progress_note'] ?? ''), 'status' => $_POST['status'] ?? 'want', 'rating' => $_POST['rating'] !== '' ? $_POST['rating'] : null, 'intro' => trim($_POST['intro'] ?? ''), 'note' => trim($_POST['note'] ?? ''), 'sh' => 1, 'rank' => $nextRank, ]; // DB::save 用字串拼接;null 改空字串避免 SQL 破掉 if ($data['rating'] === null) { $data['rating'] = ''; } $Drama->save($data); to("?do=drama"); exit; } } ?>

新增作品

取消