wupengfei 2 年之前
父節點
當前提交
887f125c68
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      application/store/controller/Goods.php

+ 6 - 3
application/store/controller/Goods.php

@@ -106,6 +106,7 @@ class Goods extends Controller
                 if (!$checksell)  $this->error('藏品已经开始抢购或已过期,无法修改');
                 $goods_info = Db::name('store_collection')->find($data['id']);
                 if($goods_info['issue_mode'] == 2 && strtotime($goods_info['apply_st']) <time()) $this->error('抽签报名开始无法修改');
+                if($goods_info['inventory'] != $goods_info['now_inventory']) $this->error('商品库存已扣减,无法编辑');
             }
             if ($data['cover'] == '') $this->error('请上传藏品图片');
             if ($data['price']<=0) $this->error('藏品价格错误');
@@ -118,6 +119,8 @@ class Goods extends Controller
                     ->whereIn('status','1,3')
                     ->where('c_id',$data['id'])
                     ->count();
+                $blind_count = Db::name('store_blind_box')->where(['prize_id'=>$data['id'],'is_deleted'=>0])->sum('num');
+                $buy_count += $blind_count;
             }else{
                 $buy_count = 0;
             }
@@ -453,9 +456,9 @@ class Goods extends Controller
         $where=  [];
         $where[] = ['d.coll_id','=',$id];
         $list = $this->_query('store_collection_draw')->field('d.*,u.name,u.phone,u.headimg')
-                ->alias('d')->leftJoin('store_member u','u.id=d.user_id')->where($where)
-                ->dateBetween('d.create_at')->order('d.id desc')
-                 ->page();
+            ->alias('d')->leftJoin('store_member u','u.id=d.user_id')->where($where)
+            ->dateBetween('d.create_at')->order('d.id desc')
+            ->page();
         $this->fetch();
     }