mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
增加静态文件版本号
This commit is contained in:
parent
7e9dc9d2db
commit
24f25c8867
@ -58,7 +58,7 @@
|
||||
|
||||
{{ partial('partials/cover_uploader') }}
|
||||
|
||||
{{ javascript_include('lib/xm-select.js') }}
|
||||
{{ js_include('lib/xm-select.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
</form>
|
||||
|
||||
{{ javascript_include('admin/js/xm-course.js') }}
|
||||
{{ js_include('admin/js/xm-course.js') }}
|
||||
|
||||
<script>
|
||||
xmCourse({{ xm_courses|json_encode }}, '/admin/xm/course/all');
|
||||
|
@ -70,7 +70,7 @@
|
||||
|
||||
</form>
|
||||
|
||||
{{ javascript_include('lib/xm-select.js') }}
|
||||
{{ js_include('lib/xm-select.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
<meta name="csrf-token-key" content="{{ security.getTokenKey() }}">
|
||||
<meta name="csrf-token-value" content="{{ security.getTokenValue() }}">
|
||||
<title>管理后台</title>
|
||||
{{ stylesheet_link('lib/layui/css/layui.css') }}
|
||||
{{ stylesheet_link('lib/layui/extends/dropdown.css') }}
|
||||
{{ stylesheet_link('admin/css/style.css') }}
|
||||
{{ javascript_include('lib/layui/layui.js') }}
|
||||
{{ javascript_include('admin/js/common.js') }}
|
||||
{{ css_link('lib/layui/css/layui.css') }}
|
||||
{{ css_link('lib/layui/extends/dropdown.css') }}
|
||||
{{ css_link('admin/css/style.css') }}
|
||||
{{ js_include('lib/layui/layui.js') }}
|
||||
{{ js_include('admin/js/common.js') }}
|
||||
</head>
|
||||
<body class="kg-body">
|
||||
{{ content() }}
|
||||
|
@ -5,10 +5,10 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>管理后台</title>
|
||||
{{ stylesheet_link('lib/layui/css/layui.css') }}
|
||||
{{ stylesheet_link('admin/css/style.css') }}
|
||||
{{ javascript_include('lib/layui/layui.js') }}
|
||||
{{ javascript_include('admin/js/index.js') }}
|
||||
{{ css_link('lib/layui/css/layui.css') }}
|
||||
{{ css_link('admin/css/style.css') }}
|
||||
{{ js_include('lib/layui/layui.js') }}
|
||||
{{ js_include('admin/js/index.js') }}
|
||||
</head>
|
||||
|
||||
<body class="layui-layout-body">
|
||||
|
@ -61,8 +61,8 @@
|
||||
|
||||
</form>
|
||||
|
||||
{{ javascript_include('lib/xm-select.js') }}
|
||||
{{ javascript_include('admin/js/xm-course.js') }}
|
||||
{{ js_include('lib/xm-select.js') }}
|
||||
{{ js_include('admin/js/xm-course.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{ javascript_include('lib/vod-js-sdk-v6.min.js') }}
|
||||
{{ js_include('lib/vod-js-sdk-v6.min.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{{ javascript_include('lib/jquery.min.js') }}
|
||||
{{ js_include('lib/jquery.min.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
|
||||
</form>
|
||||
|
||||
{{ javascript_include('lib/xm-select.js') }}
|
||||
{{ javascript_include('admin/js/xm-course.js') }}
|
||||
{{ js_include('lib/xm-select.js') }}
|
||||
{{ js_include('admin/js/xm-course.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>Phalcon</title>
|
||||
{{ stylesheet_link("lib/layui/css/layui.css") }}
|
||||
{{ javascript_include("lib/layui/layui.js") }}
|
||||
{{ css_link("lib/layui/css/layui.css") }}
|
||||
{{ js_include("lib/layui/layui.js") }}
|
||||
</head>
|
||||
|
||||
<body class="layui-layout-body">
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
{{ javascript_include('library/chplayer/chplayer.min.js') }}
|
||||
{{ js_include('library/chplayer/chplayer.min.js') }}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use App\Services\Storage as StorageService;
|
||||
use Koogua\Ip2Region\Searcher as Ip2RegionSearcher;
|
||||
use Phalcon\Di;
|
||||
|
||||
/**
|
||||
* 获取字符长度
|
||||
@ -273,3 +274,51 @@ function kg_can($route = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造css路径
|
||||
*
|
||||
* @param $path
|
||||
* @param bool $local
|
||||
* @param string $version
|
||||
* @return string
|
||||
*/
|
||||
function kg_css_link($path, $local = true, $version = null)
|
||||
{
|
||||
$config = Di::getDefault()->getShared('config');
|
||||
|
||||
$baseUri = rtrim($config->static_base_uri, '/');
|
||||
$path = ltrim($path, '/');
|
||||
$href = $local ? $baseUri . '/' . $path : $path;
|
||||
$version = $version ? $version : $config->static_version;
|
||||
|
||||
if ($version) {
|
||||
$href .= '?v=' . $version;
|
||||
}
|
||||
|
||||
return '<link rel="stylesheet" type="text/css" href="' . $href . '" />' . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造js引入
|
||||
*
|
||||
* @param $path
|
||||
* @param bool $local
|
||||
* @param string $version
|
||||
* @return string
|
||||
*/
|
||||
function kg_js_include($path, $local = true, $version = null)
|
||||
{
|
||||
$config = Di::getDefault()->getShared('config');
|
||||
|
||||
$baseUri = rtrim($config->static_base_uri, '/');
|
||||
$path = ltrim($path, '/');
|
||||
$src = $local ? $baseUri . '/' . $path : $path;
|
||||
$version = $version ? $version : $config->static_version;
|
||||
|
||||
if ($version) {
|
||||
$src .= '?v=' . $version;
|
||||
}
|
||||
|
||||
return '<script type="text/javascript" src="' . $src . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ class Cache extends Provider
|
||||
'port' => $config->redis->port,
|
||||
'auth' => $config->redis->auth,
|
||||
'index' => $config->redis->index,
|
||||
'prefix' => $config->redis->prefix,
|
||||
'persistent' => $config->redis->persistent,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
@ -20,9 +20,7 @@ class Session extends Provider
|
||||
'port' => $config->redis->port,
|
||||
'auth' => $config->redis->auth,
|
||||
'index' => $config->redis->index,
|
||||
'prefix' => $config->session->prefix,
|
||||
'lifetime' => $config->session->lifetime,
|
||||
'persistent' => $config->redis->persistent,
|
||||
]);
|
||||
|
||||
$session->start();
|
||||
|
@ -17,9 +17,9 @@ class Url extends Provider
|
||||
|
||||
$url = new UrlResolver();
|
||||
|
||||
$url->setBaseUri($config->url->base);
|
||||
$url->setBaseUri($config->base_uri);
|
||||
|
||||
$url->setStaticBaseUri($config->url->static);
|
||||
$url->setStaticBaseUri($config->static_base_uri);
|
||||
|
||||
return $url;
|
||||
});
|
||||
|
@ -22,6 +22,14 @@ class Volt extends Provider
|
||||
|
||||
$compiler = $volt->getCompiler();
|
||||
|
||||
$compiler->addFunction('css_link', function ($resolvedArgs) {
|
||||
return 'kg_css_link(' . $resolvedArgs . ')';
|
||||
});
|
||||
|
||||
$compiler->addFunction('js_include', function ($resolvedArgs) {
|
||||
return 'kg_js_include(' . $resolvedArgs . ')';
|
||||
});
|
||||
|
||||
$compiler->addFunction('substr', function ($resolvedArgs) {
|
||||
return 'kg_substr(' . $resolvedArgs . ')';
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ class Admin extends AuthService
|
||||
|
||||
$role = $roleRepo->findById($user->admin_role);
|
||||
|
||||
$root = $role->id == RoleModel::ROLE_ROOT ? 1 : 0;
|
||||
$root = $role->id == RoleModel::ROLE_ROOT;
|
||||
|
||||
$authInfo = [
|
||||
'id' => $user->id,
|
||||
@ -44,9 +44,9 @@ class Admin extends AuthService
|
||||
|
||||
$authInfo = $this->session->get($authKey);
|
||||
|
||||
$items = $authInfo ? $authInfo : [];
|
||||
if (!$authInfo) return null;
|
||||
|
||||
return new Collection($items);
|
||||
return new Collection($authInfo);
|
||||
}
|
||||
|
||||
public function getAuthKey()
|
||||
|
@ -63,9 +63,17 @@ class Api extends AuthService
|
||||
|
||||
$authInfo = $cache->get($key);
|
||||
|
||||
$items = $authInfo ? $authInfo : [];
|
||||
if (!$authInfo) return null;
|
||||
|
||||
return new Collection($items);
|
||||
return new Collection($authInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedisCache
|
||||
*/
|
||||
protected function getCache()
|
||||
{
|
||||
return $this->getDI()->get('cache');
|
||||
}
|
||||
|
||||
protected function getAuthToken()
|
||||
@ -78,12 +86,4 @@ class Api extends AuthService
|
||||
return "access_token:{$token}";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedisCache
|
||||
*/
|
||||
protected function getCache()
|
||||
{
|
||||
return $this->getDI()->get('cache');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,9 +34,9 @@ class Html5 extends AuthService
|
||||
|
||||
$authInfo = $this->session->get($authKey);
|
||||
|
||||
$items = $authInfo ? $authInfo : [];
|
||||
if (!$authInfo) return null;
|
||||
|
||||
return new Collection($items);
|
||||
return new Collection($authInfo);
|
||||
}
|
||||
|
||||
public function getAuthKey()
|
||||
|
@ -9,11 +9,6 @@ use Yansongda\Supports\Collection;
|
||||
class Web extends AuthService
|
||||
{
|
||||
|
||||
/**
|
||||
* 写入会话
|
||||
*
|
||||
* @param UserModel $user
|
||||
*/
|
||||
public function saveAuthInfo(UserModel $user)
|
||||
{
|
||||
$authKey = $this->getAuthKey();
|
||||
@ -26,9 +21,6 @@ class Web extends AuthService
|
||||
$this->session->set($authKey, $authInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除会话
|
||||
*/
|
||||
public function clearAuthInfo()
|
||||
{
|
||||
$authKey = $this->getAuthKey();
|
||||
@ -36,27 +28,17 @@ class Web extends AuthService
|
||||
$this->session->remove($authKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取会话
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAuthInfo()
|
||||
{
|
||||
$authKey = $this->getAuthKey();
|
||||
|
||||
$authInfo = $this->session->get($authKey);
|
||||
|
||||
$items = $authInfo ? $authInfo : [];
|
||||
if (!$authInfo) return null;
|
||||
|
||||
return new Collection($items);
|
||||
return new Collection($authInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话键值
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthKey()
|
||||
{
|
||||
return 'web_auth_info';
|
||||
|
@ -32,8 +32,6 @@ class Service extends Component
|
||||
|
||||
$validator->checkAuthUser($authUser);
|
||||
|
||||
dd($authUser);
|
||||
|
||||
$userRepo = new UserRepo();
|
||||
|
||||
return $userRepo->findById($authUser['id']);
|
||||
|
@ -9,13 +9,11 @@ use Phalcon\Mvc\User\Component;
|
||||
class Validator extends Component
|
||||
{
|
||||
|
||||
public function checkAuthUser($user)
|
||||
public function checkAuthUser($authUser)
|
||||
{
|
||||
if (empty($user['id'])) {
|
||||
throw new UnauthorizedException('sys.auth_user_failed');
|
||||
if (empty($authUser['id'])) {
|
||||
throw new UnauthorizedException('sys.auth_failed');
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function checkOwner($userId, $ownerId)
|
||||
|
@ -20,12 +20,17 @@ $config['timezone'] = 'Asia/Shanghai';
|
||||
/**
|
||||
* 网站根地址,必须以"/"结尾
|
||||
*/
|
||||
$config['url']['base'] = '/';
|
||||
$config['base_uri'] = '/';
|
||||
|
||||
/**
|
||||
* 静态资源地址,必须以"/"结尾
|
||||
* 静态资源根地址,必须以"/"结尾
|
||||
*/
|
||||
$config['url']['static'] = '/static/';
|
||||
$config['static_base_uri'] = '/static/';
|
||||
|
||||
/**
|
||||
* 静态资源版本
|
||||
*/
|
||||
$config['static_version'] = '202004080830';
|
||||
|
||||
/**
|
||||
* 数据库主机名
|
||||
@ -78,24 +83,9 @@ $config['redis']['auth'] = '1qaz2wsx3edc';
|
||||
$config['redis']['index'] = 0;
|
||||
|
||||
/**
|
||||
* redis长链接
|
||||
* 缓存有效期(秒)
|
||||
*/
|
||||
$config['redis']['persistent'] = false;
|
||||
|
||||
/**
|
||||
* redis键前缀
|
||||
*/
|
||||
$config['redis']['prefix'] = '';
|
||||
|
||||
/**
|
||||
* redis有限期(秒)
|
||||
*/
|
||||
$config['redis']['lifetime'] = 7 * 86400;
|
||||
|
||||
/**
|
||||
* 会话键前缀
|
||||
*/
|
||||
$config['session']['prefix'] = ':session:';
|
||||
$config['redis']['lifetime'] = 24 * 3600;
|
||||
|
||||
/**
|
||||
* 会话有效期(秒)
|
@ -6,9 +6,9 @@ $error = [];
|
||||
* 通用相关
|
||||
*/
|
||||
$error['sys.uri_not_found'] = '资源地址不存在';
|
||||
$error['sys.invalid_referer'] = '无效的请求来源';
|
||||
$error['sys.auth_user_failed'] = '用户认证失败';
|
||||
$error['sys.access_denied'] = '访问被拒绝';
|
||||
$error['sys.invalid_referer'] = '非法的请求来源';
|
||||
$error['sys.auth_failed'] = '认证失败';
|
||||
$error['sys.access_denied'] = '拒绝访问';
|
||||
$error['sys.unknown_error'] = '未知错误';
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user