作者 耿培杰

修改订单付款接口

... ... @@ -1202,7 +1202,7 @@ class Order extends Api
if ($v['type'] == 2) {
//判断积分商品是否有库存
$is_stock = $this->integralGoodsModel->checkStockNum($v['goods_id'], $v['number']);
if (!$is_stock) $this->error($v['ch_goods_name'] . ' 库存不足1');
if (!$is_stock) $this->error($v['ch_goods_name'] . ' 库存不足');
} else {
//判断商品是否有库存
$is_stock = $this->goodsModel->checkStockNum($v['goods_id'], $v['number']);
... ...
... ... @@ -210,11 +210,11 @@ class Goods extends Model
public function getDepot($goodsId,$areaId,$number,$type){
$arr = [];//仓库对应需扣除库存信息
//获取全部仓库库存
$sum_stock_num = $this->alias('g')
->join('fa_depot d','g.id=d.goods_id')
->where(['g.id' => $goodsId,'d.type' => $type])
->field('d.id,d.stock_num')
->sum('d.stock_num');
$depotModel = new Depot();
$sum_stock_num = $depotModel
->where(['goods_id' => $goodsId])
->where('type',"'".$type."'")
->sum('stock_num');
if($number > $sum_stock_num){
return false; //库存不足
}
... ...