redis edit
This commit is contained in:
parent
215123b5a2
commit
d0367bbc44
|
|
@ -4,6 +4,7 @@ namespace extend\workermans\model;
|
||||||
|
|
||||||
use ba\Exception;
|
use ba\Exception;
|
||||||
use ba\Random;
|
use ba\Random;
|
||||||
|
use support\Redis;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use GatewayWorker\Lib\Gateway;
|
use GatewayWorker\Lib\Gateway;
|
||||||
Use support\Log;
|
Use support\Log;
|
||||||
|
|
@ -67,27 +68,25 @@ class Cashier extends Base
|
||||||
self::gateway_query('sendToClient', [$client_id, json_encode($snd_data)]);
|
self::gateway_query('sendToClient', [$client_id, json_encode($snd_data)]);
|
||||||
|
|
||||||
$uid = $message['account'];
|
$uid = $message['account'];
|
||||||
$redis = self::$redis;
|
|
||||||
$gateway = Gateway::class;
|
$gateway = Gateway::class;
|
||||||
// 处理打印消息
|
// 处理打印消息
|
||||||
$redis->get($uid, function ($result, $redis) use($gateway, $uid){
|
$result = Redis::get($uid);
|
||||||
if($result) {
|
if($result) {
|
||||||
$msg_info_arr = json_decode($result, true);
|
$msg_info_arr = json_decode($result, true);
|
||||||
$arr_n = [];
|
$arr_n = [];
|
||||||
foreach ($msg_info_arr as $k => $arr) {
|
foreach ($msg_info_arr as $k => $arr) {
|
||||||
if($arr['send_num'] < self::RETRYCOUNT) {
|
if($arr['send_num'] < self::RETRYCOUNT) {
|
||||||
$arr['send_num'] += 1;
|
$arr['send_num'] += 1;
|
||||||
$arr_json = json_encode($arr);
|
$arr_json = json_encode($arr);
|
||||||
call_user_func_array([$gateway, $arr['method']], [$arr['send_id'], $arr_json]);
|
call_user_func_array([$gateway, $arr['method']], [$arr['send_id'], $arr_json]);
|
||||||
// 推送以后新增推送次数
|
// 推送以后新增推送次数
|
||||||
self::add_log_file('离线后推送收银机订单打印--->' .date('Y-m-d H:i:s'). '--->' . $arr_json, 'cashier');
|
self::add_log_file('离线后推送收银机订单打印--->' .date('Y-m-d H:i:s'). '--->' . $arr_json, 'cashier');
|
||||||
}
|
|
||||||
self::add_log_file('----离线后推送收银机订单打印无回执--' .date('Y-m-d H:i:s'). '--->' . $arr_json, 'cashier');
|
|
||||||
$arr_n[] = $arr;
|
|
||||||
}
|
}
|
||||||
$redis->set($uid, json_encode($arr_n), self::REDIS_TIME);
|
self::add_log_file('----离线后推送收银机订单打印无回执--' .date('Y-m-d H:i:s'). '--->' . $arr_json, 'cashier');
|
||||||
|
$arr_n[] = $arr;
|
||||||
}
|
}
|
||||||
});
|
Redis::set($uid, json_encode($arr_n), self::REDIS_TIME);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// 新增
|
// 新增
|
||||||
case 'add':
|
case 'add':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue