浏览代码

修改样式

邹景立 4 年之前
父节点
当前提交
45b10f52ec
共有 2 个文件被更改,包括 13 次插入11 次删除
  1. 11 9
      app/data/controller/user/Admin.php
  2. 2 2
      app/data/view/user/admin/index.html

+ 11 - 9
app/data/controller/user/Admin.php

@@ -30,16 +30,18 @@ class Admin extends Controller
     public function index()
     {
         // 用户等级分组
-        $levels = UserUpgradeService::instance()->levels();
-        $totals = ['ta' => ['name' => '全部用户', 'count' => 0, 'vips' => '']];
-        foreach ($levels as $k => $v) $totals["t{$k}"] = ['name' => $v['name'], 'count' => 0, 'vips' => $k];
-        $totals['to'] = ['name' => '其他用户', 'count' => 0, 'vips' => ''];
+        [$ts, $ls] = [[], UserUpgradeService::instance()->levels()];
+        $ts['ta'] = ['vip' => '', 'name' => '全部用户', 'count' => 0];
+        foreach ($ls as $k => $v) $ts["t{$k}"] = ['vip' => $k, 'name' => $v['name'], 'count' => 0,];
+        $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) {
-            [$name, $count] = ["t{$v['vip']}", $v['count'], $totals['ta']['count'] += $v['count']];
-            isset($totals[$name]) ? $totals[$name]['count'] += $count : $totals['to']['count'] += $count;
+            [$name, $count] = ["t{$v['vip']}", $v['count'], $ts['ta']['count'] += $v['count']];
+            isset($ts[$name]) ? $ts[$name]['count'] += $count : $ts['to']['count'] += $count;
         }
-        if (empty($totals['to']['count'])) unset($totals['to']);
-        $this->total = $totals;
+        if (empty($ts['to']['count'])) unset($ts['to']);
+        $this->total = $ts;
+
         // 设置页面标题
         $this->title = '普通用户管理';
         // 创建查询对象
@@ -47,7 +49,7 @@ class Admin extends Controller
         // 数据筛选选项
         $this->type = ltrim(input('type', 'ta'), 't');
         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();
         if ($db->getOptions('where')) $query->whereRaw("pid1 in {$db->field('id')->buildSql()}");

+ 2 - 2
app/data/view/user/admin/index.html

@@ -11,12 +11,12 @@
     <ul class="layui-tab-title notselect sub-strong-text">
         {foreach $total as $k=>$v}{if isset($type) and 't'.$type eq $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>
         </li>
         {else}
         <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>
         </li>
         {/if}{/foreach}