呼叫系统软电话eyebeam/x-lite使用

近期为公司客服人员开发了一套呼叫系统,嫁接OA系统实现快速、随时随地登陆系统呼叫客户。

  • 硬件基于上海迅时OM80E
  • 呼叫系统自行开发(当前仅开发了外呼、录音等核心功能,后期逐步完善语音导航菜单、呼入及公司账号、单一OM多应用公用等等)
  • 软电话使用eyebeam
  • 外网访问可选择内网穿透或公网IP(穿透需局域网录音脚本上传服务器,公网可即时回放通话录音)

- 阅读剩余部分 -

手机点击图片显示蓝色区域 bootstrap点击阴影modal模态框不消失

*{
    -webkit-tap-highlight-color: rgba(255,0,0,0);
    -webkit-appearance:none;
}    

//在样式里面加个这个就会没有蓝色的区域

bootstrap点击阴影模态框不消失

  1. 模态框添加data-backdrop="static"
  2. 调用 $("#myModal").modal({backdrop:'static',keyboard:false});
  3. 为 static 时,点击模态对话框的外部区域不会将其关闭。

keyboard 为 false 时,按下 Esc 键不会关闭 Modal。

git 常用操作

  1. 全局配置
    git config --global user.name "hitortoise"

git config --global user.email "yzhsh89@126.com"

  1. 生成密钥
    ssh-keygen -t rsa -C"yzhsh89@126.com"
  2. 服务端添加公钥
    vim ~/.ssh/authorized_keys
  3. 创建裸仓库
    git init --bare sample.git

chown -R git:git sample.git

  1. 克隆
    git clone git@server:/srv/sample.git
  2. git不能显示中文
    git config --global core.quotepath false

MySql 百千万级别数据中随机获取一条或多条记录之RAND()优化

最近所做读书小程序中需从千万条数据中随机抽取一条名言语录展示,常规的select * from famous order by RAND() LIMIT 1;,缺少索引及全表扫描,速度异常慢。
SELECT * FROM famous AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM famous)-(SELECT MIN(id) FROM famous))+(SELECT MIN(id) FROM famous)) AS id) AS t2 WHERE t1.id >= t2.id ORDER BY t1.id LIMIT 1;

date("Y-m-d",strtotime("-1 month")) 真的靠谱吗?

时常用date("Y-m-d",strtotime("-1 month"))获取上个月的日期,其实它并不靠谱。
如当前日期未3月3,则:var_dump(date("Y-m-d", strtotime("-1 month", strtotime("2018-03-31"))));
得到的结果并非2018-02-28而是2018-03-03
正确的方式之一是添加last day of first day of
var_dump(date("Y-m-d", strtotime("last day of -1 month", strtotime("2017-03-31"))));

php将base64保存为图片

<?php 
$base64_url = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkNFN0E3M0I0Mjc4NDExRTU5RkYxQjg1Rjk2QkEyNzBEIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkNFN0E3M0I1Mjc4NDExRTU5RkYxQjg1Rjk2QkEyNzBEIj4gPHhtcE1NOkRlcml2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IPU/ZFkwFUxu/dYk8M3c3ZNNjnKzsEXgmKPKxo12/G+MOOri+YslPCPXnSst2yTSEjTNkBkBcSmCd/Nu1aDF/hl15cDmdGYO26SXrtGuUs5AZT1kQrn2xIn1la6TQx1/rDT0TR9pMFxUL6fogeraJ6nBWS2k+uZQZUyauPtOO38dNNv1cltZqTzvH0WOZ49oMaqlND321yPCfSbF2ad5UXufaMFiIKLER9BqOK9Ea4m2CZEk61mrOQyYDiJjUpzFpqb5nad8olkjsfvG6RC7oIRsBsSY62SN9H6Lopd3MtyvmorcCM4gD0dkxnk7eiHARHEWg84RWkUXPinZEQeSXsCa8wOYXQqxIi31aAQN3R/rTEAv1lqCNs3taSTqoEmclmqf2FIFlCm3cGvBeBzoOt4I7vraqgJvW+awPF9B0MgJ9RRZYz+5a+75qKTEWmIstuFfm+q7RJve8ayH4LMACaxEJEaXs23AAAAABJRU5ErkJggg==';

preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_url, $result);
$type = $result[2];

$base64_body = substr(strstr($base64_url,','),1);
$img = base64_decode($base64_body);

$file_name_ok = md5(time()).".".$type;
file_put_contents($file_name_ok, $img);