Commit 7c1ec98467510740a0dd78b7a6730b8eb0d35770
1 parent
4f37eeab
Exists in
master
app-ht
1. F 后台管理日志功能调整
Showing
6 changed files
with
44 additions
and
11 deletions
Show diff stats
app-ht/config/params.php
app-ht/modules/system/controllers/AdminLogController.php
... | ... | @@ -78,11 +78,11 @@ class AdminLogController extends BaseController |
78 | 78 | */ |
79 | 79 | $pageSize = $request->get("pageSize") ? (int)$request->get("pageSize") : 50; |
80 | 80 | $pages = new Pagination(['totalCount' => $query->count(), 'pageSize' => $pageSize]); |
81 | - $adminLog = $query->offset($pages->offset)->limit($pages->limit)->all(); | |
82 | - $model = $query->asArray()->all(); | |
81 | + $adminLog = $query->offset($pages->offset)->limit($pages->limit)->asArray()->all(); | |
82 | + //$model = $query->asArray()->all(); | |
83 | 83 | |
84 | 84 | return $this->render('index', array( |
85 | - 'adminLog' => $model, | |
85 | + 'adminLog' => $adminLog, | |
86 | 86 | 'pages' => $pages, |
87 | 87 | 'sysUser' => $sysUser, |
88 | 88 | 'gets' => $get | ... | ... |
app-ht/modules/system/views/admin-log/index.php
... | ... | @@ -18,7 +18,9 @@ $this->params['breadcrumbs'][] = $this->title; |
18 | 18 | <select class="form-control" name="user_id"> |
19 | 19 | <option value="0">全部</option> |
20 | 20 | <?php foreach ($sysUser as $item): ?> |
21 | - <option value="<?php echo $item->id ?>" <?php if ($gets['user_id'] == $item->id) { echo "selected"; } ?>><?php echo $item->username . '(' . $item->profile->realname . ')' ?></option> | |
21 | + <?php if(isset($item->id)) {?> | |
22 | + <option value="<?php echo $item->id ?>" <?php if ($gets['user_id'] == $item->id) { echo "selected"; } ?>><?php echo isset($item->username)?$item->username:'' ?></option> | |
23 | + <?php }?> | |
22 | 24 | <?php endforeach; ?> |
23 | 25 | </select> |
24 | 26 | </td> | ... | ... |
app-ht/views/layouts/routes.php
... | ... | @@ -130,6 +130,7 @@ if (isset($user->is_manufacture) && $user->is_manufacture == 1) { |
130 | 130 | ], |
131 | 131 | ['label' => '角色管理', 'path' => '/system/role/index'], |
132 | 132 | ['label' => '账号管理', 'path' => '/system/account/index'], |
133 | + ['label' => '系统操作日志', 'path' => '/system/admin-log/index'], | |
133 | 134 | ] |
134 | 135 | ] |
135 | 136 | ]; | ... | ... |
console/controllers/TestController.php
... | ... | @@ -389,12 +389,12 @@ echo $randKey."\r\n"; |
389 | 389 | } |
390 | 390 | public function actionB() |
391 | 391 | { |
392 | + $username = '3TestNull3'; | |
392 | 393 | |
393 | - $deviceModel = DeviceRepository::findBatchRandOne(2); | |
394 | - if ($deviceModel) { | |
395 | - echo $deviceModel->id; | |
396 | - $deviceModel->device_id = '000000000012'; | |
397 | - $deviceModel->save(); | |
394 | + if (preg_match("/^[a-zA-Z0-9]{6,12}$/", $username)){ | |
395 | + echo "ok"; | |
396 | + } else { | |
397 | + echo "no"; | |
398 | 398 | } |
399 | 399 | } |
400 | 400 | } | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace domain; | |
4 | + | |
5 | +/** | |
6 | + * 数据库助手类 | |
7 | + * Class DBHelper | |
8 | + * @package common\models | |
9 | + */ | |
10 | +class DBHelper | |
11 | +{ | |
12 | + /** | |
13 | + * 获取指定数据库连接中的数据库名称 | |
14 | + * @return string | |
15 | + */ | |
16 | + public static function getDbName($dbConnection) | |
17 | + { | |
18 | + if (isset($dbConnection->masters) && isset($dbConnection->masters->dsn)) { | |
19 | + $dsn = $dbConnection->masters->dsn; | |
20 | + } elseif (isset($dbConnection->dsn)) { | |
21 | + $dsn = $dbConnection->dsn; | |
22 | + } else { | |
23 | + return 'jiwork'; | |
24 | + } | |
25 | + | |
26 | + // 'mysql:host=localhost;dbname=jiwork' | |
27 | + $dbName = substr($dsn, strpos($dsn, 'dbname=') + strlen('dbname=')); | |
28 | + return $dbName; | |
29 | + } | |
30 | +} | |
0 | 31 | \ No newline at end of file | ... | ... |