mysql
1.需求是统计群组信息,但是群名等信息和群成员的信息不在同一个表里面。这个时候的sql查询
关注的点:
1.1.时间戳转化成datetime 用方法from_unixtime
1.2.子查询可以直接作为一个参数
select a.group_id as '群id', b.group_name as '群组名称',from_unixtime(b.ctime) as '创建时间', count(*) as '人数', (select user_group_name from user_group as c where admin_level = 10 and c.group_id = a.group_id limit 1) as '群主用户名' from user_group as a LEFT JOIN groups as b on a.group_id = b.id where b.group_type = 1 group by a.group_id order by a.group_id desc;
2.mysql在linux环境下直接执行并输出到对应目录
mysql -u账号 -p密码 -e"select code from user_login where language = 'zh-CN" 数据库名> /data/www/html/zh-CN-code.txt
3.修改字段
alter table groups add `group_cate` tinyint(4) DEFAULT '0' COMMENT '0是私有群 1是公开群',
linux
1.查询这个目录下,所有文件夹的文件大小
du -h --max-depth=1
2.按名字查找
find / -name "文件名"
3.vim的操作
shift + D 后面全删
dw 删除后面的单词
4.抓包命令
tcpdump port 9200 -i any
5.grep支持正则匹配
用-E然后|来致辞正则匹配
cat /data/logs/log.log|grep recv_from | grep -E "(1021432|1001394) ->"
6.awk 分隔和sort -u来去重
redis
1.需要在linux环境下观察一个key的使用情况
watch -n 1 redis-cli llen cache_data_key
php
- php的以为符号,可以用于权限判断
|| substr(decbin(FunctionHelper::getMultiOnlineStatus($msg_arr['rcode']) >> 1), -1) == 1
Yii2
1.ip的库的下载和实现
'ip2location' => [
'class' => '\client\components\IP2Location\Geolocation',
'database' => '/data/www/html/httpserver/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN',
'mode' => 'FILE_IO',
],
2.批量删除redis key
…,然后$del_cmd_ids
是数组
Yii::$app->redisMessage->srem($cmd_key, ...$del_cmd_ids);