redis edit
This commit is contained in:
@@ -320,30 +320,32 @@ class Base extends Model
|
|||||||
|
|
||||||
|
|
||||||
$uid = $gateway::getUidByClientId($client_id);
|
$uid = $gateway::getUidByClientId($client_id);
|
||||||
$result = Redis::get($uid);
|
if($uid) {
|
||||||
// 处理打印消息
|
$result = Redis::get($uid);
|
||||||
if($result) {
|
// 处理打印消息
|
||||||
$msg_info_arr = json_decode($result, true);
|
if($result) {
|
||||||
foreach ($msg_info_arr as $k => $v) {
|
$msg_info_arr = json_decode($result, true);
|
||||||
if($v['send_num'] < self::RETRYCOUNT) {
|
foreach ($msg_info_arr as $k => $v) {
|
||||||
$msg_info_arr[$k]['send_num'] += 1;
|
if($v['send_num'] < self::RETRYCOUNT) {
|
||||||
$v_json = json_encode($v);
|
$msg_info_arr[$k]['send_num'] += 1;
|
||||||
call_user_func_array([$gateway, $v['method']], [$v['send_id'], $v_json]);
|
$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);
|
self::add_log_file('推送收银机订单打印(重试第' . $v['send_num'] . '次)--->' . $v_json, 'cashier');
|
||||||
// array_push($new_arr, $v);
|
// $redis->set($uid, json_encode($v), self::REDIS_TIME);
|
||||||
}else {
|
// array_push($new_arr, $v);
|
||||||
unset($msg_info_arr[$k]);
|
}else {
|
||||||
$msg_info_arr = array_values($msg_info_arr);
|
unset($msg_info_arr[$k]);
|
||||||
self::add_log_file('----推送收银机订单打印无回执--->' . $result, 'cashier');
|
$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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user