select
user_id,
sum(case when param = 'Won' then value else 0 end) 'Won',
sum(case when param = 'Lose' then value else 0 end) 'Lose'
from user_stats
where param in ('Won', 'Lose')
group by user_id;
function format(string $data): array
{
$make = function (array & $result, string $key, int $value) {
$keys = explode(' ', $key);
$last = array_pop($keys);
while ($current = array_shift($keys))
{
if (!array_key_exists($current, $result)) {
$result[$current] = [];
}
$result = & $result[$current];
}
$result[$last] = + $value;
};
$items = array_filter(array_map('trim', explode('<Sum>', $data)));
$result = [];
foreach ($items as $item) {
$item = str_replace(['[', ']'], ['', ' '], $item);
[$key, $value] = explode(' = ', $item);
$make($result, $key, +$value);
}
return $result;
}
location /websocket {
proxy_pass websockets/websocket;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket specific
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;
}
console.log(this.$slots.header) // не работает
created () {