diff --git a/extend/workermans/model/Base.php b/extend/workermans/model/Base.php index f78ee49..8cd81b6 100644 --- a/extend/workermans/model/Base.php +++ b/extend/workermans/model/Base.php @@ -46,7 +46,7 @@ class Base }elseif (strstr($data_arr['operate_type'], 'del')) { $operate_type = 'del'; }elseif (strstr($data_arr['operate_type'], 'cleanup')) { - $operate_type = 'cleanup'; + $operate_type = ' '; }elseif (strstr($data_arr['operate_type'], 'clearOrder')) { $operate_type = 'clearOrder'; }elseif (strstr($data_arr['operate_type'], 'batch')) { diff --git a/plugin/webman/gateway/Events.php b/plugin/webman/gateway/Events.php index 57198b0..d0466f9 100644 --- a/plugin/webman/gateway/Events.php +++ b/plugin/webman/gateway/Events.php @@ -246,30 +246,30 @@ class Events if ( (!empty($message['operate_type']) && ($message['operate_type'] == 'add' || $message['operate_type'] == 'edit')) && (!empty($message['product_id']) && !empty($message['shop_id']) && !empty($message['number'])) && - (!empty($product) && $product[0]['is_auto_sold_stock'] == 1) + (!empty($product) && $product[0]['is_stock'] == 1) ) { $gate_way = GateWay::class; - $tb_prod_cons = Db::name('tb_prod_cons_relation') - ->alias('r') - ->join('tb_cons_info cons', 'r.cons_info_id = cons.id AND cons.is_stock = 1', 'inner') - ->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') - ->select()->toArray(); - 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; - } +// $tb_prod_cons = Db::name('tb_prod_cons_relation') +// ->alias('r') +// ->join('tb_cons_info cons', 'r.cons_info_id = cons.id AND cons.is_stock = 1', 'inner') +// ->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') +// ->select()->toArray(); +// 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']; try { // Redis::select(3);