代理修复

This commit is contained in:
Anyon 2020-07-15 10:08:46 +08:00
parent 85ad0106e9
commit da513662f8
16 changed files with 72 additions and 32 deletions

View File

@ -81,7 +81,10 @@ class Auth extends Controller
public function state()
{
$this->_applyFormToken();
$this->_save($this->table, ['status' => input('status')]);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**
@ -99,8 +102,8 @@ class Auth extends Controller
$checkeds = $this->app->db->name('SystemAuthNode')->where($map)->column('node');
$this->success('获取权限节点成功!', AdminService::instance()->clearCache()->getTree($checkeds));
} elseif (input('action') === 'save') {
list($post, $data) = [$this->request->post(), []];
foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
[$post, $data] = [$this->request->post(), []];
foreach ($post['nodes'] ?? [] as $node) {
$data[] = ['auth' => $map['auth'], 'node' => $node];
}
$this->app->db->name('SystemAuthNode')->where($map)->delete();

View File

@ -122,7 +122,10 @@ class Menu extends Controller
public function state()
{
$this->_applyFormToken();
$this->_save($this->table, ['status' => intval(input('status'))]);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**

View File

@ -45,6 +45,7 @@ class Queue extends Controller
*/
public function index()
{
// 检查进程状态
if (AdminService::instance()->isSuper()) try {
$this->process = ProcessService::instance();
if ($this->process->iswin() || empty($_SERVER['USER'])) {
@ -110,8 +111,6 @@ class Queue extends Controller
public function start()
{
try {
// Asynchronous daemons already exist for pid 1680
// Asynchronous daemons started successfully for pid 15740
$message = nl2br($this->app->console->call('xadmin:queue', ['start'])->fetch());
if (stripos($message, 'daemons started successfully for pid')) {
$this->success('任务监听主进程启动成功!');

View File

@ -47,9 +47,9 @@ class User extends Controller
// 加载对应数据列表
$this->type = input('type', 'all');
if ($this->type === 'all') {
$query->where(['is_deleted' => '0', 'status' => '1']);
$query->where(['is_deleted' => 0, 'status' => 1]);
} elseif ($this->type = 'recycle') {
$query->where(['is_deleted' => '0', 'status' => '0']);
$query->where(['is_deleted' => 0, 'status' => 0]);
}
// 列表排序并显示
$query->order('sort desc,id desc')->page();
@ -99,7 +99,7 @@ class User extends Controller
'id.require' => '用户ID不能为空',
'password.require' => '登录密码不能为空!',
'repassword.require' => '重复密码不能为空!',
'repassword.confirm:password' => '两次输入的密码不一致!'
'repassword.confirm:password' => '两次输入的密码不一致!',
]);
if (data_save($this->table, ['id' => $data['id'], 'password' => md5($data['password'])], 'id')) {
$this->success('密码修改成功,请使用新密码登录!', '');
@ -135,7 +135,7 @@ class User extends Controller
$data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : '';
} else {
$data['authorize'] = explode(',', $data['authorize'] ?? '');
$this->authorizes = $this->app->db->name('SystemAuth')->where(['status' => '1'])->order('sort desc,id desc')->select()->toArray();
$this->authorizes = $this->app->db->name('SystemAuth')->where(['status' => 1])->order('sort desc,id desc')->select()->toArray();
}
}
@ -146,11 +146,12 @@ class User extends Controller
*/
public function state()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止操作!');
}
$this->_checkInput();
$this->_applyFormToken();
$this->_save($this->table, ['status' => intval(input('status'))]);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**
@ -160,11 +161,19 @@ class User extends Controller
*/
public function remove()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止删除!');
}
$this->_checkInput();
$this->_applyFormToken();
$this->_delete($this->table);
}
/**
* 检查输入变量
*/
private function _checkInput()
{
if (in_array('10000', explode(',', input('id', '')))) {
$this->error('系统超级账号禁止删除!');
}
}
}

View File

@ -124,7 +124,10 @@ class ArticleContent extends Controller
*/
public function state()
{
$this->_save($this->table);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**

View File

@ -64,7 +64,10 @@ class ArticleTags extends Controller
*/
public function state()
{
$this->_save($this->table);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**

View File

@ -67,7 +67,6 @@ class Fans extends Command
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\Exception
* @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
@ -101,10 +100,7 @@ class Fans extends Command
* @return string
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function _black($next = '', $done = 0)
{
@ -134,7 +130,6 @@ class Fans extends Command
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\Exception
* @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException

View File

@ -108,8 +108,8 @@ class Fans extends Controller
$this->success('移出黑名单成功!');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error("移出黑名单失败,请稍候再试!<br>{$e->getMessage()}");
} catch (\Exception $exception) {
$this->error("移出黑名单失败,请稍候再试!<br>{$exception->getMessage()}");
}
}

View File

@ -115,7 +115,10 @@ class Keys extends Controller
public function state()
{
$this->_applyFormToken();
$this->_save($this->table, ['status' => input('status')]);
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**

View File

@ -130,7 +130,7 @@ class News extends Controller
}
} else {
$ids = $this->_buildArticle($this->request->post('data', []));
list($map, $data) = [['id' => $this->id], ['article_id' => $ids]];
[$map, $data] = [['id' => $this->id], ['article_id' => $ids]];
if ($this->app->db->name($this->table)->where($map)->update($data) !== false) {
$this->success('图文更新成功!', 'javascript:history.back()');
} else {

View File

@ -50,7 +50,7 @@ class Review extends Controller
{
$where = ['id' => empty($id) ? input('id') : $id];
$this->app->db->name('WechatNewsArticle')->where($where)->update([
'read_num' => $this->app->db->raw('read_num+1')
'read_num' => $this->app->db->raw('read_num+1'),
]);
$this->info = $this->app->db->name('WechatNewsArticle')->where($where)->find();
$this->fetch();

View File

@ -18,4 +18,4 @@ if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
} else {
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
require __DIR__ . "/index.php";
}
}

2
think
View File

@ -4,7 +4,7 @@
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------

View File

@ -201,6 +201,17 @@ return array(
'app\\admin\\controller\\api\\Queue' => $baseDir . '/app/admin/controller/api/Queue.php',
'app\\admin\\controller\\api\\Update' => $baseDir . '/app/admin/controller/api/Update.php',
'app\\admin\\controller\\api\\Upload' => $baseDir . '/app/admin/controller/api/Upload.php',
'app\\data\\controller\\ArticleContent' => $baseDir . '/app/data/controller/ArticleContent.php',
'app\\data\\controller\\ArticleTags' => $baseDir . '/app/data/controller/ArticleTags.php',
'app\\data\\controller\\Config' => $baseDir . '/app/data/controller/Config.php',
'app\\data\\controller\\api\\Article' => $baseDir . '/app/data/controller/api/Article.php',
'app\\data\\controller\\api\\Data' => $baseDir . '/app/data/controller/api/Data.php',
'app\\data\\controller\\api\\Login' => $baseDir . '/app/data/controller/api/Login.php',
'app\\data\\controller\\api\\Member' => $baseDir . '/app/data/controller/api/Member.php',
'app\\data\\controller\\api\\member\\Article' => $baseDir . '/app/data/controller/api/member/Article.php',
'app\\data\\controller\\api\\member\\Center' => $baseDir . '/app/data/controller/api/member/Center.php',
'app\\data\\service\\ArticleService' => $baseDir . '/app/data/service/ArticleService.php',
'app\\data\\service\\MemberService' => $baseDir . '/app/data/service/MemberService.php',
'app\\index\\controller\\Index' => $baseDir . '/app/index/controller/Index.php',
'app\\wechat\\command\\Fans' => $baseDir . '/app/wechat/command/Fans.php',
'app\\wechat\\controller\\Config' => $baseDir . '/app/wechat/controller/Config.php',

View File

@ -334,6 +334,17 @@ class ComposerStaticInitb911c14a0826c73d9f097343fd33a252
'app\\admin\\controller\\api\\Queue' => __DIR__ . '/../..' . '/app/admin/controller/api/Queue.php',
'app\\admin\\controller\\api\\Update' => __DIR__ . '/../..' . '/app/admin/controller/api/Update.php',
'app\\admin\\controller\\api\\Upload' => __DIR__ . '/../..' . '/app/admin/controller/api/Upload.php',
'app\\data\\controller\\ArticleContent' => __DIR__ . '/../..' . '/app/data/controller/ArticleContent.php',
'app\\data\\controller\\ArticleTags' => __DIR__ . '/../..' . '/app/data/controller/ArticleTags.php',
'app\\data\\controller\\Config' => __DIR__ . '/../..' . '/app/data/controller/Config.php',
'app\\data\\controller\\api\\Article' => __DIR__ . '/../..' . '/app/data/controller/api/Article.php',
'app\\data\\controller\\api\\Data' => __DIR__ . '/../..' . '/app/data/controller/api/Data.php',
'app\\data\\controller\\api\\Login' => __DIR__ . '/../..' . '/app/data/controller/api/Login.php',
'app\\data\\controller\\api\\Member' => __DIR__ . '/../..' . '/app/data/controller/api/Member.php',
'app\\data\\controller\\api\\member\\Article' => __DIR__ . '/../..' . '/app/data/controller/api/member/Article.php',
'app\\data\\controller\\api\\member\\Center' => __DIR__ . '/../..' . '/app/data/controller/api/member/Center.php',
'app\\data\\service\\ArticleService' => __DIR__ . '/../..' . '/app/data/service/ArticleService.php',
'app\\data\\service\\MemberService' => __DIR__ . '/../..' . '/app/data/service/MemberService.php',
'app\\index\\controller\\Index' => __DIR__ . '/../..' . '/app/index/controller/Index.php',
'app\\wechat\\command\\Fans' => __DIR__ . '/../..' . '/app/wechat/command/Fans.php',
'app\\wechat\\controller\\Config' => __DIR__ . '/../..' . '/app/wechat/controller/Config.php',

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2020-07-13 09:44:52
// This file is automatically generated at:2020-07-15 09:47:12
declare (strict_types = 1);
return array (
0 => 'think\\app\\Service',