afa 7 сар өмнө
parent
commit
942078239b

+ 6 - 3
application/api/controller/Market.php

@@ -87,16 +87,19 @@ class Market extends Api
 
 
     //求购列表
-    public function buyingList()
+    public function buyingList(ProductBuying $productBuying)
     {
-        
+        $params = $this->request->post();
+        $validate = \think\Loader::validate('Market');
+        if(!$validate->scene('announcement')->check($params)) $this->error($validate->getError());
+        $this->success('ok', $productBuying::getBuyingList($params['product_id']));
     }
 
     /**
      * 发起求购
      * @return void
      */
-    public function setBuying(LedgerWalletModel $ledgerWalletModel, ProductBuying $productBuying, ProductOrder $productOrder)
+    public function setBuying(LedgerWalletModel $ledgerWalletModel, ProductBuying $productBuying)
     {
 
         $params = $this->request->post();

+ 4 - 8
application/common/model/ProductBuying.php

@@ -65,15 +65,11 @@ class ProductBuying extends Model
     }
 
     //获取订单列表
-    public function getBuyingList(int $userId, int $page, int $size, int $status)
+    public static function getBuyingList(int $productId)
     {
-        $where = [
-            'user_id'   => $userId,
-           'status'    => $status,
-        ];
-        $list = $this->where($where)->page($page, $size)->order('id desc')->select();
-        $count = $this->where($where)->count();
-        return compact('list', 'count');
+       
+        return self::where('product_id', $productId)->where('status', self::Normal)->field('id,min_price')->order('id desc')->select();
+    
     }
 
     public function getCreateTimeTextAttr($value, $data)