public static function app() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
public function modNum($goods_id, $goods_num) { // 先判断是否存在 if (!$this->isEexit($goods_id)) { return; } // 判断num if ($goods_num <= 1) { $goods_num = 1; } // 获得商品的库存量 $mg = new ModelGoods('bl_goods'); $total = $mg->getOne("select goods_total from bl_goods where goods_id=" . $goods_id); if ($goods_num >= $total) { $goods_num = $total; } $this->items[$goods_id]['num'] = $goods_num; }