feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能

- 新增 invoice_title、showcase、wallet_log 模型及对应语言包
- 新增后台控制器、视图及搜索字段配置
- 修复服务类目删除保护逻辑
- 优化后台登录页面文案及样式
- 新增前端角色切换逻辑及页面拦截
- 新增 SVG 图标及样式变量
- 修复接口权限及下拉框默认值问题
这个提交包含在:
2026-11-11 17:02:35 +08:00
父节点 5908cf6b16
当前提交 fafddceaf2
共有 332 个文件被更改,包括 33892 次插入 和 8835 次删除

查看文件

@@ -21,6 +21,7 @@ class Service extends Backend
*/
protected $model = null;
protected $relationSearch = true;
protected $searchFields = 'id,name,desc,cat.name';
public function _initialize()
{
@@ -211,6 +212,45 @@ class Service extends Backend
return $this->view->fetch();
}
/**
* 商品档案与服务定价全景详情
*/
public function detail($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$catName = Db::name('service_cat')->where('id', $row->cat_id)->value('name') ?: '未归类';
$serviceTypes = !empty($row->service_types)
? (is_array($row->service_types) ? $row->service_types : (json_decode($row->service_types, true) ?: []))
: [];
$addons = !empty($row->addons)
? (is_array($row->addons) ? $row->addons : (json_decode($row->addons, true) ?: []))
: [];
$specs = Db::name('service_spec')
->where('service_id', $row->id)
->where('status', 'normal')
->order('weigh desc, id asc')
->select();
$orderAgg = Db::name('order')
->field('COUNT(*) AS total_cnt, SUM(CASE WHEN pay_status = 1 THEN pay_amount ELSE 0 END) AS total_gmv')
->where('service_id', $row->id)
->find();
$this->view->assign([
'row' => $row,
'catName' => $catName,
'serviceTypes' => $serviceTypes,
'addons' => $addons,
'specs' => $specs,
'orderCount' => (int)($orderAgg['total_cnt'] ?? 0),
'orderGmv' => number_format((float)($orderAgg['total_gmv'] ?? 0), 2, '.', ''),
]);
return $this->view->fetch();
}
/**
* 格式化商品关联的主服务与增项服务 JSON,并自动提取默认主服务价格用于底层索引兼容
*/
@@ -356,4 +396,36 @@ class Service extends Backend
}
$delQuery->delete();
}
/**
* 删除保护:已产生历史业务订单的服务商品禁止物理删除,无关联订单删除时同步清理细分规格
*/
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'));
}
$ordCnt = (int)Db::name('order')->where('service_id', 'in', $idArr)->count();
if ($ordCnt > 0) {
$this->error('所选商品已关联 ' . $ordCnt . ' 笔历史工单,禁止物理删除;如需下架请将状态设为隐藏');
}
Db::startTrans();
try {
Db::name('service_spec')->where('service_id', 'in', $idArr)->delete();
$deleted = Db::name('service')->where('id', 'in', $idArr)->delete();
Db::commit();
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($deleted) {
$this->success();
}
$this->error(__('No rows were deleted'));
}
}