feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能
- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
这个提交包含在:
@@ -47,4 +47,54 @@ class SkillCategory extends Backend
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑分类(当分类名称变更时同步更新技能字典冗余分类名)
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$oldName = (string)$row['name'];
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a', []);
|
||||
if (!$params) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = $row->allowField(true)->save($params);
|
||||
if ($result !== false) {
|
||||
$newName = isset($params['name']) ? trim((string)$params['name']) : $oldName;
|
||||
if ($newName !== '' && $newName !== $oldName) {
|
||||
\think\Db::name('skill_dict')->where('category_id', (int)$row['id'])->update(['category' => $newName]);
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
$this->error($row->getError() ?: __('No rows were updated'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除保护:分类下仍有关联技能时禁止物理删除
|
||||
*/
|
||||
public function del($ids = null)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
$ids = $ids ?: $this->request->post('ids');
|
||||
$idArr = array_values(array_filter(array_map('intval', explode(',', (string)$ids))));
|
||||
if (!$idArr) {
|
||||
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
$cnt = (int)\think\Db::name('skill_dict')->where('category_id', 'in', $idArr)->count();
|
||||
if ($cnt > 0) {
|
||||
$this->error('所选分类下仍包含 ' . $cnt . ' 项技能标签,请先迁移或删除下属技能后再操作');
|
||||
}
|
||||
return parent::del($ids);
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户