// ================== 系统通知后台管理页(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
艾瑞克网-艾瑞克网-第106页
艾瑞克网-艾瑞克网-第106页
英语动词和短语动词高考考点-艾瑞克网

英语动词和短语动词高考考点

 动词和短语动词第一部分 七年高考题荟萃2011年高考题1. (2011全国卷,34) William found it increasingly difficult to read, for his eyesight was beginning to ______.ear答案:C解析:考查...
3年前
017535706
英语一次词的固定用法-艾瑞克网

英语一次词的固定用法

 book sb. sth. = book sth. for sb. 为某人预定某物buy sb. sth. = buy sth. for sb. 为某人买某物choose sb. sth. = choose sth. for sb. 为某人选某物cook sb. sth. = cook sth. for sb. 为...
3年前
024223450
英语美文-艾瑞克网

英语美文

 Of course, there are a lot of things you should do in your 20s.当然,20多岁时需要做的事情很多。不过我一直觉得其中有一些更加优先一些。And here are the 17 on the top of my list.下...
3年前
04851291
如何提升英语口语?-艾瑞克网

如何提升英语口语?

 英语的学习是一件重要的事情,那大家知道怎样学好英语口语呢?为了进一步帮助到大家的口语学习,下文中特整理了有关如何通过自己练习提升英语口语的方法,一起来看看吧。一、如何通过自己练习...
3年前
012076772
英语文化中英文对译-艾瑞克网

英语文化中英文对译

 Do you want a foolproof way to loose weight while staying full? The 1700 Calorie Diet just might be the best way for you to get healthy while staying full.你想找到一个靠谱的减重...
3年前
06725804
怎样提高英语六级作文水平-艾瑞克网

怎样提高英语六级作文水平

英语的学习离不开听说读写几个方面,备考英语六级的过程中,写作是必考项目。下面,小编给大家分享几个怎样提高英语六级作文水平的方法,大家可以作为参考。怎样提高英语作文:词汇量词汇不仅仅...
3年前
09441314
商务英语考试时间是多长?-艾瑞克网

商务英语考试时间是多长?

 很多人都想考商务英语,以提高自身的就业优势,但是很多人都不知道商务英语考试时间是多少。下面是关于商务英语考试介绍,大家可以作为了解。考试时间为:BEC初级:阅读、写作90分钟,听力40...
3年前
016415161
2018年6月英语四级作文模板:表示给定观点-艾瑞克网

2018年6月英语四级作文模板:表示给定观点

 写好英语四级作文,除了写作技巧和储备好词妙句外,参考借鉴和使用一些英语四级作文的写作模板是不少考生都会在备考和考试中使用的方法。为了让同学们对英语作文有更深的理解,下面小编精心为...
3年前
025765221
高考必考语法精讲精练,语法专题二:代词-艾瑞克网

高考必考语法精讲精练,语法专题二:代词

 高考必考语法精讲精练语法专题二:代词代词是英语中非常重要的一类词,也是高考必考考点。《2017年普通高等学校招生全国统一考试大纲》附录语法项目表中对代词考查列了六项:①人称代词②物主...
3年前
012042946
英语习题-艾瑞克网

英语习题

  1.He was eager to make some extra money, since during these years he could hardly live on his_______. wage b. few wage c. wage d. wages 2.Most of the houses in the village w...
3年前
0190