afa 7 сар өмнө
parent
commit
fc1c2e4928

+ 1 - 1
application/api/controller/Pledge.php

@@ -53,7 +53,7 @@ class Pledge extends Api
             //质押详情
             $pledges = $productPledges::get($id);
             if (!empty($pledges)) {
-                  $pledges->product_list = $productList::getBySynthesisProduct($pledges->product_id, $this->lan);
+                  $pledges->product_list = $productList::getBySynthesisProduct($pledges->product_id,  $pledges->type_id, $this->lan);
             }
             $this->success('', $pledges);
       }

+ 0 - 1
application/common/logic/PledgeLogic.php

@@ -20,7 +20,6 @@ class PledgeLogic
     public  static function getByProductIdList(object $list, string $lan = 'zh')
     {
         $model  = Loader::model('ProductLists');
-
         foreach ($list as &$item) {
             $item['product_list'] = $model->whereIn('id', $item->product_id);
             if($item->type_id == ProductPledges::Combin) $item['product_list'] = $model->orderRaw('field(id,'. $item->product_id.')');

+ 5 - 3
application/common/model/ProductLists.php

@@ -38,11 +38,13 @@ class ProductLists extends Model
     ];
 
     //获取产品信息
-    public static function  getBySynthesisProduct(string $product_id, $lan = 'zh')
+    public static function  getBySynthesisProduct(string $product_id, int $type_id, $lan = 'zh')
     {    
         if(empty($product_id)) return [];
-        $product_id = explode(',', $product_id);
-        return self::whereIn('id', $product_id)->column('id,thum,'.$lan.'_name as name');
+        $info = self::whereIn('id', $product_id);
+        if($type_id == ProductPledges::Combin) $info = $info->orderRaw('field(id,'. $product_id.')');
+        $info = $info->column('id,thum,'.$lan.'_name as name');
+        return $info ;
     }
 
     //地区