// ================== 系统通知后台管理页(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
艾瑞克网-艾瑞克网-第170页
艾瑞克网-艾瑞克网-第170页
2017年12月英语四级作文经典开头句盘点-艾瑞克网

2017年12月英语四级作文经典开头句盘点

(1)用于描写漫画、图表的常用句型 ①As the graph depicts , … ②From the cartoon /picture , we can see that … ③According to the statistics shown in the first /second graph , ④The ...
2024-2025学年人教版九年级英语期末复习真题分类练习 (共12个专题)-艾瑞克网
专业四级考试便条作文写作及样例-艾瑞克网

专业四级考试便条作文写作及样例

便条是一种简单的书信。虽然内容简单,但却有其独特的风格。主要目的是为了尽快地把最新的信息、通知、要求或者活动的时间、地点转告给对方。常见的便条有欠条、留言和请假条等。   特点:...
2017年12月大学英语六级作文百变句子开头-艾瑞克网

2017年12月大学英语六级作文百变句子开头

1.以同位语作为句子的开头。 The most popular teacher in Neworiental, Ma Zihui, will attend the party. 2.以单个修饰语作为句子的开头。 这个修饰语可以是形容词、分词或副词。 Young and a...
公共英语等级考试一级写作必备对译(1)-艾瑞克网

公共英语等级考试一级写作必备对译(1)

1. Anthropologists have discovered that fear, happiness, sadness, and surprise are universally reflected in facial expressions. 人类学家已经发现,恐惧,快乐,悲伤和惊奇都会行之于色...
3年前
0366
中考英语作文热点话题:爱好-艾瑞克网

中考英语作文热点话题:爱好

中考英语作文热点话题:爱好 ★ 范文 My Hobby I am a 15-year-old student in junior Grade 3. Though I am occupied with my study, I would like to spend time on my hobbies, such as play...
3年前
03611
need的用法-艾瑞克网

need的用法

Need he go so soon?他这么快就要走吗?He needn't go. 他不必走。If she wants anything, she need only ask. 她想要什麽, 只需说一声就行。He wondered whether they need go there. 他不知道...
3年前
03614
人教版九年级 Unit 6 When was it invented?知识点-艾瑞克网

人教版九年级 Unit 6 When was it invented?知识点

Unit 6 When was it invented?一.重点短语1.by accident偶然;意外地     2.divide into把…分成…3.take place发生     happen发生(没有被动形式)4.all of a sudden=suddenly 突然;...
2年前
0360
2024版新人教版七上英语Unit 4 My Favourite Subject板块练习-艾瑞克网
2024年中考英语二轮热点题型归纳与变式演练(全国通用)任务型阅读之阅读还原-艾瑞克网

2024年中考英语二轮热点题型归纳与变式演练(全国通用)任务型阅读之阅读还原

【题型解读】 还原句子型阅读是中考题型中比较新的题型,一般有200-250个单词左右,常见题型为5选5、6选、7选5。这题型实际上需要学生拓宽自己思维的深度和广度,不再只是简单地从句子层面出发...