public function beforeAction($action) { $login_status = $this->checkLoginStatus(); if (!$login_status && !in_array($action->getUniqueId(), $this->allowAllAction)) { if (Yii::$app->request->isAjax) { $this->renderJSON([], "未登录,请返回用户中心", -302); } else { $this->redirect(AdminUrlService::buildUrl("/auth/index")); } return false; } $view = Yii::$app->view; $view->params['current_user'] = $this->current_user; $params = ['target_type' => 1, 'target_id' => $this->current_user ? $this->current_user['uid'] : 0, 'act_type' => 2, 'status' => 1]; AccessLogService::recordAccess_log($params); return true; }
public function actionIndex() { $p = intval($this->get("p", 1)); if (!$p) { $p = 1; } $data = []; $pagesize = 20; $query = Book::find(); $total_count = $query->count(); $offset = ($p - 1) * $pagesize; $book_info = $query->orderBy("id desc")->offset($offset)->limit($pagesize)->all(); $page_info = DataHelper::ipagination(["total_count" => $total_count, "page_size" => $pagesize, "page" => $p, "display" => 10]); if ($book_info) { $idx = 1; $domains = Yii::$app->params['domains']; foreach ($book_info as $_book) { $tmp_title = $_book['subtitle']; $data[] = ['idx' => $idx, 'id' => $_book['id'], 'title' => DataHelper::encode($tmp_title), 'read_status' => $_book['read_status'], 'read_status_info' => Constant::$read_desc[$_book['read_status']], 'read_start_time' => date("Y-m-d", strtotime($_book['read_start_time'])), 'read_end_time' => date("Y-m-d", strtotime($_book['read_end_time'])), 'status' => $_book['status'], 'status_info' => Constant::$status_desc[$_book['status']], 'created' => $_book['created_time'], 'edit_url' => AdminUrlService::buildUrl("/library/info", ["id" => $_book['id']]), 'view_url' => $domains['blog'] . Url::toRoute("/library/detail/{$_book['id']}")]; $idx++; } } return $this->render("index", ["data" => $data, "read_status" => Constant::$read_desc, "page_info" => $page_info, "page_url" => "/library/index"]); }
?> <?php foreach ($data as $_item) { ?> <tr> <td class="text-center"><?php echo $_item['idx']; ?> </td> <td><?php echo $_item['date']; ?> </td> <td> <a class="color-theme" target="_blank" href="<?php echo AdminUrlService::buildUrl("/log/access", ['source' => $_item['source']]); ?> "> <?php echo $_item['source']; ?> </a> </td> <td><?php echo $_item['total_number']; ?> </td> </tr> <?php } ?>
?> <?php foreach ($data as $_item) { ?> <tr> <td class="text-center"><?php echo $_item['idx']; ?> </td> <td><?php echo $_item['date']; ?> </td> <td> <a class="color-theme" target="_blank" href="<?php echo AdminUrlService::buildUrl("/log/access", ['uuid' => $_item['uuid']]); ?> "> <?php echo $_item['uuid']; ?> </a> </td> <td><?php echo $_item['total_number']; ?> </td> </tr> <?php } ?>
</form> </div> </div> <div class="row"> <div class="row-in"> <div class="columns-24"> <table class="table-1"> <thead> <tr> <th>编号</th> <th>标题</th> <th> <a class="color-theme" href="<?php echo AdminUrlService::buildUrl("/posts/index", ['order_by' => 'view_count', 'view_count' => $search_conditions['order_by'] && $search_conditions['view_count'] ? 0 : 1]); ?> ">阅读量</a> <?php if ($search_conditions['order_by'] && isset($search_conditions['view_count'])) { ?> <i class="fa <?php if ($search_conditions['order_by'] && $search_conditions['view_count']) { ?> fa-sort-desc<?php } else { ?> fa-sort-up<?php } ?> ">
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "图书列表", "url" => AdminUrlService::buildUrl("/library/index"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
use admin\components\StaticService; use admin\components\AdminUrlService; StaticService::includeAppJsStatic("/js/file/upload.js", \admin\assets\AdminAsset::className()); ?> <div class="row"> <div class="row-in"> <div class="columns-24"> <?php echo \Yii::$app->view->renderFile("@admin/views/common/file_tab.php", ['current' => 'upload']); ?> </div> </div> </div> <div class="row"> <form id="file_set" target="upload_file" enctype="multipart/form-data" action="<?php echo AdminUrlService::buildUrl("/upload/file"); ?> " method="post"> <div class="row-in"> <div class="columns-5 text-right"> <label class="label-name inline"><i class="mark">*</i>上传文件:</label> </div> <div class="columns-19"> <div class="input-wrap"> <input type="file" class="input-1" name="rich_media"/> </div> </div> <div class="columns-19 offset-5"> <button type="button" class="btn-small save">上传</button> </div> </div>
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "版本发布", "url" => AdminUrlService::buildUrl("/ops/index"), "status" => 1], "error" => ['title' => "错误日志", "url" => AdminUrlService::buildUrl("/ops/error"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "文章列表", "url" => AdminUrlService::buildUrl("/posts/index"), "status" => 1], "set" => ['title' => "写文章", "url" => AdminUrlService::buildUrl("/posts/set"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
<p class="t1"><label class="t2"><?php echo $this->params['current_user']["mobile"]; ?> </label></p> <p class="t3"><label class="t2"><?php echo $this->params['current_user']["nickname"]; ?> </p> <!-- <a href="javascript:void(0);" class="user_edit">编辑</a>--> </li> <li class="each border"> <a href="javascript:void(0);"><i class="icon_club"></i>修改密码</a> </li> <li class="each"> <a href="<?php echo AdminUrlService::buildUrl("/auth/loginout"); ?> "><i class="icon_club"></i>退出</a> </li> </ul> </div> </div> </div> </div> </div> <div class="content_wrap"> <?php echo $content; ?> </div> </div>
?> "><?php echo $page; ?> </a> </li> <?php } ?> <?php } ?> <?php if ($pages['next']) { ?> <li class="tail"> <a href="<?php echo $url ? AdminUrlService::buildUrl($url, array_merge($search_conditions, ['p' => $pages['totalPage']])) : 'javascript:void(0)'; ?> " data-page="<?php echo $pages['totalPage']; ?> ">尾页</a> </li> <?php } ?> </ul> </div>
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "豆瓣妹子列表", "url" => AdminUrlService::buildUrl("douban/mz"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
public function actionQueue() { $id = intval($this->get("id", 0)); $reback_url = AdminUrlService::buildUrl("/ops/index"); if (!$id) { return $this->redirect($reback_url); } $info = ReleaseQueue::find()->where(['id' => $id])->one(); if (!$info) { return $this->redirect($reback_url); } $release_status_mapping = $this->release_status_mapping; $cmds = []; $logs = @json_decode($info['content'], true); if ($logs) { foreach ($logs as $key => $cmd) { if ($key == "fail_reason") { continue; } $cmds[$key] = str_replace("\r\n", "<br/>", $cmd); } } $data = ['repo' => $info['repo'], 'status' => $info['status'], 'status_info' => $release_status_mapping[$info['status']]]; return $this->render("queue", ['info' => $data, 'cmds' => $cmds, 'fail_reason' => isset($logs['fail_reason']) ? $logs['fail_reason'] : '']); }
<td><?php echo $_item['created_time']; ?> </td> <td> <label style="border: 1px solid;border-radius: 10px;padding:0 15px; " class="<?php echo $_item['status']['class']; ?> "><?php echo $_item['status']['title']; ?> </label> </td> <td> <a href="<?php echo AdminUrlService::buildUrl("/ops/queue", ['id' => $_item['id']]); ?> " class="color-theme">详情</a> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="6">暂无任务队列</td> </tr> <?php }
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "多媒体列表", "url" => AdminUrlService::buildUrl("/richmedia/index"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
<?php use admin\components\AdminUrlService; $mapping = ["access" => ['title' => "访问日志", "url" => AdminUrlService::buildUrl("/log/access"), "status" => 1], "uuid" => ['title' => "UUID统计", "url" => AdminUrlService::buildUrl("/log/uuid"), "status" => 1], "source" => ['title' => "来源统计", "url" => AdminUrlService::buildUrl("/log/source"), "status" => 1], "os" => ['title' => "操作系统统计", "url" => AdminUrlService::buildUrl("/log/os"), "status" => 1], "browser" => ['title' => "浏览器统计", "url" => AdminUrlService::buildUrl("/log/browser"), "status" => 1], "csp" => ['title' => "CSP统计", "url" => AdminUrlService::buildUrl("/log/csp"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "文件列表", "url" => AdminUrlService::buildUrl("/file/index"), "status" => 1], "upload" => ['title' => "文件上传", "url" => AdminUrlService::buildUrl("/file/upload"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
public function actionTopSearch() { $data = []; $kw = trim($this->get("q", '')); $query = Posts::find(); $query->andWhere(['LIKE', 'title', '%' . strtr($kw, ['%' => '\\%', '_' => '\\_', '\\' => '\\\\']) . '%', false]); $list = $query->orderBy(['view_count' => SORT_DESC])->asArray()->limit(10)->all(); if ($list) { foreach ($list as $_item) { $data[] = ['id' => $_item['id'], 'title' => DataHelper::encode($_item['title']), 'url' => AdminUrlService::buildUrl("/posts/set", ['id' => $_item['id']])]; } } return $this->renderJSON($data); }
?> <?php foreach ($data as $_item) { ?> <tr> <td class="text-center"><?php echo $_item['idx']; ?> </td> <td><?php echo $_item['date']; ?> </td> <td> <a class="color-theme" target="_blank" href="<?php echo AdminUrlService::buildUrl("/log/access", ['client_browser' => $_item['client_browser']]); ?> "> <?php echo $_item['client_browser']; ?> </a> </td> <td><?php echo $_item['total_number']; ?> </td> </tr> <?php } ?>
if ($pidx == $page_info['current']) { ?> active <?php } ?> "> <a href="<?php echo AdminUrlService::buildUrl($url, array_merge($search_conditions, ['p' => $pidx])); ?> "><?php echo $pidx; ?> </a> </li> <?php } ?> <?php if ($page_info['next']) { ?> <li> <a class="paginate_button next" href="<?php echo AdminUrlService::buildUrl($url, array_merge($search_conditions, ['p' => $page_info['total_page']])); ?> ">»</a> </li> <?php } ?> </ul> </div>
<?php use admin\components\AdminUrlService; $mapping = ["index" => ['title' => "账号列表", "url" => AdminUrlService::buildUrl("/account/index"), "status" => 1], "set" => ['title' => "设置账号", "url" => AdminUrlService::buildUrl("/account/set"), "status" => 1]]; ?> <ul class="tab_title style_1"> <?php foreach ($mapping as $_key => $_item) { ?> <?php if (isset($_item['status']) && !$_item['status']) { continue; } ?> <li <?php if ($current == $_key) { ?> class="current" <?php } ?> > <a href="<?php echo $_item['url']; ?> "><?php echo $_item["title"]; ?> </a> </li> <?php
</td> <td><?php echo $_item['account']; ?> </td> <td><?php echo $_item['pwd']; ?> </td> <td><?php echo $_item['description']; ?> </td> <td> <a href="<?php echo AdminUrlService::buildUrl("/account/set", ['account_id' => $_item['id']]); ?> " class="edit"> <i class="icon_club"></i> </a> </td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="6">暂无</td></tr> <?php }