mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate 增加多语言支持
This commit is contained in:
parent
4a6040edb9
commit
19c01d7ab8
18
composer.lock
generated
18
composer.lock
generated
@ -74,16 +74,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem",
|
"name": "league/flysystem",
|
||||||
"version": "1.0.61",
|
"version": "1.0.62",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/flysystem.git",
|
"url": "https://github.com/thephpleague/flysystem.git",
|
||||||
"reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9"
|
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9",
|
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0",
|
||||||
"reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9",
|
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@
|
|||||||
"sftp",
|
"sftp",
|
||||||
"storage"
|
"storage"
|
||||||
],
|
],
|
||||||
"time": "2019-12-08T21:46:50+00:00"
|
"time": "2019-12-29T14:46:55+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem-cached-adapter",
|
"name": "league/flysystem-cached-adapter",
|
||||||
@ -909,12 +909,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||||
"reference": "f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80"
|
"reference": "250e1994a747d37fb3c3be3804dac69f26694c6b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/250e1994a747d37fb3c3be3804dac69f26694c6b",
|
||||||
"reference": "f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80",
|
"reference": "250e1994a747d37fb3c3be3804dac69f26694c6b",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -958,7 +958,7 @@
|
|||||||
],
|
],
|
||||||
"description": "ThinkPHP v6.0 Development Library",
|
"description": "ThinkPHP v6.0 Development Library",
|
||||||
"homepage": "http://framework.thinkadmin.top",
|
"homepage": "http://framework.thinkadmin.top",
|
||||||
"time": "2019-12-27T01:48:44+00:00"
|
"time": "2019-12-30T03:58:19+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "zoujingli/wechat-developer",
|
"name": "zoujingli/wechat-developer",
|
||||||
|
20
vendor/composer/installed.json
vendored
20
vendor/composer/installed.json
vendored
@ -69,17 +69,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/flysystem",
|
"name": "league/flysystem",
|
||||||
"version": "1.0.61",
|
"version": "1.0.62",
|
||||||
"version_normalized": "1.0.61.0",
|
"version_normalized": "1.0.62.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/flysystem.git",
|
"url": "https://github.com/thephpleague/flysystem.git",
|
||||||
"reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9"
|
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9",
|
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0",
|
||||||
"reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9",
|
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@
|
|||||||
"spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
|
"spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
|
||||||
"srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
|
"srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
|
||||||
},
|
},
|
||||||
"time": "2019-12-08T21:46:50+00:00",
|
"time": "2019-12-29T14:46:55+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
@ -935,12 +935,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||||
"reference": "f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80"
|
"reference": "250e1994a747d37fb3c3be3804dac69f26694c6b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/250e1994a747d37fb3c3be3804dac69f26694c6b",
|
||||||
"reference": "f231c9bb248fa6c1bd0f5e7c569f350e98c7ac80",
|
"reference": "250e1994a747d37fb3c3be3804dac69f26694c6b",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -956,7 +956,7 @@
|
|||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"topthink/framework": "^6.0"
|
"topthink/framework": "^6.0"
|
||||||
},
|
},
|
||||||
"time": "2019-12-27T01:48:44+00:00",
|
"time": "2019-12-30T03:58:19+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"think": {
|
"think": {
|
||||||
|
16
vendor/league/flysystem/SECURITY.md
vendored
Normal file
16
vendor/league/flysystem/SECURITY.md
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 1.0.x | :white_check_mark: |
|
||||||
|
| 2.0.x | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
When you've encountered a security vulnerability, please disclose it securely.
|
||||||
|
|
||||||
|
The security process is described at:
|
||||||
|
[https://flysystem.thephpleague.com/docs/security/](https://flysystem.thephpleague.com/docs/security/)
|
||||||
|
|
1
vendor/league/flysystem/composer.json
vendored
1
vendor/league/flysystem/composer.json
vendored
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "league/flysystem",
|
"name": "league/flysystem",
|
||||||
|
"type": "library",
|
||||||
"description": "Filesystem abstraction: Many filesystems, one API.",
|
"description": "Filesystem abstraction: Many filesystems, one API.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"filesystem", "filesystems", "files", "storage", "dropbox", "aws",
|
"filesystem", "filesystems", "files", "storage", "dropbox", "aws",
|
||||||
|
6
vendor/league/flysystem/src/Util.php
vendored
6
vendor/league/flysystem/src/Util.php
vendored
@ -267,12 +267,16 @@ class Util
|
|||||||
*
|
*
|
||||||
* @param resource $resource
|
* @param resource $resource
|
||||||
*
|
*
|
||||||
* @return int stream size
|
* @return int|null stream size
|
||||||
*/
|
*/
|
||||||
public static function getStreamSize($resource)
|
public static function getStreamSize($resource)
|
||||||
{
|
{
|
||||||
$stat = fstat($resource);
|
$stat = fstat($resource);
|
||||||
|
|
||||||
|
if ( ! is_array($stat) || ! isset($stat['size'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $stat['size'];
|
return $stat['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// This file is automatically generated at:2019-12-27 11:17:48
|
// This file is automatically generated at:2019-12-30 14:41:46
|
||||||
declare (strict_types = 1);
|
declare (strict_types = 1);
|
||||||
return array (
|
return array (
|
||||||
0 => 'think\\app\\Service',
|
0 => 'think\\app\\Service',
|
||||||
|
@ -60,7 +60,7 @@ abstract class Controller extends \stdClass
|
|||||||
* 表单CSRF验证失败提示
|
* 表单CSRF验证失败提示
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $csrf_message = '表单令牌验证失败,请刷新页面再试!';
|
public $csrf_message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller constructor.
|
* Controller constructor.
|
||||||
@ -82,6 +82,9 @@ abstract class Controller extends \stdClass
|
|||||||
*/
|
*/
|
||||||
protected function initialize()
|
protected function initialize()
|
||||||
{
|
{
|
||||||
|
if (empty($this->csrf_message)) {
|
||||||
|
$this->csrf_message = lang('think_library_csrf_error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,11 @@ class Library extends Service
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
|
// 读取中文语言
|
||||||
|
if ($this->app->lang->getLangSet() === 'zh-cn') {
|
||||||
|
$this->app->lang->load(__DIR__ . '/lang/zh-cn.php', 'zh-cn');
|
||||||
|
}
|
||||||
|
// 判断访问模式
|
||||||
if ($this->app->request->isCli()) {
|
if ($this->app->request->isCli()) {
|
||||||
if (empty($_SERVER['REQUEST_URI']) && isset($_SERVER['argv'][1])) {
|
if (empty($_SERVER['REQUEST_URI']) && isset($_SERVER['argv'][1])) {
|
||||||
$this->app->request->setPathinfo($_SERVER['argv'][1]);
|
$this->app->request->setPathinfo($_SERVER['argv'][1]);
|
||||||
@ -56,9 +61,9 @@ class Library extends Service
|
|||||||
} elseif (AdminService::instance()->check()) {
|
} elseif (AdminService::instance()->check()) {
|
||||||
return $next($request)->code(200)->header($header);
|
return $next($request)->code(200)->header($header);
|
||||||
} elseif (AdminService::instance()->isLogin()) {
|
} elseif (AdminService::instance()->isLogin()) {
|
||||||
return json(['code' => 0, 'msg' => '抱歉,没有访问该操作的权限!'])->header($header);
|
return json(['code' => 0, 'msg' => lang('think_library_not_auth')])->header($header);
|
||||||
} else {
|
} else {
|
||||||
return json(['code' => 0, 'msg' => '抱歉,需要登录获取访问权限!', 'url' => url('@admin/login')->build()])->header($header);
|
return json(['code' => 0, 'msg' => lang('think_library_not_login'), 'url' => url('@admin/login')->build()])->header($header);
|
||||||
}
|
}
|
||||||
}, 'route');
|
}, 'route');
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,9 @@ class DeleteHelper extends Helper
|
|||||||
}
|
}
|
||||||
// 回复前端结果
|
// 回复前端结果
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
$this->controller->success('数据删除成功!', '');
|
$this->controller->success(lang('think_library_delete_success'), '');
|
||||||
} else {
|
} else {
|
||||||
$this->controller->error('数据删除失败, 请稍候再试!');
|
$this->controller->error(lang('think_library_delete_error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,11 @@ class FormHelper extends Helper
|
|||||||
if (false !== $this->controller->callback('_form_filter', $data, $this->where)) {
|
if (false !== $this->controller->callback('_form_filter', $data, $this->where)) {
|
||||||
$result = data_save($this->query, $data, $this->field, $this->where);
|
$result = data_save($this->query, $data, $this->field, $this->where);
|
||||||
if (false !== $this->controller->callback('_form_result', $result, $data)) {
|
if (false !== $this->controller->callback('_form_result', $result, $data)) {
|
||||||
if ($result !== false) $this->controller->success('恭喜, 数据保存成功!', '');
|
if ($result !== false) {
|
||||||
$this->controller->error('数据保存失败, 请稍候再试!');
|
$this->controller->success(lang('think_library_form_success'));
|
||||||
|
} else {
|
||||||
|
$this->controller->error(lang('think_library_form_error'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -87,19 +87,21 @@ class PageHelper extends Helper
|
|||||||
[$options, $query] = ['', $this->app->request->get()];
|
[$options, $query] = ['', $this->app->request->get()];
|
||||||
$pager = $this->query->paginate(['list_rows' => $limit, 'query' => $query], $this->total);
|
$pager = $this->query->paginate(['list_rows' => $limit, 'query' => $query], $this->total);
|
||||||
foreach ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200] as $num) {
|
foreach ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200] as $num) {
|
||||||
[$query['limit'], $query['page'], $selected] = [$num, 1, $limit === $num ? 'selected' : ''];
|
[$query['limit'], $query['page'], $selects] = [$num, 1, $limit === $num ? 'selected' : ''];
|
||||||
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
||||||
$url = url('@admin') . '#' . $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
|
$url = url('@admin') . '#' . $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
|
||||||
} else {
|
} else {
|
||||||
$url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
|
$url = $this->app->request->baseUrl() . '?' . urldecode(http_build_query($query));
|
||||||
}
|
}
|
||||||
$options .= "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>";
|
$options .= "<option data-num='{$num}' value='{$url}' {$selects}>{$num}</option>";
|
||||||
}
|
}
|
||||||
$html = "<div class='pagination-container nowrap'><span>共 {$pager->total()} 条记录,每页显示 <select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>{$options}</select> 条,共 {$pager->lastPage()} 页当前显示第 {$pager->currentPage()} 页。</span>{$pager->render()}</div>";
|
$selects = "<select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>{$options}</select>";
|
||||||
|
$pagetext = lang('think_library_page_html', [$pager->total(), $selects, $pager->lastPage(), $pager->currentPage()]);
|
||||||
|
$pagehtml = "<div class='pagination-container nowrap'><span>{$pagetext}</span>{$pager->render()}</div>";
|
||||||
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
if (stripos($this->app->request->get('spm', '-'), 'm-') === 0) {
|
||||||
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $html));
|
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $pagehtml));
|
||||||
} else {
|
} else {
|
||||||
$this->controller->assign('pagehtml', $html);
|
$this->controller->assign('pagehtml', $pagehtml);
|
||||||
}
|
}
|
||||||
$result = ['page' => ['limit' => intval($limit), 'total' => intval($pager->total()), 'pages' => intval($pager->lastPage()), 'current' => intval($pager->currentPage())], 'list' => $pager->items()];
|
$result = ['page' => ['limit' => intval($limit), 'total' => intval($pager->total()), 'pages' => intval($pager->lastPage()), 'current' => intval($pager->currentPage())], 'list' => $pager->items()];
|
||||||
} else {
|
} else {
|
||||||
@ -126,11 +128,11 @@ class PageHelper extends Helper
|
|||||||
$map = [$pk => $this->app->request->post($pk, 0)];
|
$map = [$pk => $this->app->request->post($pk, 0)];
|
||||||
$data = ['sort' => intval($this->app->request->post('sort', 0))];
|
$data = ['sort' => intval($this->app->request->post('sort', 0))];
|
||||||
if ($this->app->db->table($this->query->getTable())->where($map)->update($data) !== false) {
|
if ($this->app->db->table($this->query->getTable())->where($map)->update($data) !== false) {
|
||||||
$this->controller->success('列表排序修改成功!', '');
|
$this->controller->success(lang('think_library_sort_success'), '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->controller->error('列表排序修改失败,请稍候再试!');
|
$this->controller->error($message ?? lang('think_library_sort_error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ class SaveHelper extends Helper
|
|||||||
}
|
}
|
||||||
// 回复前端结果
|
// 回复前端结果
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
$this->controller->success('数据更新成功!', '');
|
$this->controller->success(lang('think_library_save_success'), '');
|
||||||
} else {
|
} else {
|
||||||
$this->controller->error('数据更新失败, 请稍候再试!');
|
$this->controller->error(lang('think_library_save_error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
vendor/zoujingli/think-library/src/lang/zh-cn.php
vendored
Normal file
29
vendor/zoujingli/think-library/src/lang/zh-cn.php
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Library for ThinkAdmin
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 开源协议 ( https://mit-license.org )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary
|
||||||
|
// | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
'think_library_not_auth' => '抱歉,没有访问该操作的权限!',
|
||||||
|
'think_library_not_login' => '抱歉,需要登录获取访问权限!',
|
||||||
|
'think_library_delete_success' => '恭喜, 数据删除成功!',
|
||||||
|
'think_library_delete_error' => '抱歉,数据删除失败, 请稍候再试!',
|
||||||
|
'think_library_form_success' => '恭喜, 数据保存成功!',
|
||||||
|
'think_library_form_error' => '抱歉,数据保存失败, 请稍候再试!',
|
||||||
|
'think_library_save_success' => '恭喜,数据更新成功!',
|
||||||
|
'think_library_save_error' => '抱歉,数据更新失败, 请稍候再试!',
|
||||||
|
'think_library_sort_success' => '恭喜,列表排序修改成功!',
|
||||||
|
'think_library_sort_error' => '抱歉,列表排序修改失败,请稍候再试!',
|
||||||
|
'think_library_page_html' => '共 %s 条记录,每页显示 %s 条,共 %s 页当前显示第 %s 页。',
|
||||||
|
'think_library_csrf_error' => '表单令牌验证失败,请刷新页面再试!',
|
||||||
|
];
|
@ -41,7 +41,16 @@ class AdminService extends Service
|
|||||||
*/
|
*/
|
||||||
public function getUserId()
|
public function getUserId()
|
||||||
{
|
{
|
||||||
return $this->app->session->get('user.id') ?? 0;
|
return $this->app->session->get('user.id', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取后台用户名称
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUserName()
|
||||||
|
{
|
||||||
|
return $this->app->session->get('user.username', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user