From c236352a57ac5645b6f41b7f2770e01eee3ebe73 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 10 Dec 2019 14:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E7=B2=89?= =?UTF-8?q?=E4=B8=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wechat/controller/Fans.php | 28 ++++++++-------- app/wechat/view/fans/index.html | 57 ++++++++++++++------------------- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/app/wechat/controller/Fans.php b/app/wechat/controller/Fans.php index 5e4283f69..49fbf7af7 100644 --- a/app/wechat/controller/Fans.php +++ b/app/wechat/controller/Fans.php @@ -55,11 +55,11 @@ class Fans extends Controller */ protected function _index_page_filter(array &$data) { - $tags = $this->app->db->name('WechatFansTags')->column('id,name'); - foreach ($data as &$user) { - $user['tags'] = []; - foreach (explode(',', $user['tagid_list']) as $tagid) { - if (isset($tags[$tagid])) $user['tags'][] = $tags[$tagid]; + $tags = $this->app->db->name('WechatFansTags')->column('name', 'id'); + foreach ($data as &$vo) { + $vo['tags'] = []; + foreach (explode(',', $vo['tagid_list']) as $tagid) { + if (isset($tags[$tagid])) $vo['tags'][] = $tags[$tagid]; } } } @@ -71,7 +71,6 @@ class Fans extends Controller public function sync() { try { - $appid = WechatService::instance()->getAppid(); sysqueue('同步粉丝数据', "xsync:fansall", 1, [], 0); $this->success('创建任务成功,请等待完成!'); } catch (HttpResponseException $exception) { @@ -82,10 +81,10 @@ class Fans extends Controller } /** - * 批量拉黑粉丝 + * 用户拉入黑名单 * @auth true */ - public function setBlack() + public function black_add() { try { $this->_applyFormToken(); @@ -93,19 +92,19 @@ class Fans extends Controller WechatService::WeChatUser()->batchBlackList($openids); $this->app->db->name('WechatFans')->whereIn('openid', $openids)->update(['is_black' => '1']); } - $this->success('拉黑粉丝信息成功!'); + $this->success('用户拉入黑名单成功!'); } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $e) { - $this->error("拉黑粉丝信息失败,请稍候再试!{$e->getMessage()}"); + $this->error("用户拉入黑名单失败,请稍候再试!{$e->getMessage()}"); } } /** - * 取消拉黑粉丝 + * 用户移出黑名单 * @auth true */ - public function delBlack() + public function black_del() { try { $this->_applyFormToken(); @@ -113,15 +112,14 @@ class Fans extends Controller WechatService::WeChatUser()->batchUnblackList($openids); $this->app->db->name('WechatFans')->whereIn('openid', $openids)->update(['is_black' => '0']); } - $this->success('取消拉黑粉丝信息成功!'); + $this->success('用户移出黑名单成功!'); } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $e) { - $this->error("取消拉黑粉丝信息失败,请稍候再试!{$e->getMessage()}"); + $this->error("用户移出黑名单失败,请稍候再试!{$e->getMessage()}"); } } - /** * 删除粉丝信息 * @auth true diff --git a/app/wechat/view/fans/index.html b/app/wechat/view/fans/index.html index 54d85f79a..52083a6ec 100644 --- a/app/wechat/view/fans/index.html +++ b/app/wechat/view/fans/index.html @@ -2,16 +2,16 @@ {block name="button"} -{if auth("setblack")} - +{if auth("black_add")} + {/if} -{if auth("delblack")} - +{if auth("black_del")} + {/if} {if auth("sync")} - + {/if} {/block} @@ -23,9 +23,11 @@ {notempty name='list'} - + + + 微信昵称 - 粉丝标签 + 性别语言 关注时间 @@ -37,13 +39,12 @@ {foreach $list as $key=>$vo} - + - +
- 昵称:{$vo.nickname|default='--'} -
+ 昵称:{$vo.nickname|default='--'}
区域:{$vo.country|default='--'} {$vo.province} {$vo.city}
@@ -51,41 +52,31 @@
{foreach $vo.tags as $t}

{$t|default='--'}

{/foreach}
- 性别:{switch name='vo.sex'}{case value='1'}男{/case}{case value='2'}女{/case}{default}未知{/switch} -
+ 性别:{switch name='vo.sex'}{case value='1'}男{/case}{case value='2'}女{/case}{default}未知{/switch}
语言:{$vo.language|raw} 日期:{$vo.subscribe_at|format_datetime|str_replace=' ','
时间:',###|raw} - {eq name='vo.subscribe' value='0'} - 未关注 - {else} - 已关注 - {/eq} + {eq name='vo.subscribe' value='0'}未关注{else}已关注{/eq}
- {eq name='vo.is_black' value='0'} - 未拉黑 - {else} - 已拉黑 - {/eq} + {eq name='vo.is_black' value='0'}未拉黑{else}已拉黑{/eq} - {eq name='vo.is_black' value='0'} - - 拉 黑 - - {else} - - 拉 白 - - {/eq} + {if auth('black_add') and $vo.is_black eq 0} + 拉 黑 + {/if} + + {if auth('black_del') and $vo.is_black eq 1} + 移 出 + {/if} {if auth("remove")} - 删 除 + 删 除 {/if} + {/foreach}