修改样式

This commit is contained in:
邹景立 2021-04-07 19:15:32 +08:00
parent 57df3f689a
commit 45b10f52ec
2 changed files with 13 additions and 11 deletions

View File

@ -30,16 +30,18 @@ class Admin extends Controller
public function index() public function index()
{ {
// 用户等级分组 // 用户等级分组
$levels = UserUpgradeService::instance()->levels(); [$ts, $ls] = [[], UserUpgradeService::instance()->levels()];
$totals = ['ta' => ['name' => '全部用户', 'count' => 0, 'vips' => '']]; $ts['ta'] = ['vip' => '', 'name' => '全部用户', 'count' => 0];
foreach ($levels as $k => $v) $totals["t{$k}"] = ['name' => $v['name'], 'count' => 0, 'vips' => $k]; foreach ($ls as $k => $v) $ts["t{$k}"] = ['vip' => $k, 'name' => $v['name'], 'count' => 0,];
$totals['to'] = ['name' => '其他用户', 'count' => 0, 'vips' => '']; $ts['to'] = ['vip' => '', 'name' => '其他用户', 'count' => 0];
// 等级分组统计
foreach ($this->app->db->name($this->table)->field('vip_code vip,count(1) count')->group('vip_code')->cursor() as $v) { foreach ($this->app->db->name($this->table)->field('vip_code vip,count(1) count')->group('vip_code')->cursor() as $v) {
[$name, $count] = ["t{$v['vip']}", $v['count'], $totals['ta']['count'] += $v['count']]; [$name, $count] = ["t{$v['vip']}", $v['count'], $ts['ta']['count'] += $v['count']];
isset($totals[$name]) ? $totals[$name]['count'] += $count : $totals['to']['count'] += $count; isset($ts[$name]) ? $ts[$name]['count'] += $count : $ts['to']['count'] += $count;
} }
if (empty($totals['to']['count'])) unset($totals['to']); if (empty($ts['to']['count'])) unset($ts['to']);
$this->total = $totals; $this->total = $ts;
// 设置页面标题 // 设置页面标题
$this->title = '普通用户管理'; $this->title = '普通用户管理';
// 创建查询对象 // 创建查询对象
@ -47,7 +49,7 @@ class Admin extends Controller
// 数据筛选选项 // 数据筛选选项
$this->type = ltrim(input('type', 'ta'), 't'); $this->type = ltrim(input('type', 'ta'), 't');
if (is_numeric($this->type)) $query->where(['vip_code' => $this->type]); if (is_numeric($this->type)) $query->where(['vip_code' => $this->type]);
elseif ($this->type === 'o') $query->whereNotIn('vip_code', array_keys($levels)); elseif ($this->type === 'o') $query->whereNotIn('vip_code', array_keys($ls));
// 用户搜索查询 // 用户搜索查询
$db = $this->_query($this->table)->equal('vip_code#from_vipcode')->like('phone#from_phone,username|nickname#from_username')->db(); $db = $this->_query($this->table)->equal('vip_code#from_vipcode')->like('phone#from_phone,username|nickname#from_username')->db();
if ($db->getOptions('where')) $query->whereRaw("pid1 in {$db->field('id')->buildSql()}"); if ($db->getOptions('where')) $query->whereRaw("pid1 in {$db->field('id')->buildSql()}");

View File

@ -11,12 +11,12 @@
<ul class="layui-tab-title notselect sub-strong-text"> <ul class="layui-tab-title notselect sub-strong-text">
{foreach $total as $k=>$v}{if isset($type) and 't'.$type eq $k} {foreach $total as $k=>$v}{if isset($type) and 't'.$type eq $k}
<li class="layui-this" data-open="{:url('index')}?type={$k}"> <li class="layui-this" data-open="{:url('index')}?type={$k}">
{if is_numeric($v.vips)}[<b class="margin-col-5">VIP{$v.vips}</b>]<span class="padding-left-5"></span>{/if} {if is_numeric($v.vip)}<span class="color-desc margin-right-5">[<b class="margin-col-5">VIP{$v.vip}</b>]</span>{/if}
<b>{$v.name}</b><sup class="layui-badge border-radius">{$v.count|default=0}</sup> <b>{$v.name}</b><sup class="layui-badge border-radius">{$v.count|default=0}</sup>
</li> </li>
{else} {else}
<li data-open="{:url('index')}?type={$k}"> <li data-open="{:url('index')}?type={$k}">
{if is_numeric($v.vips)}[<b class="margin-col-5">VIP{$v.vips}</b>]<span class="padding-left-5"></span>{/if} {if is_numeric($v.vip)}<span class="color-desc margin-right-5">[<b class="margin-col-5">VIP{$v.vip}</b>]</span>{/if}
<b>{$v.name}</b><sup class="layui-badge border-radius">{$v.count|default=0}</sup> <b>{$v.name}</b><sup class="layui-badge border-radius">{$v.count|default=0}</sup>
</li> </li>
{/if}{/foreach} {/if}{/foreach}