2025-04-10 23:19:13 +08:00

86 lines
4.8 KiB
PHP
Executable File

<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use yii\widgets\LinkPager;
$this->title = 'API用户列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<h1><?= Html::encode($this->title) ?></h1>
<div class="row">
<div class="col-sm-3">
<a class="btn btn-info btn-sm" href="<?= Url::toRoute('user/create')?>">新增用户</a>
</div>
<form action="<?=Url::toRoute('user/list')?>" method="post">
<input type="hidden" name="_csrf-backend" value="<?= Yii::$app->getRequest()->getCsrfToken();?>" />
<div class="col-sm-3 pull-right">
<div class="input-group">
<input type="text" placeholder="请输入手机号" name="search[mobile]" class="input-sm form-control" value="<?= isset($search['mobile'])?$search['mobile']:''; ?>"> <span class="input-group-btn">
<button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
</div>
</div>
<div class="col-sm-3 pull-right">
<input type="text" placeholder="请输入用户名" name="search[username]" class="input-sm form-control" value="<?= isset($search['username'])?$search['username']:''; ?>">
</div>
</form>
</div>
<hr>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>序号</th>
<th>账号</th>
<th>联系方式</th>
<th>存入统计</th>
<th>取出统计</th>
<th>短信统计</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($user as $vo):?>
<tr>
<td><?=$vo['id']?></td>
<td><img src="<?=Url::to($vo['avatar'])?>" alt="" style="width:40px;height:40px;"><?=$vo['username']?></td>
<td><?=$vo['mobile']?><br><?=$vo['email']?></td>
<td>流量:<?=$vo['inbytes']?>字节<br>次数:<?=$vo['intimes']?>次</td>
<td>流量:<?=$vo['outbytes']?>字节<br>次数:<?=$vo['outtimes']?>次</td>
<td>累计发送:<?=$vo['sms_total']?>条<br>剩余:<?=$vo['sms_left']?>条</td>
<td><?=$status[$vo['status']]['title']?></td>
<td><a class="btn btn-primary btn-xs" href="<?=Url::toRoute(['user/update','id'=>$vo['id']])?>"><i class="fa fa-edit"></i>编辑</a>
<?php if($vo['status']==9):?><a href="<?=Url::toRoute(['status','status'=>10,'id'=>$vo['id']])?>" class="btn btn-warning btn-xs"><i class="fa fa-unlock"></i>启用</a><?php endif;?>
<?php if($vo['status']==10):?><a href="<?=Url::toRoute(['status','status'=>9,'id'=>$vo['id']])?>" class="btn btn-danger btn-xs"><i class="fa fa-lock"></i>禁用</a><?php endif;?>
<?php if(!in_array($vo['username'],array('publicapi','test'))):?><a href="<?=Url::toRoute(['user/delete','id'=>$vo['id']])?>" class="btn btn-default btn-xs"><i class="fa fa-close"></i>删除</a><?php endif;?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!--分页-->
<div class="f-r">
<?= LinkPager::widget([
'pagination'=>$pages,
'firstPageLabel' => '首页',
'nextPageLabel' => '下一页',
'prevPageLabel' => '上一页',
'lastPageLabel' => '末页',
]) ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>