feat: 新增分销分佣结算、商家认证及草稿管理功能,优化界面与版本更新

这个提交包含在:
2026-10-21 20:06:40 +08:00
父节点 d508949921
当前提交 088a08d43a
共有 117 个文件被更改,包括 10254 次插入 和 3000 次删除

查看文件

@@ -16,23 +16,29 @@ use think\Db;
class Home extends V1
{
/**
* H1 首页轮播广告位
* H1 首页轮播广告位接口
* GET /api/v1/home/banners → [{id,title,image,link,color}]
* 规则:仅 enabled=1,按 sort asc;image 为空返回 ''
* 规则:仅返回 enabled=1,按 sort asc, id desc 排序;若配置了相对路径图片,则自动使用 cdnurl 拼接完整域名地址
*
* @return void
*/
public function banners()
{
$rows = Db::name('fc_banner')
->where('enabled', 1)
->order('sort asc')
->order('sort asc, id desc')
->select();
$list = [];
foreach ($rows as $row) {
$image = (string)$row['image'];
if ($image !== '' && !preg_match('/^https?:\/\//i', $image)) {
$image = cdnurl($image, true);
}
$list[] = [
'id' => (int)$row['id'],
'title' => (string)$row['title'],
'image' => (string)$row['image'],
'image' => $image,
'link' => (string)$row['link'],
'color' => (string)$row['color'],
];
@@ -55,11 +61,12 @@ class Home extends V1
$list = [];
foreach ($rows as $row) {
$id = (int)$row['id'];
$iconKey = (string)$row['icon_key'];
$list[] = [
'id' => $id,
'name' => (string)$row['name'],
'iconKey' => (string)$row['icon_key'],
'icon' => '/static/icons/' . $this->iconFile($id),
'iconKey' => $iconKey,
'icon' => $this->resolveCategoryIconPath($id, $iconKey),
'color' => (string)$row['color'],
'count' => (int)$row['post_count'],
];
@@ -315,7 +322,37 @@ class Home extends V1
}
/**
* 分类 id → 固定图标文件名
* 全兼容分类图标路径解析
* 规则:网络URL或相对路径直接透传;支持根据 iconKey 或 分类 ID 智能映射内置图标;默认回落 cat-job.png 兜底
* @param int $id 分类ID
* @param string $iconKey 分类图标键名或图片路径
* @return string
*/
protected function resolveCategoryIconPath($id, $iconKey = '')
{
if ($iconKey !== '') {
if (preg_match('/^https?:\/\/|^\/uploads\/|^\/static\//i', $iconKey)) {
return $iconKey;
}
$keyMap = [
'cat-job' => 'cat-job.png',
'cat-house' => 'cat-house.png',
'cat-goods' => 'cat-goods.png',
'cat-car' => 'cat-car.png',
'cat-service' => 'cat-service.png',
'cat-education' => 'cat-education.png',
'cat-clean' => 'cat-clean.png',
'cat-friend' => 'cat-friend.png',
];
if (isset($keyMap[$iconKey])) {
return '/static/icons/' . $keyMap[$iconKey];
}
}
return '/static/icons/' . $this->iconFile($id);
}
/**
* 分类 id → 固定图标文件名(向下兼容)
* @param int $id
* @return string
*/