feat: 新增大量服务类图标及相关接口配置
- 新增20+家电维修类图标(电视、空调、冰箱等) - 新增短信发送、微信手机号登录接口 - 新增服务规格查询接口 - 更新后台配置与菜单结构 - 移除支付插件相关配置
这个提交包含在:
@@ -75,12 +75,48 @@ class Home extends Base
|
||||
$query->where('cat_id', $catId);
|
||||
}
|
||||
if ($keyword !== '') {
|
||||
$query->where('name', 'like', '%' . $keyword . '%');
|
||||
$specMatchingIds = Db::name('service_spec')
|
||||
->where('status', 'normal')
|
||||
->where('name|description', 'like', '%' . $keyword . '%')
|
||||
->column('service_id');
|
||||
$query->where(function($q) use ($keyword, $specMatchingIds) {
|
||||
$q->where('name', 'like', '%' . $keyword . '%');
|
||||
if (!empty($specMatchingIds)) {
|
||||
$q->whereOr('id', 'in', $specMatchingIds);
|
||||
}
|
||||
});
|
||||
}
|
||||
$list = $query->order('weigh desc,sales desc,id asc')->select();
|
||||
$this->success('', ['list' => $this->formatServices($list)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商品规格列表
|
||||
*/
|
||||
public function specs()
|
||||
{
|
||||
$serviceId = (int)$this->request->param('service_id');
|
||||
if ($serviceId <= 0) {
|
||||
$this->error('请指定服务商品');
|
||||
}
|
||||
$specs = Db::name('service_spec')
|
||||
->where('service_id', $serviceId)
|
||||
->where('status', 'normal')
|
||||
->order('weigh desc, id asc')
|
||||
->select();
|
||||
$ret = [];
|
||||
foreach ($specs as $sp) {
|
||||
$ret[] = [
|
||||
'id' => (int)$sp['id'],
|
||||
'service_id' => (int)$sp['service_id'],
|
||||
'name' => $sp['name'],
|
||||
'description' => (string)$sp['description'],
|
||||
'base_price' => (float)$sp['base_price'],
|
||||
];
|
||||
}
|
||||
$this->success('', ['list' => $ret]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务详情
|
||||
*/
|
||||
@@ -389,9 +425,37 @@ class Home extends Base
|
||||
*/
|
||||
public function formatServices($list)
|
||||
{
|
||||
if (empty($list)) {
|
||||
return [];
|
||||
}
|
||||
$serviceIds = array_column($list, 'id');
|
||||
$specsMap = [];
|
||||
if (!empty($serviceIds)) {
|
||||
$specs = Db::name('service_spec')
|
||||
->where('service_id', 'in', $serviceIds)
|
||||
->where('status', 'normal')
|
||||
->order('weigh desc, id asc')
|
||||
->select();
|
||||
foreach ($specs as $sp) {
|
||||
$sid = (int)$sp['service_id'];
|
||||
if (!isset($specsMap[$sid])) {
|
||||
$specsMap[$sid] = [];
|
||||
}
|
||||
$specsMap[$sid][] = [
|
||||
'id' => (int)$sp['id'],
|
||||
'service_id' => $sid,
|
||||
'name' => $sp['name'],
|
||||
'description' => (string)$sp['description'],
|
||||
'base_price' => (float)$sp['base_price'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
foreach ($list as $row) {
|
||||
$ret[] = $this->formatService($row);
|
||||
$formatted = $this->formatService($row);
|
||||
$formatted['specs'] = isset($specsMap[$row['id']]) ? $specsMap[$row['id']] : [];
|
||||
$ret[] = $formatted;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户