限时折扣相关
This commit is contained in:
@@ -135,29 +135,29 @@ class Events
|
||||
Gateway::sendToClient($client_id, json_encode(['msg' => '桌码或shop_id不能为空']));
|
||||
return;
|
||||
}
|
||||
$redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount';
|
||||
if(empty($message['data'])) {
|
||||
$res = Redis::del($redis_str);
|
||||
}else {
|
||||
$res = Redis::set($redis_str, json_encode($message['data']));
|
||||
// 将桌号存入redis 以便及时删除
|
||||
$time_discount_info = Redis::get('time_discount:info');
|
||||
if($time_discount_info) {
|
||||
$arr_time_discount_info = explode(',', $time_discount_info);
|
||||
if(!in_array($redis_str, $arr_time_discount_info)) {
|
||||
$time_discount_info = array_merge($arr_time_discount_info, [$redis_str]);
|
||||
Redis::set('time_discount:info', implode(',', $time_discount_info));
|
||||
}
|
||||
}else {
|
||||
Redis::set('time_discount:info', $redis_str);
|
||||
}
|
||||
}
|
||||
// $redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount';
|
||||
// if(empty($message['data'])) {
|
||||
// $res = Redis::del($redis_str);
|
||||
// }else {
|
||||
// $res = Redis::set($redis_str, json_encode($message['data']));
|
||||
// // 将桌号存入redis 以便及时删除
|
||||
// $time_discount_info = Redis::get('time_discount:info');
|
||||
// if($time_discount_info) {
|
||||
// $arr_time_discount_info = explode(',', $time_discount_info);
|
||||
// if(!in_array($redis_str, $arr_time_discount_info)) {
|
||||
// $time_discount_info = array_merge($arr_time_discount_info, [$redis_str]);
|
||||
// Redis::set('time_discount:info', implode(',', $time_discount_info));
|
||||
// }
|
||||
// }else {
|
||||
// Redis::set('time_discount:info', $redis_str);
|
||||
// }
|
||||
// }
|
||||
$snd_data = [
|
||||
'msg' => '折扣修改',
|
||||
'operate_type' => $message['operate_type'],
|
||||
'msg_id' => '',
|
||||
'type' => 'time_discount',
|
||||
'status' => $res,
|
||||
'status' => (new Base())->setTimeInfo($message),
|
||||
'data' => $message['data'],
|
||||
];
|
||||
Gateway::sendToClient($client_id, json_encode($snd_data));
|
||||
|
||||
Reference in New Issue
Block a user