addHidden("msg_id", $id, function($msg_id) { global $user; if (!validateUInt($msg_id)) { return '消息 ID 不是有效的数字'; } $msg = DB::selectFirst("select * from user_system_msg where id = {$msg_id}"); if (!$msg || $msg['receiver'] != $user['username']) { return '消息不存在'; } return ''; }, null); $form->handle = function() { $msg_id = $_POST["msg_id"]; DB::delete("delete from user_system_msg where id = {$msg_id}"); }; $form->submit_button_config['text'] = '删除'; $form->submit_button_config['margin_class'] = 'mt-0'; $form->submit_button_config['class_str'] = 'btn btn-link text-decoration-none text-danger p-0'; $form->submit_button_config['align'] = 'inline'; $form->submit_button_config['smart_confirm'] = ''; return $form; } $pag_config = [ 'page_len' => 10, 'col_names' => ['*'], 'table_name' => 'user_system_msg', 'cond' => "receiver = '{$user['username']}'", 'tail' => 'order by send_time desc', ]; $pag = new Paginator($pag_config); $system_msgs = []; foreach ($pag->get() as $idx => $msg) { $system_msgs[$idx] = $msg; if (isSuperUser($myUser)) { $delete_form = newDeleteSystemMsgForm($msg['id']); $delete_form->runAtServer(); $system_msgs[$idx]['delete_form'] = $delete_form; } } ?>

系统消息

  • 发送时间:
    printHTML() ?>
  • isEmpty()): ?>
pagination() ?>