去掉内部端口
This commit is contained in:
parent
3968794197
commit
1b8274d084
|
|
@ -27,37 +27,37 @@ class Events
|
|||
// $url = 'http://127.0.0.1:8686/?method=sendToUid&account=101¶ms={"data_type":"order","order_id":"2541"}';
|
||||
// $url = 'https://sockets.sxczgkj.com/s/account/overview';
|
||||
// 开启内部通讯接口。便于内部通讯
|
||||
$http_worker = new Worker('http://127.0.0.1:8686');
|
||||
$http_worker->reusePort = true;
|
||||
$http_worker->onMessage = function (TcpConnection $connection, Request $request) {
|
||||
$method = $request->get('method');
|
||||
$account = $request->get('account');
|
||||
$params = $request->get('params');
|
||||
if (method_exists(Gateway::class, $method)) {
|
||||
call_user_func_array([Gateway::class, $method], [$account, $params]);
|
||||
Log::info('打印8686收到消息-->' . $params);
|
||||
$params_arr = json_decode($params, true);
|
||||
// 如果是订单打印并且通过uid推送, 保存redis
|
||||
if($params_arr['operate_type'] == 'order_print' && $method == 'sendToUid') {
|
||||
$result = Redis::get($params_arr['send_id']);
|
||||
if($result) {
|
||||
$msg_id_arr = json_decode($result, true);
|
||||
$msg_id_arr_c = count($msg_id_arr);
|
||||
$msg_id_arr[$msg_id_arr_c] = $params_arr;
|
||||
$result_n = json_encode($msg_id_arr);
|
||||
Base::setredis_new($result_n, $params_arr['send_id']);
|
||||
}else {
|
||||
$params_arr_n[] = $params_arr;
|
||||
print_r('数组-------->' . json_encode($params_arr_n)) . "\r\n";
|
||||
Base::setredis_new(json_encode($params_arr_n), $params_arr['send_id']);
|
||||
}
|
||||
}
|
||||
|
||||
return $connection->send('ok');
|
||||
}
|
||||
return $connection->send('fail');
|
||||
};
|
||||
$http_worker->listen();
|
||||
// $http_worker = new Worker('http://127.0.0.1:8686');
|
||||
// $http_worker->reusePort = true;
|
||||
// $http_worker->onMessage = function (TcpConnection $connection, Request $request) {
|
||||
// $method = $request->get('method');
|
||||
// $account = $request->get('account');
|
||||
// $params = $request->get('params');
|
||||
// if (method_exists(Gateway::class, $method)) {
|
||||
// call_user_func_array([Gateway::class, $method], [$account, $params]);
|
||||
// Log::info('打印8686收到消息-->' . $params);
|
||||
// $params_arr = json_decode($params, true);
|
||||
// // 如果是订单打印并且通过uid推送, 保存redis
|
||||
// if($params_arr['operate_type'] == 'order_print' && $method == 'sendToUid') {
|
||||
// $result = Redis::get($params_arr['send_id']);
|
||||
// if($result) {
|
||||
// $msg_id_arr = json_decode($result, true);
|
||||
// $msg_id_arr_c = count($msg_id_arr);
|
||||
// $msg_id_arr[$msg_id_arr_c] = $params_arr;
|
||||
// $result_n = json_encode($msg_id_arr);
|
||||
// Base::setredis_new($result_n, $params_arr['send_id']);
|
||||
// }else {
|
||||
// $params_arr_n[] = $params_arr;
|
||||
// print_r('数组-------->' . json_encode($params_arr_n)) . "\r\n";
|
||||
// Base::setredis_new(json_encode($params_arr_n), $params_arr['send_id']);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $connection->send('ok');
|
||||
// }
|
||||
// return $connection->send('fail');
|
||||
// };
|
||||
// $http_worker->listen();
|
||||
if($worker->id == 1) {
|
||||
print_r('定时器');
|
||||
// 启动定时器 定时器处理消息回执/在线列表
|
||||
|
|
|
|||
Loading…
Reference in New Issue