afa 7 сар өмнө
parent
commit
340751a71e

+ 2 - 4
application/api/controller/Market.php

@@ -86,10 +86,8 @@ class Market extends Api
     //求购列表
     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']));
+      
+        $this->success('ok', $productBuying::getBuyingList($this->auth->id, $this->request->getLan(), $this->pageSize));
     }
 
     /**

+ 6 - 3
application/common/model/ProductBuying.php

@@ -76,10 +76,13 @@ class ProductBuying extends Model
     }
 
     //获取订单列表
-    public static function getBuyingList(int $productId)
+    public static function getBuyingList(int $uid, string $lan, int $page)
     {
-       
-        return self::where('product_id', $productId)->where('status', self::Normal)->field('id,min_price')->order('id desc')->select();
+        return self::alias('a')->where('user_id', $uid)
+        ->join('product_list p', 'a.product_id = p.id')
+        ->field('a.*,p.' . $lan . '_name as name,p.thum')
+        ->order('id desc')
+        ->paginate($page);
     }
 
     public function getCreateTimeTextAttr($value, $data)