1234567891011121314151617181920212223242526272829303132333435363738 |
- <meta charset="utf-8">
- <?php
- /*
- 方倍工作室 http://www.cnblogs.com/txw1958/
- CopyRight 2014 All Rights Reserved
- */
- $uniacid=144;
- $chaoshi=600;
- echo "当前时间:".time();
- echo "<br>";
- echo "超时时间:".time()+$chaoshi;
- echo "<br>";
- chaoshile($uniacid,$chaoshi,$website,$url);
- function chaoshile($uniacid,$chaoshi,$website,$url){
- //超时自动退出 读取时间表 读取客服表 判断时间 超过的 ->设置成空闲 .给用户发消息超时退出.
- $json = file_get_contents('json/'.$uniacid.'_time.json');//读取key列表
- $kefutime = json_decode($json,true);
- print_r($kefutime);
- echo "<br>";
- $json = file_get_contents('json/'.$uniacid.'_kefu.json');//读取数字key列表
- $kefustr = json_decode($json,true);
- print_r($kefustr);
- echo "<br>";
- $arr = array_keys($kefutime);//openid
- foreach ($arr as $arr){
- $kftime=$kefutime[$arr]+$chaoshi;
- if ($kftime<time()){
- //给老客户发信息
-
- //设置新标签
- $kefustr[$arr]='空闲';
- }
- }
- print_r($kefustr);
- // $res=file_put_contents("json/".$uniacid."_kefu.json", json_encode($kefustr));
-
- }
- ?>
|