禁用启用

//html

<extend name="Public/base" />

<block name="body">
<!-- 标题栏 -->
<div class="main-title">
<h2>app用户</h2>
</div>
<div class="cf">
<div class="fl">
<a class="btn" href="{:U('add')}">新 增</a>
</div>

<!-- 高级搜索 -->
<div class="search-form fr cf">
<div class="sleft">
<input type="text" name="nickname" class="search-input" value="{:I('nickname')}" placeholder="请输入用户姓名或手机号搜索">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data-table table-striped">
<table class="">
<thead>
<tr>
<th class="">UID</th>
<th class="">姓名</th>
<th class="">手机号</th>
<th class="">医院</th>
<th class="">科室</th>
<th class="">身份</th>
<!--<th class="">擅长</th>-->
<th class="">最后登录时间</th>
<th class="">注册时间</th>
<th class="">状态</th>
<th class="">认证状态</th>
<th class="">积分</th>
<th class="">标签</th>
<th class="">是否显示公告</th>
<th class="">操作</th>
</tr>
</thead>
<tbody>
<notempty name="_list">
<volist name="_list" id="vo">
<tr>
<td>{$vo.id} </td>
<td>{$vo.username}</td>
<td>{$vo.phone}</td>
<td>{$vo.hospital}</td>
<td>{$vo.department}</td>
<td>{$vo.identity_name}</td>
<!--<td>{$vo.specialize_name}</td>-->
<!--<td>{$vo.update_time|time_format}</td>
<td>{$vo.created_time|time_format}</td>-->
<td>
<if condition="$vo['update_time']" >
{$vo.update_time|time_format}
<else />
--
</if>
</td>
<td>
<if condition="$vo['created_time']" >
{$vo.created_time|time_format}
<else />
--
</if>
</td>
<td>
<!--用户状态-->
<if condition="$vo.status eq 1" >
<span class="status-green">启用</span>
<else/>
<span class="status-red">禁用</span>
</if>
</td>
<td>
<!--认证状态-->
<if condition="$vo.certification eq 1" >
<span class="status-red">未认证</span>
<elseif condition="$vo.certification eq 2" />
<span class="status-yellow">待审核</span>
<elseif condition="$vo.certification eq 3" />
<span class="status-green">已认证</span>
<elseif condition="$vo.certification eq 4"/>
<span class="status-red">拒绝</span>
</if>
</td>
<td>{$vo.integral}</td>
<td>
<if condition="$vo.label eq 1" >
<span class="status-green">专家</span>
<elseif condition="$vo.label eq 2" />
<span class="status-green">教授</span>
</if>
</td>
<td>
<!--是否显示公告-->
<if condition="$vo.announcement eq 1" >
<span class="status-red">否</span>
<elseif condition="$vo.announcement eq 2"/>
<span class="status-green">是</span>
</if>
</td>
<td>
<eq name="vo.status" value="1">
<a href="{:U('disable?method=forbidUser&id='.$vo['id'])}" class="ajax-get">禁用</a>
<else/>
<a href="{:U('disable?method=resumeUser&id='.$vo['id'])}" class="ajax-get">启用</a>
</eq>
<a href="{:U('edit?id='.$vo['id'])}" >编辑</a>
<a href="{:U('Fans/index?id='.$vo['id'])}" >粉丝列表</a>
</td>
</tr>
</volist>
<else/>
<td colspan="16" class="text-center"> aOh! 暂时还没有内容! </td>
</notempty>
</tbody>
</table>
</div>
<div class="page">
{$_page}
</div>
</block>

//控制器

public function disable($method = null)
{
$id = array_unique((array)I('id', 0));

$id = is_array($id) ? implode(',', $id) : $id;
if (empty($id)) {
$this->error('请选择要操作的数据!');
}
$map['id'] = array('in', $id);
switch (strtolower($method)) {
case 'forbiduser':
$rid = array_unique((array)I('id', 0));
action_log_new('AppUser', $rid, '禁用', 'username');
$this->forbid($this->model, $map);
break;
case 'resumeuser':
$rid = array_unique((array)I('id', 0));
action_log_new('AppUser', $rid, '启用', 'username');
$this->resume($this->model, $map);
break;
default:
$this->error('参数非法');
}
}

猜你喜欢

转载自www.cnblogs.com/maohongli/p/12197226.html