彭俊 6 years ago
parent
commit
4a9083a2ec
1 changed files with 21 additions and 1 deletions
  1. 21 1
      Application/Sports/Controller/Css.php

+ 21 - 1
Application/Sports/Controller/Css.php

@@ -10,6 +10,7 @@ use Biz\Match\GetmatchData;
 class  Css extends Controller {
 
     public function index(){
+        $data['s_time'] =$this->getMsecToMescdate(time());
         $s = $_REQUEST['data'];
         $arr = [];
         if(strstr($s,',')){
@@ -22,11 +23,30 @@ class  Css extends Controller {
 
         }else{
             for($i=0;$i<=$s;$i++){  
-                $arr[] = $i;
+                $arr[] = $i+1;
             }  
         }
         $data['num'] = count($arr);
+        $data['e_time'] =$this->getMsecToMescdate(time());
+
 
         Render($data, '1', lang('Tips','Sports')->get('success'));
     }
+
+    //获取毫秒级时间
+    public function getMsecToMescdate($msectime)
+    {
+        $msectime = $msectime * 0.001;
+        if(strstr($msectime,'.')){
+            sprintf("%01.3f",$msectime);
+            list($usec, $sec) = explode(".",$msectime);
+            $sec = str_pad($sec,3,"0",STR_PAD_RIGHT);
+        }else{
+            $usec = $msectime;
+            $sec = "000";
+        }
+        $date = date("Y-m-d H:i:s.x",$usec);
+        $mescdate = str_replace('x', $sec, $date);
+        return $mescdate;
+    }
 }