fix(commission): 修复分销商身份等级访问异常并健全部署缓存权限保障
这个提交包含在:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户