老库存注释
This commit is contained in:
@@ -255,23 +255,22 @@ class Events
|
||||
->where('r.product_id', $message['product_id'])
|
||||
->fieldRaw('r.cons_info_id AS consId, SUM(r.surplus_stock * ' . $message['number'] . ') AS quantity, cons.stock_number AS current_quantity')
|
||||
->group('r.cons_info_id')
|
||||
->order('cons.stock_number', 'asc')
|
||||
->select()->toArray();
|
||||
if(!empty($tb_prod_cons)) {
|
||||
foreach ($tb_prod_cons as $tb_prod_cons_k => $tb_prod_cons_v) {
|
||||
if ($tb_prod_cons_v['quantity'] > $tb_prod_cons_v['current_quantity']) {
|
||||
$snd_data = [
|
||||
'msg' => '此商品库存不足',
|
||||
'operate_type' => $message['operate_type'],
|
||||
'msg_id' => 'out_of_stock' . Random::build(),
|
||||
'type' => 'out_of_stock',
|
||||
'id' => !empty($message['id'])?$message['id']:'',
|
||||
'data_type' => 'cart',
|
||||
'status' => 0,
|
||||
'data' => []
|
||||
];
|
||||
$gate_way::sendToClient($client_id, json_encode($snd_data));
|
||||
return;
|
||||
}
|
||||
if(!empty($tb_prod_cons[0])) {
|
||||
if ($tb_prod_cons[0]['quantity'] > $tb_prod_cons[0]['current_quantity']) {
|
||||
$snd_data = [
|
||||
'msg' => '此商品库存不足',
|
||||
'operate_type' => $message['operate_type'],
|
||||
'msg_id' => 'out_of_stock' . Random::build(),
|
||||
'type' => 'out_of_stock',
|
||||
'id' => !empty($message['id'])?$message['id']:'',
|
||||
'data_type' => 'cart',
|
||||
'status' => 0,
|
||||
'data' => []
|
||||
];
|
||||
$gate_way::sendToClient($client_id, json_encode($snd_data));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// $number = $message['number'];
|
||||
|
||||
Reference in New Issue
Block a user