This commit is contained in:
2025-10-22 16:36:29 +08:00
parent 03a364aef3
commit f4e5ccc8e2
2 changed files with 7 additions and 5 deletions

View File

@@ -369,7 +369,7 @@ class Base extends Model
Redis::del($v); Redis::del($v);
} }
} }
Redis::set('time_discount:info', implode(',',$table_arr) . ','); Redis::set('time_discount:info', implode(',', $table_arr));
} }
if(empty($table_arr)){ if(empty($table_arr)){
print_r(json_encode($table_arr) . '过期' ."\r\n"); print_r(json_encode($table_arr) . '过期' ."\r\n");

View File

@@ -126,18 +126,20 @@ class Events
$redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount'; $redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount';
// 限时折扣修改 // 限时折扣修改
if($message['operate_type'] == 'time_discount_save') { if($message['operate_type'] == 'time_discount_save') {
if(empty($message['data'])) { if(empty($message['data'])) {
$res = Redis::del($redis_str); $res = Redis::del($redis_str);
}else { }else {
$res = Redis::set($redis_str, json_encode($message['data'])); $res = Redis::set($redis_str, json_encode($message['data']));
// 将桌号存入redis 以便及时删除 // 将桌号存入redis 以便及时删除
$time_discount_info = Redis::get('time_discount:info'); $time_discount_info = Redis::get('time_discount:info');
$arr_time_discount_info = json_decode($time_discount_info, true);
if($time_discount_info) { if($time_discount_info) {
$time_discount_info .= $redis_str . ','; if(!in_array($redis_str, $arr_time_discount_info)) {
Redis::set('time_discount:info', $time_discount_info); $time_discount_info = array_merge($arr_time_discount_info, $redis_str);
Redis::set('time_discount:info', implode(',', $time_discount_info) . ',');
}
}else { }else {
Redis::set('time_discount:info', $redis_str . ','); Redis::set('time_discount:info', $redis_str);
} }
} }
$snd_data = [ $snd_data = [