[更新]增加微信粉丝列表

This commit is contained in:
邹景立 2017-04-13 15:25:26 +08:00
parent 81f6b4a7e7
commit c996e89e64
4 changed files with 79 additions and 3 deletions

View File

@ -14,7 +14,7 @@
{block name="content"}
<!-- 表单搜索 开始 -->
<form class="animated form-search" action="{:request()->url(true)}" onsubmit="return false" method="get" data-search>
<form class="animated form-search" action="{:request()->url(true)}" onsubmit="return false" method="get">
<div class="row">
<div class="col-xs-3">

View File

@ -15,6 +15,7 @@
namespace app\wechat\controller;
use controller\BasicAdmin;
use think\Db;
/**
* 微信粉丝管理
@ -25,8 +26,16 @@ use controller\BasicAdmin;
*/
class Fans extends BasicAdmin {
public function index() {
protected $table='WechatFans';
public function index() {
$this->title='微信粉丝管理';
$db = Db::name($this->table);
$get = $this->request->get();
if(isset($get['nickname']) && $get['nickname']!==''){
$db->where('nickname','like',"%{$get['nickname']}%");
}
return parent::_list($db);
}
}

View File

@ -0,0 +1,67 @@
{extend name='extra@admin/content' /}
{block name="button"}
<div class="nowrap pull-right" style="margin-top:10px">
<button data-load="{:url('sync')}" class='layui-btn layui-btn-small'>
<i class='fa fa-referer'></i> 同步粉丝
</button>
</div>
{/block}
{block name="content"}
<!-- 表单搜索 开始 -->
<form class="animated form-search" action="{:request()->url(true)}" onsubmit="return false" method="get">
<div class="row">
<div class="col-xs-3">
<div class="form-group">
<input type="text" name="nickname" value="{$Think.get.nickname|default=''}" placeholder="昵称"
class="input-sm form-control">
</div>
</div>
<div class="col-xs-1">
<div class="form-group">
<button type="submit" class="btn btn-sm btn-white"><i class="fa fa-search"></i> 搜索</button>
</div>
</div>
</div>
</form>
<!-- 表单搜索 结束 -->
<form onsubmit="return false;" data-auto="" method="POST">
<input type="hidden" value="resort" name="action"/>
<table class="table table-hover">
<thead>
<tr>
<th class='list-table-check-td'>
<input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
</th>
<th class='text-left'>用户昵称</th>
<th class='text-center'>性别</th>
<th class='text-center'>区域</th>
<th class='text-center'>关注时间</th>
</tr>
</thead>
<tbody>
{foreach $list as $key=>$vo}
<tr>
<td class='list-table-check-td'>
<input class="list-check-box" value='{$vo.id}' type='checkbox'/>
</td>
<td class='text-left'>
<img style="width:25px;height:25px;border-radius:50%;margin-right:10px" alt=""
onerror="this.src='__STATIC__/theme/default/img/image.png'" src="{$vo.headimgurl}"/>
{$vo.nickname}
</td>
<td class='text-center'>{$vo.sex==1?'男':($vo.sex==2?'女':'未知')}</td>
<td class='text-center'>{$vo.country|default='<span style="color:#999">未设置区域信息</span>'}{$vo.province}{$vo.city}</td>
<td class='text-center'>{$vo.subscribe_at}</td>
</tr>
{/foreach}
</tbody>
</table>
{if isset($page)}<p>{$page}</p>{/if}
</form>
{/block}

View File

@ -31,7 +31,7 @@ define(['jquery', 'admin.plugs'], function () {
});
/*! 注册 data-serach 表单搜索行为 */
this.$body.on('submit', 'form[data-search]', function () {
this.$body.on('submit', 'form.form-search', function () {
var split = this.action.indexOf('?') === -1 ? '?' : '&';
if ((this.method || 'get').toLowerCase() === 'get') {
window.location.href = '#' + parseUri(this.action + split + $(this).serialize());