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