...
|
...
|
@@ -579,10 +579,23 @@ class Common |
|
|
//销量增加1
|
|
|
$res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id,uid');
|
|
|
if($res){
|
|
|
$res1 = self::selectSoftWhereData('ogoods',['o_id'=>$res['id']],'id,g_id');
|
|
|
$res1 = self::selectSoftWhereData('ogoods',['o_id'=>$res['id']],'id,g_id,style');
|
|
|
$g_ids = array_column($res1,'g_id');
|
|
|
//减库存
|
|
|
self::decStock(['id'=>['in',$g_ids]]);
|
|
|
$goodsModel = new \app\admin\model\Goods();
|
|
|
//查询商品的库存
|
|
|
$res_stock = self::selectSoftWhereData('goods',['id'=>['in',$g_ids]],'id,style g_style,stock');
|
|
|
foreach($res1 as $value){
|
|
|
foreach($res_stock as $g_value){
|
|
|
if($value['g_id'] == $g_value['id']){
|
|
|
$arr_stock = explode('|',$g_value['stock']);
|
|
|
$s_index = array_search($value['style'],self::salePrice($g_value['g_style']));
|
|
|
$stock = self::salePrice($g_value['stock'])[$s_index] - 1;
|
|
|
$arr_stock[$s_index] = $stock;
|
|
|
$goodsModel->where(['id'=>$value['g_id']])->update('stock',implode('|',$arr_stock));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//增加销售
|
|
|
self::incSales(['id'=>['in',$g_ids]]);
|
|
|
//删除购物车
|
...
|
...
|
|