From 75db3a05d5fc740b5aaec1008efec11f6bf705d3 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 16 May 2017 16:37:37 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E6=B7=BB=E5=8A=A0=E7=B2=89?= =?UTF-8?q?=E4=B8=9D=E6=A0=87=E7=AD=BE=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Fans.php | 28 +++++++++-- application/wechat/view/fans.index.html | 65 ++++++++++++++++++++----- 2 files changed, 76 insertions(+), 17 deletions(-) diff --git a/application/wechat/controller/Fans.php b/application/wechat/controller/Fans.php index da469d142..23e7f8ad5 100644 --- a/application/wechat/controller/Fans.php +++ b/application/wechat/controller/Fans.php @@ -67,11 +67,8 @@ class Fans extends BasicAdmin { } } } - $this->assign('alert', [ - 'type' => 'success', - 'title' => '开发中', - 'content' => '请稍候...' - ]); + $this->assign('tags', $tags); + $this->assign('alert', ['type' => 'success', 'title' => '开发中', 'content' => '请稍候...']); } /** @@ -103,6 +100,27 @@ class Fans extends BasicAdmin { $this->error("设备黑名单失败,请稍候再试!{$wechat->errMsg}[{$wechat->errCode}]"); } + /** + * 标签选择 + */ + public function tagset() { + $tags = $this->request->post('tags', ''); + $fans_id = $this->request->post('fans_id', ''); + $fans = Db::name('WechatFans')->where('id', $fans_id)->find(); + empty($fans) && $this->error('需要操作的数据不存在!'); + $wechat = & load_wechat('User'); + foreach (explode(',', $fans['tagid_list']) as $tagid) { + is_numeric($tagid) && $wechat->batchDeleteUserTag($tagid, [$fans['openid']]); + } + foreach (explode(',', $tags) as $tagid) { + is_numeric($tagid) && $wechat->batchAddUserTag($tagid, [$fans['openid']]); + } + if (false !== Db::name('WechatFans')->where('id', $fans_id)->setField('tagid_list', $tags)) { + $this->success('粉丝标签成功!', ''); + } + $this->error('粉丝标签设置失败, 请稍候再试!'); + } + /** * 取消黑名 */ diff --git a/application/wechat/view/fans.index.html b/application/wechat/view/fans.index.html index e212b17fc..6f613f94a 100644 --- a/application/wechat/view/fans.index.html +++ b/application/wechat/view/fans.index.html @@ -98,17 +98,10 @@ {$vo.sex==1?'男':($vo.sex==2?'女':'未知')} - {if count($vo.tags_list) < 3} - + + + - {else} - - + - - {/if} {if empty($vo.tags_list)} 尚未设置标签 @@ -133,15 +126,63 @@ {if isset($page)}

{$page}

{/if} + +
+
+
+ {foreach $tags as $key=>$tag} +
+ +
+ {/foreach} +
+
+
+ + +
+
+
{/block} {block name="script"} {/block}