添加粉丝记录导出

This commit is contained in:
Anyon 2020-10-13 14:29:46 +08:00
parent dc0f15c2b0
commit 19a63d7f50
3 changed files with 44 additions and 15 deletions

View File

@ -54,11 +54,11 @@ class ShopOrder extends Controller
// 列表选项卡
if (is_numeric($this->type = trim(input('type', 'ta'), 't'))) $query->where(['status' => $this->type]);
// 分页排序处理
$query->order('id desc');
if (input('output') === 'json') {
$result = $query->order('id desc')->page(true, false);
$this->success('获取数据列表成功', $result);
$this->success('获取数据成功', $query->page(true, false));
} else {
$query->order('id desc')->page();
$query->page();
}
}

View File

@ -46,7 +46,12 @@ class Fans extends Controller
$this->title = '微信用户管理';
$this->where = ['appid' => WechatService::instance()->getAppid()];
$query = $this->_query($this->table)->like('nickname')->equal('subscribe,is_black');
$query->dateBetween('subscribe_at')->where($this->where)->order('subscribe_time desc')->page();
$query->dateBetween('subscribe_at')->where($this->where)->order('subscribe_time desc');
if (input('output') === 'json') {
$this->success('获取数据成功', $query->page(true, false));
} else {
$query->page();
}
}
/**

View File

@ -4,14 +4,14 @@
<div class="layui-form-item layui-inline">
<label class="layui-form-label">微信昵称</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input name="nickname" value="{:input('nickname')}" placeholder="请输入微信昵称" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">关注状态</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<select class="layui-select" name="subscribe">
{foreach [''=>'-- 全部 --','0'=>'显示未关注的粉丝','1'=>'显示已关注的粉丝'] as $k=>$v}
{if $k.'' eq input('subscribe')}
@ -21,12 +21,12 @@
{/if}
{/foreach}
</select>
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">拉黑状态</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<select class="layui-select" name="is_black">
{foreach [''=>'-- 全部 --','0'=>'显示未拉黑的粉丝','1'=>'显示已拉黑的粉丝'] as $k=>$v}
{if $k.'' eq input('is_black')}
@ -36,21 +36,45 @@
{/if}
{/foreach}
</select>
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">关注时间</label>
<div class="layui-input-inline">
<label class="layui-input-inline">
<input data-date-range name="subscribe_at" value="{:input('subscribe_at')}" placeholder="请选择关注时间" class="layui-input">
</div>
</label>
</div>
<div class="layui-form-item layui-inline">
<button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
<button type="submit" class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
<button type="button" data-form-export="{:url('index')}?type={$type|default=''}" class="layui-btn layui-btn-primary">
<i class="layui-icon layui-icon-export"></i>
</button>
</div>
</form>
</fieldset>
<script>window.form.render()</script>
<script>
window.form.render();
require(['excel'], function (excel) {
excel.bind(function (data, sexs) {
sexs = {1: '男', 2: '女'};
data.forEach(function (item, index) {
data[index] = [
item.openid || '',
item.nickname || '',
item.country || '',
item.province || '',
item.city || '',
sexs[item.sex] || '未知',
item.subscribe ? '已订阅' : '未订阅',
item.subscribe_at || '',
item.is_black ? '已拉黑' : '未拉黑',
];
});
data.unshift(['OPENID', '微信昵称', '所在国家', '所在省份', '所在城市', '性别', '订阅状态', '订阅时间', '是否拉黑']);
return data;
}, '微信粉丝数据');
});
</script>