xieruidong 2 роки тому
батько
коміт
2e4c132369

+ 1 - 1
application/api/controller/mall/Goods.php

@@ -149,7 +149,7 @@ class Goods extends Api
         $sku=GoodsSku::findOrFail($data['sku_id']);
         $info=[
             'goods'=>[],
-            'amount_total'=>$sku['amount'],
+            'amount_total'=>$sku->getRealAmount(),
         ];
         $category=Category::where('name','支架')->value('id',0);
         $info['goods']=\app\common\model\Goods::where('category_id',$category)

+ 9 - 0
application/common/model/GoodsSku.php

@@ -2,6 +2,7 @@
 
 namespace app\common\model;
 
+use app\common\validate\KillService;
 use think\db\Query;
 use think\Model;
 
@@ -29,6 +30,14 @@ class GoodsSku Extends Model
         return $this->belongsTo(Goods::class);
     }
 
+    public function getRealAmount(){
+        $open=KillService::open();
+        if($open){
+            return $this['amount_kill'];
+        }
+        return $this['amount'];
+    }
+
 
     protected static function init()
     {