Browse Source

某个拼团的详情

lizhen_gitee 3 months ago
parent
commit
4be2d9080b
1 changed files with 20 additions and 1 deletions
  1. 20 1
      addons/shopro/controller/activity/Groupon.php

+ 20 - 1
addons/shopro/controller/activity/Groupon.php

@@ -23,15 +23,34 @@ class Groupon extends Common
 
         $groupons = GrouponModel::with('leader')->ing()
             ->where('goods_id', $goods_id)
-//            ->where('activity_id', $activity_id)
+            ->where('activity_id', $activity_id)
             ->order('id', 'asc')
 //            ->paginate($this->request->param('list_rows', 10));
             ->autopage()->select();
         $this->success('获取成功', $groupons);
     }
 
+    //某个拼团详情
+    public function detailnew(){
+        $id = $this->request->param('id');
+        $groupon = GrouponModel::with(['groupon_logs'])->where('id', $id)->find();
+        if (!$groupon) {
+            $this->error(__('No Results were found'));
+        }
+
+        $service = new GoodsService();
+        // 查询所有状态的商品,并且包含被删除的商品
+        $goods = $service->withTrashed()->where('id', $groupon->goods_id)->find();
+        if (!$goods) {
+            $this->error('活动商品不存在');
+        }
 
 
+        $groupon['goods'] = $goods;
+
+        $this->success('获取成功', $groupon);
+    }
+
 
     // 团详情
     public function detail()