From 06be1c7ccc7533612e4cc7b0e730080d0dd3d2a1 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 16 Jan 2026 11:43:36 +0800
Subject: [PATCH] 商品可以赠送优惠券 商品属性增加团购 入驻商家增加实物和团购选项 团购和实物商户分类分开 增加团购商家页面 后台添加页面增加团购组件
---
admin/app/api/model/page/Page.php | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/admin/app/api/model/page/Page.php b/admin/app/api/model/page/Page.php
index e84a57c..3d8a311 100644
--- a/admin/app/api/model/page/Page.php
+++ b/admin/app/api/model/page/Page.php
@@ -14,7 +14,7 @@
use app\api\model\plus\bargain\Active as BargainActiveModel;
use app\api\model\plus\live\Room as RoomModel;
use app\api\model\plus\release\Project;
-
+use app\api\model\supplier\Supplier as SupplierModel;
/**
* 首页模型
*/
@@ -32,7 +32,7 @@
/**
* DIY页面详情
*/
- public static function getPageData($user, $page_id = null,$city_supplier_ids='')
+ public static function getPageData($user, $page_id = null,$city_supplier_ids='',$latitude=0,$longitude=0)
{
// 页面详情
$detail = $page_id > 0 ? parent::detail($page_id) : parent::getDefault();
@@ -88,6 +88,10 @@
$items[$key]['data'] = $model->getLiveList($item);
} else if ($item['type'] === 'previewProduct') {
$items[$key]['data'] = $model->getPreviewList($user, $item);
+ } else if ($item['type'] === 'groupBuy') {
+ // 团购组件
+ $items[$key]['data'] = $model->getGroupBuyList($user, $item, $city_supplier_ids, $latitude, $longitude);
+ $items[$key]['style']['server_score_image']=$items[$key]['style']['server_score_image']==self::$base_url . 'image/diy/product/01.png'?'':$items[$key]['style']['server_score_image'];
}
}
return ['page' => $items['page'], 'items' => $items];
@@ -265,4 +269,37 @@
}
return $data;
}
+ public function getSupplierList($item)
+ {
+ $model = new SupplierModel();
+ $list = $model->getList([
+ 'list_rows' => $item['params']['showNum']
+ ]);
+ return $list->isEmpty() ? [] : $list->toArray()['data'];
+ }
+
+ /**
+ * 团购组件:获取团购商户列表
+ */
+ private function getGroupBuyList($user, $item, $city_supplier_ids = '', $latitude = 0, $longitude = 0)
+ {
+ // 获取团购数据
+ $model = new SupplierModel();
+ $params = [
+ 'list_rows' => isset($item['params']['showNum']) ? $item['params']['showNum'] : 10,
+ 'sortType' => isset($item['params']['merchantSort']) ? $item['params']['merchantSort'] : 'all',
+ 'product_num' => isset($item['params']['product_num']) ? $item['params']['product_num'] : 3,
+ 'city_supplier_ids' => $city_supplier_ids,
+ 'latitude' => $latitude,
+ 'longitude' => $longitude,
+ ];
+
+ // 如果有分类筛选
+ if (isset($item['params']['category_id']) && $item['params']['category_id']) {
+ $params['category_id'] = $item['params']['category_id'];
+ }
+
+ $list = $model->getGroupBuyList($params);
+ return empty($list['data']) ? [] : $list['data'];
+ }
}
\ No newline at end of file
--
Gitblit v1.9.2