fix(commission): 修复分销商身份等级访问异常并健全部署缓存权限保障

这个提交包含在:
wikiboss
2026-09-17 16:37:28 +08:00
父节点 a94b05178e
当前提交 f5b804fb57
共有 4 个文件被更改,包括 143 次插入 和 70 次删除

查看文件

@@ -9,35 +9,14 @@ use think\Db;
class Level extends Common
{
protected $noNeedLogin = ['index', 'select'];
protected $noNeedRight = ['index', 'select'];
protected $model = null;
public function _initialize()
{
try {
if (input('test_admin')) {
$admin = \app\admin\model\Admin::get(1);
if ($admin) {
\think\Session::set('admin', $admin->toArray());
}
}
parent::_initialize();
$this->model = new LevelModel();
} catch (\think\exception\HttpResponseException $e) {
throw $e;
} catch (\Throwable $e) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode([
'code' => 500,
'msg' => 'INIT_ERROR: ' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => explode("\n", $e->getTraceAsString())
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit;
}
parent::_initialize();
$this->model = new LevelModel();
}
/**
@@ -45,49 +24,25 @@ class Level extends Common
*/
public function index()
{
if (input('read_err_log')) {
$rules = Db::name('auth_rule')->where('name', 'like', '%commission/level%')->select();
$admins = Db::name('admin')->field('id,username,nickname,status')->select();
echo json_encode([
'rules' => $rules,
'admins' => $admins,
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit;
if (!$this->request->isAjax()) {
return $this->view->fetch();
}
try {
if (!$this->request->isAjax()) {
return $this->view->fetch();
}
$defaultLevel = $this->model->find(1);
if (!$defaultLevel) {
$this->model->save([
'name' => '默认等级',
'level' => 1,
'commission_rules' => [
'commission_1' => '0.00',
'commission_2' => '0.00',
'commission_3' => '0.00'
]
]);
}
$list = $this->model->sheepFilter()->select();
$this->success('全部等级', null, $list);
} catch (\think\exception\HttpResponseException $e) {
throw $e;
} catch (\Throwable $e) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode([
'code' => 500,
'msg' => 'INDEX_ERROR: ' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => explode("\n", $e->getTraceAsString())
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit;
$defaultLevel = $this->model->find(1);
if (!$defaultLevel) {
$this->model->save([
'name' => '默认等级',
'level' => 1,
'commission_rules' => [
'commission_1' => '0.00',
'commission_2' => '0.00',
'commission_3' => '0.00'
]
]);
}
$list = $this->model->sheepFilter()->select();
$this->success('全部等级', null, $list);
}
/**

查看文件

@@ -83,13 +83,6 @@ $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));
</div>
<div class="subheader">
<?=$debug?$message:$lang['The page you are looking for is temporarily unavailable']?>
<?php if (isset($exception) && $exception instanceof \Throwable): ?>
<div style="font-size:13px;color:#c0392b;text-align:left;margin-top:15px;background:#f9f9f9;padding:10px;border-radius:4px;word-break:break-all;">
<strong>Exception:</strong> <?=htmlspecialchars($exception->getMessage())?><br>
<strong>File:</strong> <?=htmlspecialchars($exception->getFile())?>:<?=$exception->getLine()?><br>
<pre style="font-size:11px;max-height:150px;overflow:auto;margin-top:5px;"><?=htmlspecialchars($exception->getTraceAsString())?></pre>
</div>
<?php endif; ?>
</div>
<div class="hr"></div>
<div class="context">