78 行
2.5 KiB
PHP
可执行文件
78 行
2.5 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Common\Model;
|
|
//[1.4.36]
|
|
class AdvanceSkuGoodsModel extends BaseModel
|
|
{
|
|
protected $tableName = 'retail_advance_sku_goods';
|
|
protected $fields = array(
|
|
'id',
|
|
'merchant_id', //商户id
|
|
'store_id', //门店id
|
|
'advance_id', //预售商品表id
|
|
'goods_id', //int(11) DEFAULT '0' COMMENT '商品id',
|
|
'sku_id', //规格id
|
|
'advance_num', //decimal(10,3) DEFAULT NULL COMMENT '预售库存',
|
|
'surplus_num', // decimal(10,3) DEFAULT NULL COMMENT '剩余库存',
|
|
'earnest_price', //定金
|
|
'advance_price', //尾款
|
|
'arrive_price', //定金抵现
|
|
'add_time', //varchar(11) DEFAULT NULL COMMENT '添加时间',
|
|
'advance_state', //状态 0关闭1开启 2删除
|
|
);
|
|
|
|
/**
|
|
* 查询预售某规格商品详情
|
|
*/
|
|
public function getSkuInfo($parameter)
|
|
{
|
|
$where = array(
|
|
'a.advance_id' => $parameter['advance_id'],
|
|
'a.goods_id' => $parameter['goods_id'],
|
|
'a.sku_id' => $parameter['sku_id'],
|
|
'a.advance_state' => 1
|
|
);
|
|
$sku_info = $this->alias('a')
|
|
->join('ls_retail_sku_goods as s on a.goods_id=s.goods_id AND a.sku_id=s.id')
|
|
->where($where)
|
|
->field("a.advance_id,a.goods_id,a.sku_id,a.advance_num,a.surplus_num,a.earnest_price,a.advance_price,a.arrive_price,a.advance_state,s.*")
|
|
->find();
|
|
return $sku_info;
|
|
}
|
|
/**
|
|
* 售后库存增加
|
|
*/
|
|
public function StockSetInc($parameter)
|
|
{
|
|
if(is_array($parameter)){
|
|
$where = array(
|
|
'advance_id'=>$parameter['advance_id'],
|
|
'goods_id'=>$parameter['goods_id'],
|
|
'sku_id'=>$parameter['sku_id']
|
|
);
|
|
$res = $this->toSetInc($where,"surplus_num",$parameter['num']);
|
|
}else{
|
|
$res['status'] = 0;
|
|
$res['msg'] = '参数错误';
|
|
}
|
|
return $res;
|
|
}
|
|
/**
|
|
* 售后库存减少
|
|
*/
|
|
public function StockSetDec($parameter)
|
|
{
|
|
if(is_array($parameter)){
|
|
$where = array(
|
|
'advance_id'=>$parameter['advance_id'],
|
|
'goods_id'=>$parameter['goods_id'],
|
|
'sku_id'=>$parameter['sku_id']
|
|
);
|
|
$res = $this->toSetDec($where,"surplus_num",$parameter['num']);
|
|
}else{
|
|
$res['status'] = 0;
|
|
$res['msg'] = '参数错误';
|
|
}
|
|
return $res;
|
|
}
|
|
} |