From b7f11237c67ba1f9356ea1b9c020fb61612c5672 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 26 Apr 2017 16:08:16 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=9B=BE=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/News.php | 19 +++++++------------ application/wechat/view/news.push.html | 17 ++++++++--------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/application/wechat/controller/News.php b/application/wechat/controller/News.php index 12c1a0d7a..f6a8728bd 100644 --- a/application/wechat/controller/News.php +++ b/application/wechat/controller/News.php @@ -160,22 +160,17 @@ class News extends BasicAdmin { */ public function push() { # 获取将要推送的粉丝列表 - $params = $this->request->post('group', ''); - $ids = explode(',', $params); - $fansDb = Db::name('WechatFans'); - $news_id = $this->request->get('id', ''); switch (strtolower($this->request->get('action', ''))) { - case 'getgroup': - if (!in_array('0', $ids)) { - $fansDb->where("concat(',',tagid_list,',') REGEXP '," . join(',|,', $ids) . ",'"); - } - return ['code' => "SUCCESS", 'data' => $fansDb->where('subscribe', '1')->column('openid,nickname')]; case 'getuser': - if (!in_array('0', $ids)) { - $fansDb->where("concat(',',tagid_list,',') REGEXP '," . join(',|,', $ids) . ",'"); + if ('' === ($params = $this->request->post('group', ''))) { + return ['code' => 'SUCCESS', 'data' => []]; } - return ['code' => "SUCCESS", 'data' => $fansDb->where('subscribe', '1')->column('openid,nickname')]; + $ids = explode(',', $params); + $db = Db::name('WechatFans'); + !in_array('0', $ids) && $db->where("concat(',',tagid_list,',') REGEXP '," . join(',|,', $ids) . ",'"); + return ['code' => "SUCCESS", 'data' => $db->where('subscribe', '1')->limit(200)->column('nickname')]; default : + $news_id = $this->request->get('id', ''); // 显示及图文 $newsinfo = WechatService::getNewsById($news_id); // Get 请求,显示选择器界面 diff --git a/application/wechat/view/news.push.html b/application/wechat/view/news.push.html index 2bf5155ed..1aacf1e83 100644 --- a/application/wechat/view/news.push.html +++ b/application/wechat/view/news.push.html @@ -18,7 +18,7 @@
{foreach $fans_tags as $tag} -