其他订单打印
This commit is contained in:
@@ -43,47 +43,49 @@ try {
|
|||||||
$is_log = false;
|
$is_log = false;
|
||||||
$curl_error = '';
|
$curl_error = '';
|
||||||
$data = json_decode($data, true);
|
$data = json_decode($data, true);
|
||||||
$rand = 'cashier_order' . Random::build();
|
if(is_array($data)) {
|
||||||
$send_id = 'cashier_'. $data['shopId'];
|
$rand = 'cashier_order' . Random::build();
|
||||||
// 收银机打印订单
|
$send_id = 'cashier_'. $data['shopId'];
|
||||||
$snd_data = [
|
// 收银机打印订单
|
||||||
'msg' => '收银机其他打印',
|
$snd_data = [
|
||||||
'type' => 'cashier',
|
'msg' => '收银机其他打印',
|
||||||
'operate_type' => 'other_print',
|
'type' => 'cashier',
|
||||||
'data_type' => 'other_print',
|
'operate_type' => 'other_print',
|
||||||
'status' => 1,
|
'data_type' => 'other_print',
|
||||||
'method' => 'sendToUid',
|
'status' => 1,
|
||||||
'send_num' => 0,
|
'method' => 'sendToUid',
|
||||||
'send_id' => $send_id,
|
'send_num' => 0,
|
||||||
'msg_id' => $rand,
|
'send_id' => $send_id,
|
||||||
'data' => $data
|
'msg_id' => $rand,
|
||||||
];
|
'data' => $data
|
||||||
$snd_data_json = json_encode($snd_data);
|
];
|
||||||
Gateway::$registerAddress = '127.0.0.1:1238';
|
$snd_data_json = json_encode($snd_data);
|
||||||
$res = Gateway::sendToUid($send_id, $snd_data_json);
|
Gateway::$registerAddress = '127.0.0.1:1238';
|
||||||
Log::info('订单打印推送结果-->' . $res);
|
$res = Gateway::sendToUid($send_id, $snd_data_json);
|
||||||
$result = Redis::get($snd_data['send_id']);
|
Log::info('订单打印推送结果-->' . $res);
|
||||||
if($result) {
|
$result = Redis::get($snd_data['send_id']);
|
||||||
$msg_id_arr = json_decode($result, true);
|
if($result) {
|
||||||
$msg_id_arr_c = count($msg_id_arr);
|
$msg_id_arr = json_decode($result, true);
|
||||||
$msg_id_arr[$msg_id_arr_c] = $snd_data;
|
$msg_id_arr_c = count($msg_id_arr);
|
||||||
$result_n = json_encode($msg_id_arr);
|
$msg_id_arr[$msg_id_arr_c] = $snd_data;
|
||||||
Base::setredis_new($result_n, $snd_data['send_id']);
|
$result_n = json_encode($msg_id_arr);
|
||||||
}else {
|
Base::setredis_new($result_n, $snd_data['send_id']);
|
||||||
$params_arr_n[] = $snd_data;
|
}else {
|
||||||
Base::setredis_new(json_encode($params_arr_n), $snd_data['send_id']);
|
$params_arr_n[] = $snd_data;
|
||||||
}
|
Base::setredis_new(json_encode($params_arr_n), $snd_data['send_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if($is_log) {
|
if($is_log) {
|
||||||
Db::table('tb_mq_log')->insert([
|
Db::table('tb_mq_log')->insert([
|
||||||
'queue' => $queue,
|
'queue' => $queue,
|
||||||
'msg' => $data,
|
'msg' => $data,
|
||||||
'type' => 'orderPrint',
|
'type' => 'orderPrint',
|
||||||
'plat' => 'Cashier',
|
'plat' => 'Cashier',
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
'fail_time' => date('Y-m-d H:i:s'),
|
'fail_time' => date('Y-m-d H:i:s'),
|
||||||
'err_info' => $curl_error,
|
'err_info' => $curl_error,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user