// ================== 系统通知后台管理页(v2.5.1) ================== function wmp_subscribe_render_notices_page() { if (!current_user_can('manage_options')) { return; } global $wpdb; jifen_ensure_notices_table(); $table = jifen_notices_table(); $notice_msg = ''; // 保存(新增/更新) if (isset($_POST['wmp_notice_save']) && (int) $_POST['wmp_notice_save'] === 1) { check_admin_referer('wmp_notice_action'); $id = absint(isset($_POST['nid']) ? $_POST['nid'] : 0); $title = sanitize_text_field(isset($_POST['ntitle']) ? $_POST['ntitle'] : ''); $content = wp_kses_post(isset($_POST['ncontent']) ? $_POST['ncontent'] : ''); $status = (isset($_POST['nstatus']) && (int) $_POST['nstatus'] === 1) ? 1 : 0; if ($title === '' || $content === '') { $notice_msg = '

标题和内容不能为空

'; } elseif ($id > 0) { $wpdb->update($table, array('title' => $title, 'content' => $content, 'status' => $status), array('id' => $id)); $notice_msg = '

通知已更新

'; } else { $wpdb->insert($table, array('title' => $title, 'content' => $content, 'status' => $status, 'created_at' => current_time('mysql'))); $notice_msg = '

通知已发布

'; } } // 删除 if (isset($_GET['del']) && (int) $_GET['del'] > 0) { check_admin_referer('wmp_notice_del'); $wpdb->delete($table, array('id' => absint($_GET['del']))); $notice_msg = '

通知已删除

'; } $edit = null; if (isset($_GET['edit']) && (int) $_GET['edit'] > 0) { $edit = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE id=%d", absint($_GET['edit']))); } $list = $wpdb->get_results("SELECT * FROM $table ORDER BY id DESC LIMIT 200"); echo '

系统通知

'; echo '

发布后,小程序端“个人中心 → 系统通知”即可看到启用的通知。可用来发布公告、活动、折扣码等信息。

'; if ($notice_msg) { echo $notice_msg; } echo '

' . ($edit ? '编辑通知' : '发布新通知') . '

'; echo '
'; wp_nonce_field('wmp_notice_action'); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
标题
内容

支持简单 HTML

状态
'; submit_button($edit ? '保存修改' : '发布通知'); echo '
'; echo '

通知列表

'; if ($list) { echo ''; foreach ($list as $n) { echo ''; } echo '
ID标题状态发布时间操作
' . (int) $n->id . '' . esc_html($n->title) . '' . ((int) $n->status === 1 ? '启用' : '停用') . '' . esc_html($n->created_at) . '编辑 | 删除
'; } else { echo '

暂无通知。

'; } echo '
'; } /** GET /wp-json/wmp-subscribe/v1/notices —— 小程序端获取启用的系统通知 */ function wmp_subscribe_get_notices($request) { global $wpdb; jifen_ensure_notices_table(); $table = jifen_notices_table(); $rows = $wpdb->get_results("SELECT id, title, content, created_at FROM $table WHERE status=1 ORDER BY id DESC LIMIT 50"); $list = array(); foreach ((array) $rows as $r) { $list[] = array( 'id' => (int) $r->id, 'title' => $r->title, 'content' => $r->content, 'created_at' => $r->created_at, ); } return rest_ensure_response(array('code' => 200, 'list' => $list)); }
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/www.iyrc.cn/wp-content/plugins/xiaocx-jifen/xiaocx-jifen.php:2957) in /www/wwwroot/www.iyrc.cn/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1906
艾瑞克网-艾瑞克网-第167页
艾瑞克网-艾瑞克网-第167页
山西省2025年中考名校联考模拟-艾瑞克网
浙江省县域教研联盟2024学年高二第二学期学业水平模拟测技术试语文+数学+技术-艾瑞克网
2026版初中《万唯情景题》与中考新考法9年级上册(英语)-艾瑞克网
2025学年11月浙江省温州市龙港市九年级上册期中检测英语卷-艾瑞克网
2025年11月杭州淳安县九上期中英语-艾瑞克网
云南省2026届高三上学期1月百万大联考英语试卷和答案-艾瑞克网
英语卷-2609温州瑞安安阳实验中学九上开学考-艾瑞克网

英语卷-2609温州瑞安安阳实验中学九上开学考

2026学年第一学期九年级作业调研英语试题卷 考生注意: 1.本试题卷包括四部分,共8页,满分120分,考试时间100分钟。 2.答题前,请务必将自己的姓名、准考证号用黑色字迹的签字笔或钢笔分别填写...
3天前
030
双语阅读Scientists recreated what mice saw from brain activity alone-艾瑞克网

双语阅读Scientists recreated what mice saw from brain activity alone

Scientists reconstructed videos from mouse brain activity, offering a remarkable glimpse into how the brain turns sight into perception. Credit: AI/ScienceDaily.com科学家们根据老鼠...
five-months-old 用法是否正确-艾瑞克网

five-months-old 用法是否正确

  当代英语中已经没有这种用法了,我们也知道正确的表达方式是什么,只是龙楠网友想要知道来龙去脉怎么回事,为啥偏偏要说two-months-old baby,我也比较感兴趣,我就以我查到的资料说说。...
3年前
0270
英语语法之固定用法-艾瑞克网

英语语法之固定用法

  英语的固定用法具有一定的惯例性,是人们经过长期的约定俗成的用法,今天,小编为同学们收集、整理相当丰富的含英语固定用法的词组,一起来看看吧! 1. other than与no, not, none等否定...
3年前
0200