redis edit

This commit is contained in:
2025-10-13 15:08:14 +08:00
parent 87774ca20b
commit 0afa013649

View File

@@ -320,30 +320,32 @@ class Base extends Model
$uid = $gateway::getUidByClientId($client_id);
$result = Redis::get($uid);
// 处理打印消息
if($result) {
$msg_info_arr = json_decode($result, true);
foreach ($msg_info_arr as $k => $v) {
if($v['send_num'] < self::RETRYCOUNT) {
$msg_info_arr[$k]['send_num'] += 1;
$v_json = json_encode($v);
call_user_func_array([$gateway, $v['method']], [$v['send_id'], $v_json]);
// 推送以后新增推送次数
self::add_log_file('推送收银机订单打印(重试第' . $v['send_num'] . '次)--->' . $v_json, 'cashier');
// $redis->set($uid, json_encode($v), self::REDIS_TIME);
// array_push($new_arr, $v);
}else {
unset($msg_info_arr[$k]);
$msg_info_arr = array_values($msg_info_arr);
self::add_log_file('----推送收银机订单打印无回执--->' . $result, 'cashier');
if($uid) {
$result = Redis::get($uid);
// 处理打印消息
if($result) {
$msg_info_arr = json_decode($result, true);
foreach ($msg_info_arr as $k => $v) {
if($v['send_num'] < self::RETRYCOUNT) {
$msg_info_arr[$k]['send_num'] += 1;
$v_json = json_encode($v);
call_user_func_array([$gateway, $v['method']], [$v['send_id'], $v_json]);
// 推送以后新增推送次数
self::add_log_file('推送收银机订单打印(重试第' . $v['send_num'] . '次)--->' . $v_json, 'cashier');
// $redis->set($uid, json_encode($v), self::REDIS_TIME);
// array_push($new_arr, $v);
}else {
unset($msg_info_arr[$k]);
$msg_info_arr = array_values($msg_info_arr);
self::add_log_file('----推送收银机订单打印无回执--->' . $result, 'cashier');
}
if(empty($msg_info_arr)) {
Redis::del($uid);
}else {
Redis::set($uid, json_encode($msg_info_arr), self::REDIS_TIME);
}
return true;
}
if(empty($msg_info_arr)) {
Redis::del($uid);
}else {
Redis::set($uid, json_encode($msg_info_arr), self::REDIS_TIME);
}
return true;
}
}
}