Commit b6e469e8 authored by shajiaiming's avatar shajiaiming

列表排序

parent 6edafced
......@@ -2,6 +2,7 @@
namespace backend\controllers;
use common\components\Tools;
use common\models\psources\CoinPlatform;
use Yii;
use common\models\Admin;
......@@ -47,9 +48,19 @@ class AuthController extends BaseController
/* 获取角色列表 */
$self_roles = current($auth->getRolesByUser(Yii::$app->user->id));
$roles = $auth->getChildRoles($self_roles->name);
$roles_temp = [];
foreach ($roles as $key => $role) {
$roles_temp[$role->name]['type'] = $role->type;
$roles_temp[$role->name]['name'] = $role->name;
$roles_temp[$role->name]['description'] = $role->description;
$roles_temp[$role->name]['ruleName'] = $role->ruleName;
$roles_temp[$role->name]['data'] = $role->data;
$roles_temp[$role->name]['createdAt'] = $role->createdAt;
$roles_temp[$role->name]['updatedAt'] = $role->updatedAt;
}
$roles_temp = Tools::arraySort($roles_temp, 'createdAt');
return $this->render('index', [
'roles' => $roles,
'roles' => $roles_temp,
]);
}
......
......@@ -32,10 +32,10 @@ use yii\helpers\Url;
<tr class="odd gradeX">
<?php $nn++;?>
<td><?=$nn?></td>
<td style = 'white-space: nowrap;'><?=$value->name?></td>
<td style = 'white-space: nowrap;'><?=$value->description?></td>
<td style = 'white-space: nowrap;'><?=date('Y-m-d H:i',$value->createdAt)?></td>
<td style = 'white-space: nowrap;'><?=date('Y-m-d H:i',$value->updatedAt)?></td>
<td style = 'white-space: nowrap;'><?=$value['name']?></td>
<td style = 'white-space: nowrap;'><?=$value['description']?></td>
<td style = 'white-space: nowrap;'><?=date('Y-m-d H:i',$value['createdAt'])?></td>
<td style = 'white-space: nowrap;'><?=date('Y-m-d H:i',$value['updatedAt'])?></td>
<td style = 'white-space: nowrap;'>
<a href="<?=Url::toRoute(['edit', 'role'=>$key])?>" class="btn btn-xs blue"><i class="fa fa-edit"></i> 编辑</a>
<a href="<?=Url::toRoute(['auth', 'role'=>$key])?>" class="btn btn-xs blue"><i class="icon-key"></i> 授权</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment