TaoLer左侧悬浮插件效果图: 

悬浮

html:

<div class="statistics layui-hide-xs">
<div class="border-bottom text-center text-blod statistics-item">
<div class="f-13">资源总数</div>
<div class="statistics_text">{$leftlayer.total}+</div>
</div>
<div class="border-bottom text-center text-blod statistics-item">
<div class="f-13">今日更新</div>
<div class="statistics_text">{$leftlayer.todaynum}</div>
</div>
<div class="border-bottom text-center text-blod statistics-item">
<div class="f-13">会员总数</div>
<div class="statistics_text">{$leftlayer.usernum}</div>
</div>
<div class="border-bottom text-center text-blod statistics-item">
<div class="f-13">今日注册</div>
<div class="statistics_text">{$leftlayer.todayusernum}</div>
</div>
<div class="text-center text-blod statistics-item"><img class="statistics-item-img" src="/addons/leftlayer/img/vipp.png" alt=""></div>
</div>
<p>layui.link('/addons/leftlayer/css/leftlayer.css')</p>

 

插件代码:

public function showLeftLayer($param) { 
  $info = get_addons_info('leftLayer'); 
  if($info['status']){ // 数据 
  $article = Db::name('article')->field('id')->where(['delete_time' => 0])->cache(300)->select(); $total = count($article); 
  $todayArticle = Db::name('article')->field('id')->where(['delete_time' => 0])->whereDay('create_time')->cache(300)->select(); 
  $todayNum = count($todayArticle); 
  $user = Db::name('user')->field('id')->where(['delete_time'=> 0])->cache(300)->select(); 

  $userNum = count($user); $todayUser = Db::name('user')->field('id')->whereDay('create_time')->cache(300)->select(); 
  $todayUserNum = count($todayUser); 
  $data = [ 'total' => $total, 'todaynum' => $todayNum, 'usernum' => $userNum, 'todayusernum' => $todayUserNum ]; 
  $this->assign('leftlayer',$data); return $this->fetch('index'); 
} }

目录结构: